git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed services test.
[stg.git]
/
stglibs
/
common.lib
/
include
/
stg
/
common.h
diff --git
a/stglibs/common.lib/include/stg/common.h
b/stglibs/common.lib/include/stg/common.h
index eeb68b5197832c13197e40298e72ba1244336c9c..ec05adb124e2d3018a3ac4bcb964da44cabd54e0 100644
(file)
--- a/
stglibs/common.lib/include/stg/common.h
+++ b/
stglibs/common.lib/include/stg/common.h
@@
-103,6
+103,7
@@
std::string ToLower(const std::string & value);
std::string ToUpper(const std::string & value);
template <typename C, typename F>
std::string ToUpper(const std::string & value);
template <typename C, typename F>
+inline
C Split(const std::string & value, char delim, F conv)
{
C res;
C Split(const std::string & value, char delim, F conv)
{
C res;
@@
-119,6
+120,7
@@
return res;
}
template <typename T>
}
template <typename T>
+inline
T FromString(const std::string & value)
{
T res;
T FromString(const std::string & value)
{
T res;
@@
-127,10
+129,18
@@
stream >> res;
return res;
}
return res;
}
+template <>
+inline
+std::string FromString<std::string>(const std::string & value)
+{
+return value;
+}
+
template <typename C>
template <typename C>
+inline
C Split(const std::string & value, char delim)
{
C Split(const std::string & value, char delim)
{
- return Split<C>(value, delim, FromString);
+ return Split<C>(value, delim, FromString
<typename C::value_type>
);
}
std::string IconvString(const std::string & source, const std::string & from, const std::string & to);
}
std::string IconvString(const std::string & source, const std::string & from, const std::string & to);
@@
-144,6
+154,11
@@
int ParseYesNo(const std::string & str, bool * val);
bool WaitPackets(int sd);
bool WaitPackets(int sd);
+bool ReadAll(int sd, void * dest, size_t size);
+bool WriteAll(int sd, const void * source, size_t size);
+
+std::string ToPrintable(const std::string & src);
+
//-----------------------------------------------------------------------------
int str2x(const std::string & str, int32_t & x);
int str2x(const std::string & str, uint32_t & x);
//-----------------------------------------------------------------------------
int str2x(const std::string & str, int32_t & x);
int str2x(const std::string & str, uint32_t & x);