31#include <unordered_map>
40 inline const std::string&
55 float toFloat(
const std::string& input);
56 int toInt(
const std::string& input);
57 unsigned int toUInt(
const std::string& input);
63 std::stringstream
str;
69 Contains(
const std::string& haystack,
const std::string& needle,
bool caseInsensitive =
false);
71 std::vector<std::string>
Split(
const std::string& source,
72 const std::string& splitBy,
73 bool trimElements =
false,
74 bool removeEmptyElements =
false);
75 std::vector<std::string>
split(
const std::string& source,
76 const std::string& splitBy,
77 bool trimElements =
false,
78 bool removeEmptyElements =
false);
79 bool starts_with(
const std::string& haystack,
const std::string& needle);
80 bool ends_with(
const std::string& haystack,
const std::string& needle);
86 buffer.reserve(
data.size());
87 for (
size_t pos = 0; pos !=
data.size(); ++pos)
92 buffer.append(
"&");
95 buffer.append(
""");
98 buffer.append(
"'");
101 buffer.append(
"<");
104 buffer.append(
">");
107 buffer.append(&
data[pos], 1);
119 template <
typename T>
127 template <
typename T>
133 for (
unsigned int i = 0; i < vector.size(); ++i)
135 str <<
"\t(" << i <<
"): " << vector.at(i) <<
"\n";
141 template <
typename T>
147 for (
unsigned int i = 0; i < deque.size(); ++i)
149 str <<
"\t(" << i <<
"): " << deque.at(i) <<
"\n";
155 template <
typename T1,
typename T2>
161 str <<
"\t(" << pair.first <<
", " << pair.second <<
")\n";
165 template <
typename T1,
typename T2>
170 << map.size() <<
"):\n";
171 for (
const auto& pair : map)
173 str <<
"\t" << pair.first <<
": " << pair.second <<
"\n";
178 template <
typename T1,
typename T2>
180 operator<<(ostream&
str,
const std::unordered_map<T1, T2>& map)
184 for (
const auto& pair : map)
186 str <<
"\t" << pair.first <<
": " << pair.second <<
"\n";
198#define VAROUT(x) std::string(std::string(#x) + ": " + armarx::ValueToString(x)) + " "
199#define QUOTED(x) std::string("`" + armarx::ValueToString(x) + "`")
This file offers overloads of toIce() and fromIce() functions for STL container types.
void EncodeInline(std::string &data)
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
bool ends_with(const std::string &haystack, const std::string &needle)
unsigned int toUInt(const std::string &input)
std::string Encode(const std::string &data)
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
std::string GetTypeString(const std::type_info &tinf, bool withoutNamespaceSpecifier=false)
bool Contains(const ContainerType &container, const ElementType &searchElement)
int toInt(const std::string &input)
bool starts_with(const std::string &haystack, const std::string &needle)
const std::string & to_string(const std::string &s)
float toFloat(const std::string &input)
Converts a string to float and uses always dot as seperator.
std::string ValueToString(const T &value)
ARMARXCORE_IMPORT_EXPORT ostream & operator<<(ostream &stream, const armarx::RunningTaskIceBase &task)