Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
05a8f44a
Commit
05a8f44a
authored
Aug 22, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into topic/ip-endpoint
parents
6acea262
097df535
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
164 additions
and
73 deletions
+164
-73
CMakeLists.txt
CMakeLists.txt
+21
-8
Jenkinsfile
Jenkinsfile
+1
-1
cmake/FindCAF.cmake
cmake/FindCAF.cmake
+2
-1
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+1
-0
libcaf_core/caf/detail/append_percent_encoded.hpp
libcaf_core/caf/detail/append_percent_encoded.hpp
+33
-0
libcaf_core/caf/detail/uri_impl.hpp
libcaf_core/caf/detail/uri_impl.hpp
+0
-4
libcaf_core/caf/uri.hpp
libcaf_core/caf/uri.hpp
+3
-0
libcaf_core/src/append_hex.cpp
libcaf_core/src/append_hex.cpp
+1
-1
libcaf_core/src/append_percent_encoded.cpp
libcaf_core/src/append_percent_encoded.cpp
+65
-0
libcaf_core/src/uri.cpp
libcaf_core/src/uri.cpp
+29
-0
libcaf_core/src/uri_impl.cpp
libcaf_core/src/uri_impl.cpp
+8
-58
No files found.
CMakeLists.txt
View file @
05a8f44a
...
...
@@ -4,6 +4,14 @@ project(caf C CXX)
include
(
CheckCSourceCompiles
)
include
(
CheckCSourceRuns
)
get_directory_property
(
_parent PARENT_DIRECTORY
)
if
(
_parent
)
set
(
caf_is_subproject ON
)
else
()
set
(
caf_is_subproject OFF
)
endif
()
unset
(
_parent
)
# Be nice to VIM users and Clang tools.
set
(
CMAKE_EXPORT_COMPILE_COMMANDS 1
)
...
...
@@ -50,7 +58,9 @@ else()
endif
()
# add helper target that simplifies re-running configure
add_custom_target
(
configure COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/config.status
)
if
(
NOT caf_is_subproject
)
add_custom_target
(
configure COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/config.status
)
endif
()
################################################################################
# utility functions #
...
...
@@ -159,14 +169,14 @@ endif()
# set module path appropriately
set
(
CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
# set binary output path if not defined by user
if
(
EXECUTABLE_OUTPUT_PATH STREQUAL
""
)
if
(
NOT EXECUTABLE_OUTPUT_PATH
)
set
(
EXECUTABLE_OUTPUT_PATH
"
${
CMAKE_CURRENT_BINARY_DIR
}
/bin"
)
endif
()
# set library output path if not defined by user, but always set
# library output path to binary output path for Xcode projects
if
(
CMAKE_GENERATOR STREQUAL
"Xcode"
)
set
(
LIBRARY_OUTPUT_PATH
"
${
EXECUTABLE_OUTPUT_PATH
}
"
)
elseif
(
LIBRARY_OUTPUT_PATH STREQUAL
""
)
elseif
(
NOT LIBRARY_OUTPUT_PATH
)
set
(
LIBRARY_OUTPUT_PATH
"
${
CMAKE_CURRENT_BINARY_DIR
}
/lib"
)
endif
()
...
...
@@ -404,12 +414,15 @@ install(DIRECTORY libcaf_test/caf/ DESTINATION include/caf
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/cmake_uninstall.cmake.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
# add uninstall target
add_custom_target
(
uninstall
# add uninstall target if it does not exist yet
if
(
NOT TARGET uninstall
)
add_custom_target
(
uninstall
)
endif
()
add_custom_command
(
TARGET uninstall
PRE_BUILD
COMMAND
"
${
CMAKE_COMMAND
}
"
-P
"
${
CMAKE_CURRENT_BINARY_DIR
}
/cmake_uninstall.cmake"
)
################################################################################
# set inclue paths for subprojects #
################################################################################
...
...
Jenkinsfile
View file @
05a8f44a
...
...
@@ -88,7 +88,7 @@ config = [
],
// Configures what binary the coverage report uses and what paths to exclude.
coverage:
[
binary:
'build/caf-test'
,
binary:
'build/
bin/
caf-test'
,
relativeExcludePaths:
[
'examples'
,
'tools'
,
...
...
cmake/FindCAF.cmake
View file @
05a8f44a
...
...
@@ -91,7 +91,8 @@ foreach (comp ${CAF_FIND_COMPONENTS})
/usr/local/lib
/opt/local/lib
/sw/lib
${
CMAKE_INSTALL_PREFIX
}
/lib
)
${
CMAKE_INSTALL_PREFIX
}
/lib
${
CMAKE_INSTALL_PREFIX
}
/lib/
${
CMAKE_BUILD_TYPE
}
)
mark_as_advanced
(
CAF_LIBRARY_
${
UPPERCOMP
}
)
if
(
"
${
CAF_LIBRARY_
${
UPPERCOMP
}}
"
STREQUAL
"CAF_LIBRARY_
${
UPPERCOMP
}
-NOTFOUND"
)
...
...
libcaf_core/CMakeLists.txt
View file @
05a8f44a
...
...
@@ -26,6 +26,7 @@ set(LIBCAF_CORE_SRCS
src/actor_system.cpp
src/actor_system_config.cpp
src/append_hex.cpp
src/append_percent_encoded.cpp
src/atom.cpp
src/attachable.cpp
src/behavior.cpp
...
...
libcaf_core/caf/detail/append_percent_encoded.hpp
0 → 100644
View file @
05a8f44a
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#pragma once
#include "caf/detail/append_hex.hpp"
#include "caf/fwd.hpp"
namespace
caf
{
namespace
detail
{
// Escapes all reserved characters according to RFC 3986 in `x` and
// adds the encoded string to `str`.
void
append_percent_encoded
(
std
::
string
&
str
,
string_view
x
,
bool
is_path
=
false
);
}
// namespace detail
}
// namespace caf
libcaf_core/caf/detail/uri_impl.hpp
View file @
05a8f44a
...
...
@@ -76,10 +76,6 @@ public:
/// Assembles the human-readable string representation for this URI.
void
assemble_str
();
// Escapes all reserved characters according to RFC 3986 in `x` and
// adds the encoded string to `str`.
void
add_encoded
(
string_view
x
,
bool
is_path
=
false
);
// -- friend functions -------------------------------------------------------
friend
void
intrusive_ptr_add_ref
(
const
uri_impl
*
p
);
...
...
libcaf_core/caf/uri.hpp
View file @
05a8f44a
...
...
@@ -134,6 +134,9 @@ typename Inspector::result_type inspect(Inspector& f, uri::authority_type& x) {
/// @relates uri
std
::
string
to_string
(
const
uri
&
x
);
/// @relates uri
std
::
string
to_string
(
const
uri
::
authority_type
&
x
);
/// @relates uri
error
parse
(
string_view
str
,
uri
&
dest
);
...
...
libcaf_core/src/append_hex.cpp
View file @
05a8f44a
...
...
@@ -16,7 +16,7 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/detail/
stringification_inspector
.hpp"
#include "caf/detail/
append_hex
.hpp"
namespace
caf
{
namespace
detail
{
...
...
libcaf_core/src/append_percent_encoded.cpp
0 → 100644
View file @
05a8f44a
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/detail/append_percent_encoded.hpp"
#include "caf/config.hpp"
#include "caf/detail/append_hex.hpp"
#include "caf/string_view.hpp"
namespace
caf
{
namespace
detail
{
void
append_percent_encoded
(
std
::
string
&
str
,
string_view
x
,
bool
is_path
)
{
for
(
auto
ch
:
x
)
switch
(
ch
)
{
case
'/'
:
if
(
is_path
)
{
str
+=
ch
;
break
;
}
CAF_ANNOTATE_FALLTHROUGH
;
case
' '
:
case
':'
:
case
'?'
:
case
'#'
:
case
'['
:
case
']'
:
case
'@'
:
case
'!'
:
case
'$'
:
case
'&'
:
case
'\''
:
case
'"'
:
case
'('
:
case
')'
:
case
'*'
:
case
'+'
:
case
','
:
case
';'
:
case
'='
:
str
+=
'%'
;
append_hex
(
str
,
reinterpret_cast
<
uint8_t
*>
(
&
ch
),
1
);
break
;
default:
str
+=
ch
;
}
}
}
// namespace detail
}
// namespace caf
libcaf_core/src/uri.cpp
View file @
05a8f44a
...
...
@@ -19,7 +19,9 @@
#include "caf/uri.hpp"
#include "caf/deserializer.hpp"
#include "caf/detail/append_percent_encoded.hpp"
#include "caf/detail/fnv_hash.hpp"
#include "caf/detail/overload.hpp"
#include "caf/detail/parser/read_uri.hpp"
#include "caf/detail/uri_impl.hpp"
#include "caf/error.hpp"
...
...
@@ -101,6 +103,33 @@ std::string to_string(const uri& x) {
return
result
;
}
std
::
string
to_string
(
const
uri
::
authority_type
&
x
)
{
std
::
string
str
;
if
(
!
x
.
userinfo
.
empty
())
{
detail
::
append_percent_encoded
(
str
,
x
.
userinfo
);
str
+=
'@'
;
}
auto
f
=
caf
::
detail
::
make_overload
(
[
&
](
const
ip_address
&
addr
)
{
if
(
addr
.
embeds_v4
())
{
str
+=
to_string
(
addr
);
}
else
{
str
+=
'['
;
str
+=
to_string
(
addr
);
str
+=
']'
;
}
},
[
&
](
const
std
::
string
&
host
)
{
detail
::
append_percent_encoded
(
str
,
host
);
});
visit
(
f
,
x
.
host
);
if
(
x
.
port
!=
0
)
{
str
+=
':'
;
str
+=
std
::
to_string
(
x
.
port
);
}
return
str
;
}
error
parse
(
string_view
str
,
uri
&
dest
)
{
using
namespace
detail
::
parser
;
uri_builder
builder
;
...
...
libcaf_core/src/uri_impl.cpp
View file @
05a8f44a
...
...
@@ -18,6 +18,7 @@
#include "caf/detail/uri_impl.hpp"
#include "caf/detail/append_percent_encoded.hpp"
#include "caf/detail/parser/read_uri.hpp"
#include "caf/error.hpp"
#include "caf/ip_address.hpp"
...
...
@@ -39,41 +40,26 @@ uri_impl uri_impl::default_instance;
// -- modifiers ----------------------------------------------------------------
void
uri_impl
::
assemble_str
()
{
a
dd_encoded
(
scheme
);
a
ppend_percent_encoded
(
str
,
scheme
);
str
+=
':'
;
if
(
authority
.
empty
())
{
CAF_ASSERT
(
!
path
.
empty
());
a
dd_encoded
(
path
,
true
);
a
ppend_percent_encoded
(
str
,
path
,
true
);
}
else
{
str
+=
"//"
;
if
(
!
authority
.
userinfo
.
empty
())
{
add_encoded
(
authority
.
userinfo
);
str
+=
'@'
;
}
auto
addr
=
get_if
<
ip_address
>
(
&
authority
.
host
);
if
(
addr
==
nullptr
)
{
add_encoded
(
get
<
std
::
string
>
(
authority
.
host
));
}
else
{
str
+=
'['
;
str
+=
to_string
(
*
addr
);
str
+=
']'
;
}
if
(
authority
.
port
!=
0
)
{
str
+=
':'
;
str
+=
std
::
to_string
(
authority
.
port
);
}
str
+=
to_string
(
authority
);
if
(
!
path
.
empty
())
{
str
+=
'/'
;
a
dd_encoded
(
path
,
true
);
a
ppend_percent_encoded
(
str
,
path
,
true
);
}
}
if
(
!
query
.
empty
())
{
str
+=
'?'
;
auto
i
=
query
.
begin
();
auto
add_kvp
=
[
&
](
decltype
(
*
i
)
kvp
)
{
a
dd_encoded
(
kvp
.
first
);
a
ppend_percent_encoded
(
str
,
kvp
.
first
);
str
+=
'='
;
a
dd_encoded
(
kvp
.
second
);
a
ppend_percent_encoded
(
str
,
kvp
.
second
);
};
add_kvp
(
*
i
);
for
(
++
i
;
i
!=
query
.
end
();
++
i
)
{
...
...
@@ -83,43 +69,7 @@ void uri_impl::assemble_str() {
}
if
(
!
fragment
.
empty
())
{
str
+=
'#'
;
add_encoded
(
fragment
);
}
}
void
uri_impl
::
add_encoded
(
string_view
x
,
bool
is_path
)
{
for
(
auto
ch
:
x
)
switch
(
ch
)
{
case
'/'
:
if
(
is_path
)
{
str
+=
ch
;
break
;
}
CAF_ANNOTATE_FALLTHROUGH
;
case
' '
:
case
':'
:
case
'?'
:
case
'#'
:
case
'['
:
case
']'
:
case
'@'
:
case
'!'
:
case
'$'
:
case
'&'
:
case
'\''
:
case
'"'
:
case
'('
:
case
')'
:
case
'*'
:
case
'+'
:
case
','
:
case
';'
:
case
'='
:
str
+=
'%'
;
detail
::
append_hex
(
str
,
reinterpret_cast
<
uint8_t
*>
(
&
ch
),
1
);
break
;
default:
str
+=
ch
;
append_percent_encoded
(
str
,
fragment
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment