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
8ccf92c9
Commit
8ccf92c9
authored
Mar 23, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support lowercase output in append_hex
parent
fdce05dd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
57 deletions
+33
-57
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+0
-1
libcaf_core/caf/detail/append_hex.hpp
libcaf_core/caf/detail/append_hex.hpp
+28
-12
libcaf_core/caf/detail/append_percent_encoded.hpp
libcaf_core/caf/detail/append_percent_encoded.hpp
+2
-3
libcaf_core/caf/detail/parser/add_ascii.hpp
libcaf_core/caf/detail/parser/add_ascii.hpp
+1
-0
libcaf_core/caf/intrusive_ptr.hpp
libcaf_core/caf/intrusive_ptr.hpp
+1
-2
libcaf_core/src/detail/append_hex.cpp
libcaf_core/src/detail/append_hex.cpp
+0
-38
libcaf_core/src/ipv6_address.cpp
libcaf_core/src/ipv6_address.cpp
+0
-1
libcaf_core/src/node_id.cpp
libcaf_core/src/node_id.cpp
+1
-0
No files found.
libcaf_core/CMakeLists.txt
View file @
8ccf92c9
...
@@ -56,7 +56,6 @@ set(CAF_CORE_SOURCES
...
@@ -56,7 +56,6 @@ set(CAF_CORE_SOURCES
src/deserializer.cpp
src/deserializer.cpp
src/detail/abstract_worker.cpp
src/detail/abstract_worker.cpp
src/detail/abstract_worker_hub.cpp
src/detail/abstract_worker_hub.cpp
src/detail/append_hex.cpp
src/detail/append_percent_encoded.cpp
src/detail/append_percent_encoded.cpp
src/detail/behavior_impl.cpp
src/detail/behavior_impl.cpp
src/detail/behavior_stack.cpp
src/detail/behavior_stack.cpp
...
...
libcaf_core/caf/detail/append_hex.hpp
View file @
8ccf92c9
...
@@ -21,25 +21,41 @@
...
@@ -21,25 +21,41 @@
#include <string>
#include <string>
#include <type_traits>
#include <type_traits>
#include "caf/byte.hpp"
#include "caf/detail/core_export.hpp"
#include "caf/detail/core_export.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/type_traits.hpp"
namespace
caf
::
detail
{
namespace
caf
::
detail
{
CAF_CORE_EXPORT
void
enum
class
hex_format
{
append_hex
(
std
::
string
&
result
,
const
uint8_t
*
xs
,
size_t
n
);
uppercase
,
lowercase
,
template
<
class
T
>
};
enable_if_t
<
has_data_member
<
T
>::
value
>
append_hex
(
std
::
string
&
result
,
const
T
&
x
)
{
template
<
hex_format
format
=
hex_format
::
uppercase
>
return
append_hex
(
result
,
reinterpret_cast
<
const
uint8_t
*>
(
x
.
data
()),
void
append_hex
(
std
::
string
&
result
,
const
void
*
vptr
,
size_t
n
)
{
x
.
size
());
if
(
n
==
0
)
{
result
+=
"00"
;
return
;
}
auto
xs
=
reinterpret_cast
<
const
uint8_t
*>
(
vptr
);
const
char
*
tbl
;
if
constexpr
(
format
==
hex_format
::
uppercase
)
tbl
=
"0123456789ABCDEF"
;
else
tbl
=
"0123456789abcdef"
;
char
buf
[
3
]
=
{
0
,
0
,
0
};
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
auto
c
=
xs
[
i
];
buf
[
0
]
=
tbl
[
c
>>
4
];
buf
[
1
]
=
tbl
[
c
&
0x0F
];
result
+=
buf
;
}
}
}
template
<
class
T
>
template
<
hex_format
format
=
hex_format
::
uppercase
,
class
T
=
int
>
enable_if_t
<
std
::
is_integral
<
T
>::
value
>
void
append_hex
(
std
::
string
&
result
,
const
T
&
x
)
{
append_hex
(
std
::
string
&
result
,
const
T
&
x
)
{
append_hex
<
format
>
(
result
,
&
x
,
sizeof
(
T
));
return
append_hex
(
result
,
reinterpret_cast
<
const
uint8_t
*>
(
&
x
),
sizeof
(
T
));
}
}
}
// namespace caf::detail
}
// namespace caf::detail
libcaf_core/caf/detail/append_percent_encoded.hpp
View file @
8ccf92c9
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
#pragma once
#pragma once
#include "caf/detail/append_hex.hpp"
#include "caf/detail/core_export.hpp"
#include "caf/detail/core_export.hpp"
#include "caf/fwd.hpp"
#include "caf/fwd.hpp"
...
@@ -26,7 +25,7 @@ namespace caf::detail {
...
@@ -26,7 +25,7 @@ namespace caf::detail {
// Escapes all reserved characters according to RFC 3986 in `x` and
// Escapes all reserved characters according to RFC 3986 in `x` and
// adds the encoded string to `str`.
// adds the encoded string to `str`.
CAF_CORE_EXPORT
void
CAF_CORE_EXPORT
void
append_percent_encoded
(
std
::
string
&
str
,
string_view
x
,
append_percent_encoded
(
std
::
string
&
str
,
string_view
x
,
bool
is_path
=
false
);
bool
is_path
=
false
);
}
// namespace caf::detail
}
// namespace caf::detail
libcaf_core/caf/detail/parser/add_ascii.hpp
View file @
8ccf92c9
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <limits>
#include <limits>
#include "caf/config.hpp"
#include "caf/detail/parser/ascii_to_int.hpp"
#include "caf/detail/parser/ascii_to_int.hpp"
#include "caf/detail/type_traits.hpp"
#include "caf/detail/type_traits.hpp"
...
...
libcaf_core/caf/intrusive_ptr.hpp
View file @
8ccf92c9
...
@@ -267,8 +267,7 @@ bool operator<(const T* x, const intrusive_ptr<T>& y) {
...
@@ -267,8 +267,7 @@ bool operator<(const T* x, const intrusive_ptr<T>& y) {
template
<
class
T
>
template
<
class
T
>
std
::
string
to_string
(
const
intrusive_ptr
<
T
>&
x
)
{
std
::
string
to_string
(
const
intrusive_ptr
<
T
>&
x
)
{
std
::
string
result
;
std
::
string
result
;
auto
v
=
reinterpret_cast
<
uintptr_t
>
(
x
.
get
());
detail
::
append_hex
(
result
,
reinterpret_cast
<
uintptr_t
>
(
x
.
get
()));
detail
::
append_hex
(
result
,
reinterpret_cast
<
uint8_t
*>
(
&
v
),
sizeof
(
v
));
return
result
;
return
result
;
}
}
...
...
libcaf_core/src/detail/append_hex.cpp
deleted
100644 → 0
View file @
fdce05dd
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| 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_hex.hpp"
namespace
caf
::
detail
{
void
append_hex
(
std
::
string
&
result
,
const
uint8_t
*
xs
,
size_t
n
)
{
if
(
n
==
0
)
{
result
+=
"00"
;
return
;
}
auto
tbl
=
"0123456789ABCDEF"
;
char
buf
[
3
]
=
{
0
,
0
,
0
};
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
auto
c
=
xs
[
i
];
buf
[
0
]
=
tbl
[
c
>>
4
];
buf
[
1
]
=
tbl
[
c
&
0x0F
];
result
+=
buf
;
}
}
}
// namespace caf::detail
libcaf_core/src/ipv6_address.cpp
View file @
8ccf92c9
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include <cstring>
#include <cstring>
#include "caf/detail/append_hex.hpp"
#include "caf/detail/network_order.hpp"
#include "caf/detail/network_order.hpp"
#include "caf/detail/parser/read_ipv6_address.hpp"
#include "caf/detail/parser/read_ipv6_address.hpp"
#include "caf/error.hpp"
#include "caf/error.hpp"
...
...
libcaf_core/src/node_id.cpp
View file @
8ccf92c9
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include "caf/binary_serializer.hpp"
#include "caf/binary_serializer.hpp"
#include "caf/config.hpp"
#include "caf/config.hpp"
#include "caf/deserializer.hpp"
#include "caf/deserializer.hpp"
#include "caf/detail/append_hex.hpp"
#include "caf/detail/get_mac_addresses.hpp"
#include "caf/detail/get_mac_addresses.hpp"
#include "caf/detail/get_process_id.hpp"
#include "caf/detail/get_process_id.hpp"
#include "caf/detail/get_root_uuid.hpp"
#include "caf/detail/get_root_uuid.hpp"
...
...
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