27#ifndef _STRING_TOOLS_H_
28#define _STRING_TOOLS_H_
33#include <boost/utility/string_ref.hpp>
34#include <boost/algorithm/string.hpp>
43#ifdef WINDOWS_PLATFORM
44#pragma comment (lib, "Rpcrt4.lib")
71 std::string get_current_module_path();
75 inline std::string&
trim(std::string&
str)
81 inline std::string
trim(
const std::string&
str)
83 return boost::trim_copy(
str);
85 std::string
pad_string(std::string
s,
size_t n,
char c =
' ',
bool prepend =
false);
88 template<
class t_pod_type>
91 static_assert(std::is_standard_layout<t_pod_type>(),
"expected standard layout type");
92 static_assert(
alignof(t_pod_type) == 1,
"type may have padding");
96 template<
class t_pod_type>
97 bool hex_to_pod(
const boost::string_ref hex_str, t_pod_type&
s)
99 static_assert(std::is_standard_layout<t_pod_type>(),
"expected standard layout type");
100 static_assert(
alignof(t_pod_type) == 1,
"type may have padding");
101 static_assert(std::is_trivially_copyable<t_pod_type>(),
"type must be trivially copyable");
105 template<
class t_pod_type>
106 bool hex_to_pod(
const boost::string_ref hex_str, tools::scrubbed<t_pod_type>&
s)
111 template<
class t_pod_type>
120 static_assert(std::is_arithmetic<T>::value,
"only arithmetic types");
121 std::stringstream ss;
122 ss << std::hex << val;
133 std::wstring utf8_to_utf16(
const std::string&
str);
134 std::string utf16_to_utf8(
const std::wstring& wstr);
#define s(x, c)
Definition aesb.c:47
const char * res
Definition hmac_keccak.cpp:42
TODO: (mj-xmr) This will be reduced in an another PR.
Definition byte_slice.h:40
span< std::uint8_t > as_mut_byte_span(T &src) noexcept
Definition span.h:172
span< const std::uint8_t > to_byte_span(const span< const T > src) noexcept
Definition span.h:138
T & unwrap(mlocked< T > &src)
Definition mlocker.h:81
constexpr span< const typename T::value_type > to_span(const T &src)
Definition span.h:122
span< const std::uint8_t > as_byte_span(const T &src) noexcept
Definition span.h:161
const char *const str
Definition portlistingparse.c:23
unsigned short uint16_t
Definition stdint.h:125
signed __int64 int64_t
Definition stdint.h:135
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136
static bool to_string(std::string &out, boost::string_ref src)
Definition hex.cpp:90
static bool to_buffer(span< std::uint8_t > out, boost::string_ref src) noexcept
Definition hex.cpp:96
static std::string string(const span< const std::uint8_t > src)
Definition hex.cpp:69
const char * str1
Definition testupnpdescgen.c:131
const char * str2
Definition testupnpdescgen.c:132