void Encode12str(std::string & dst, const std::string & src);
void Decode21str(std::string & dst, const std::string & src);
-std::string Encode12str(const std::string & src);
-std::string Decode21str(const std::string & src);
+inline std::string Encode12str(const std::string & src) { std::string dst; Encode12str(dst, src); return dst; }
+inline std::string Decode21str(const std::string & src) { std::string dst; Decode21str(dst, src); return dst; }
int ParseIPString(const char * str, uint32_t * ips, int maxIP);
void KOIToWin(const char * s1, char * s2, int l);
std::string & Trim(std::string & val);
std::string Trim(const std::string & val);
-std::string ToLower(const std::string & value);
-std::string ToUpper(const std::string & value);
+std::string ToLower(std::string value);
+std::string ToUpper(std::string value);
template <typename C, typename F>
+inline
C Split(const std::string & value, char delim, F conv)
{
C res;
{
res.push_back(conv(value.substr(startPos, pos - startPos)));
startPos = pos + 1;
- pos = value.find_first_of(delim, pos);
+ pos = value.find_first_of(delim, pos + 1);
}
res.push_back(conv(value.substr(startPos, pos - startPos)));
return res;
}
template <typename T>
+inline
T FromString(const std::string & value)
{
T res;
return res;
}
+template <>
+inline
+std::string FromString<std::string>(const std::string & value)
+{
+return value;
+}
+
template <typename C>
+inline
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);
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);