Skip to content

Support asio standalone #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# project
buildnumber
src/version.h
build/**
build-debug/**
build-release/**
nbproject/**
run/**
*.log**
*.xml
*nbproject*
*.swp
/version.toml
cmake/FindCustom**
.vscode
*.bak

## Directory-based project format:
deploy/**
cmake-build*/**
cmake-rapid*/**
.idea/
**/.idea/
*/.idea
*/.idea/**
*.swp
tests/log/**
vendor/lib/**
vendor/pkg/**
vendor/bin/**
vendor-old/**
vendor-old/**/*
opt/**
dist-**/

# C++
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# C
# Object files
*.o
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/

# MAC OS X
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


# Linux
*~

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*
34 changes: 34 additions & 0 deletions include/boost/application/asio_wrapper.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef BOOST_APPLICATION_ASIO_WRAPPER_HPP
#define BOOST_APPLICATION_ASIO_WRAPPER_HPP

#ifdef ASIO_STANDALONE
#include <asio.hpp>
#include <asio/error_code.hpp>
#include <asio/system_error.hpp>
#include <filesystem>
#else
#include <boost/asio.hpp>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#endif

namespace boost { namespace application {

#ifdef ASIO_STANDALONE

using aio = asio::io_context;
using error_code_t = asio::error_code;
using system_error_t = asio::system_error;
namespace fs = std::filesystem;

#else

using aio = boost::asio::io_context;
using error_code_t = boost::system::error_code;
using system_error_t = boost::system::system_error;
namespace fs = boost::filesystem;
#endif

}} // boost::application

#endif
14 changes: 7 additions & 7 deletions include/boost/application/aspects/limit_single_instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace boost { namespace application {
* running on current operating system.
*
*/
virtual bool lock(boost::system::error_code &ec) = 0;
virtual bool lock(error_code_t& ec) = 0;
virtual bool lock() = 0;

virtual bool is_another_instance_running() = 0;
Expand Down Expand Up @@ -132,7 +132,7 @@ namespace boost { namespace application {
}

/*!
* Creates a system mutex, the ec ( boost::system::error_code& ec)
* Creates a system mutex, the ec ( error_code_t& ec)
* will be set to the result of the operation, they should be
* tested for errors.
*
Expand All @@ -144,7 +144,7 @@ namespace boost { namespace application {
* running on current operating system.
*
*/
bool lock(boost::system::error_code &ec)
bool lock(error_code_t& ec)
{
std::string instance_id =
to_upper_copy(boost::lexical_cast<std::string>(uuid_));
Expand Down Expand Up @@ -178,7 +178,7 @@ namespace boost { namespace application {
*
*/
bool lock() {
boost::system::error_code ec;
error_code_t ec;

bool result = lock(ec);
if(ec) BOOST_APPLICATION_THROW_LAST_SYSTEM_ERROR_USING_MY_EC(
Expand Down Expand Up @@ -260,7 +260,7 @@ namespace boost { namespace application {
{}

/*!
* Creates a system mutex, the ec ( boost::system::error_code& ec)
* Creates a system mutex, the ec ( error_code_t& ec)
* will be set to the result of the operation, they should be
* tested for errors.
*
Expand All @@ -272,7 +272,7 @@ namespace boost { namespace application {
* running on current operating system.
*
*/
bool lock(boost::system::error_code &ec) {
bool lock(error_code_t& ec) {
return impl_->lock(uuid_, ec);
}

Expand All @@ -286,7 +286,7 @@ namespace boost { namespace application {
*
*/
bool lock() {
boost::system::error_code ec;
error_code_t ec;

bool result = lock(ec);
if(ec) BOOST_APPLICATION_THROW_LAST_SYSTEM_ERROR_USING_MY_EC(
Expand Down
30 changes: 15 additions & 15 deletions include/boost/application/aspects/path.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,77 +28,77 @@ namespace boost { namespace application {
public:
path() : impl_(new detail::default_path_impl) {}

filesystem::path current_path(void)
fs::path current_path(void)
{
return impl_->current_path();
}

filesystem::path location(boost::system::error_code &ec)
fs::path location(error_code_t& ec)
{
return impl_->location(ec);
}

filesystem::path location()
fs::path location()
{
return impl_->location();
}

filesystem::path executable_path_name(boost::system::error_code &ec)
fs::path executable_path_name(error_code_t& ec)
{
return impl_->location(ec);
}

filesystem::path executable_path_name()
fs::path executable_path_name()
{
return impl_->location();
}

filesystem::path executable_path(boost::system::error_code &ec)
fs::path executable_path(error_code_t& ec)
{
return location(ec).parent_path();
}

filesystem::path executable_path()
fs::path executable_path()
{
return impl_->location().parent_path();
}

filesystem::path executable_full_name(boost::system::error_code &ec)
fs::path executable_full_name(error_code_t& ec)
{
return impl_->location(ec).filename();
}

filesystem::path executable_full_name(void)
fs::path executable_full_name(void)
{
return impl_->location().filename();
}

filesystem::path executable_name(boost::system::error_code &ec)
fs::path executable_name(error_code_t& ec)
{
return impl_->location(ec).stem();
}

filesystem::path executable_name(void)
fs::path executable_name(void)
{
return impl_->location().stem();
}

filesystem::path home_path(void)
fs::path home_path(void)
{
return impl_->home_path();
}

filesystem::path config_path(void)
fs::path config_path(void)
{
return impl_->config_path();
}

filesystem::path app_data_path(void)
fs::path app_data_path(void)
{
return impl_->app_data_path();
}

filesystem::path temp_path(void)
fs::path temp_path(void)
{
return impl_->temp_path();
}
Expand Down
6 changes: 3 additions & 3 deletions include/boost/application/aspects/selfpipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ namespace boost { namespace application {

selfpipe()
{
boost::system::error_code ec;
error_code_t ec;

setup(ec);

if(ec) BOOST_APPLICATION_THROW_LAST_SYSTEM_ERROR_USING_MY_EC(
"selfpipe() failed", ec);
}

selfpipe(boost::system::error_code &ec)
selfpipe(error_code_t& ec)
{
setup(ec);
}
Expand All @@ -64,7 +64,7 @@ namespace boost { namespace application {

protected:

void setup(boost::system::error_code &ec)
void setup(error_code_t& ec)
{
if (pipe(fd_) == -1)
{
Expand Down
8 changes: 4 additions & 4 deletions include/boost/application/auto_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace boost { namespace application {

static int start() {

system::error_code ec; int ret = 0;
error_code_t ec; int ret = 0;
ret = auto_app<ApplicationMode, Application, Context, CustomType>::start(ec);

if(ec) BOOST_APPLICATION_THROW_LAST_SYSTEM_ERROR_USING_MY_EC(
Expand Down Expand Up @@ -119,7 +119,7 @@ namespace boost { namespace application {

static int start(uuids::uuid& appid) {

system::error_code ec; int ret = 0;
error_code_t ec; int ret = 0;

ret = auto_app<ApplicationMode, Application, Context, CustomType>::start(appid, ec);

Expand Down Expand Up @@ -156,7 +156,7 @@ namespace boost { namespace application {

static int start(int argc, character_types::char_type *argv[]) {

system::error_code ec; int ret = 0;
error_code_t ec; int ret = 0;
ret = auto_app<ApplicationMode, Application, Context, CustomType>::start(argc, argv, ec);

if(ec) BOOST_APPLICATION_THROW_LAST_SYSTEM_ERROR_USING_MY_EC(
Expand Down Expand Up @@ -200,7 +200,7 @@ namespace boost { namespace application {

static int start(int argc, character_types::char_type *argv[], uuids::uuid& appid) {

system::error_code ec; int ret = 0;
error_code_t ec; int ret = 0;
ret = auto_app<ApplicationMode, Application, Context, CustomType>::start(argc, argv, appid, ec);

if(ec) BOOST_APPLICATION_THROW_LAST_SYSTEM_ERROR_USING_MY_EC(
Expand Down
2 changes: 1 addition & 1 deletion include/boost/application/common_application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace boost { namespace application {
template <typename Application, typename SignalManager>
common(Application& myapp, SignalManager &sm,
application::context &context,
boost::system::error_code& ec)
error_code_t& ec)
: impl_(new common_application_impl(
boost::bind(&Application::operator(), &myapp), sm,
context, ec)) {
Expand Down
Loading