Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _LOG4CPP_STRINGUTIL_HH
00010 #define _LOG4CPP_STRINGUTIL_HH
00011
00012 #include "PortabilityImpl.hh"
00013 #include <string>
00014 #include <vector>
00015 #include <climits>
00016 #include <stdarg.h>
00017
00018 namespace log4cpp {
00019
00020 class StringUtil {
00021 public:
00022
00029 static std::string vform(const char* format, va_list args);
00030
00035 static std::string trim(const std::string& s);
00036
00050 static unsigned int split(std::vector<std::string>& v,
00051 const std::string& s, char delimiter,
00052 unsigned int maxSegments = INT_MAX);
00063 template<typename T> static unsigned int split(T& output,
00064 const std::string& s, char delimiter,
00065 unsigned int maxSegments = INT_MAX) {
00066 std::string::size_type left = 0;
00067 unsigned int i;
00068 for(i = 1; i < maxSegments; i++) {
00069 std::string::size_type right = s.find(delimiter, left);
00070 if (right == std::string::npos) {
00071 break;
00072 }
00073 *output++ = s.substr(left, right - left);
00074 left = right + 1;
00075 }
00076
00077 *output++ = s.substr(left);
00078 return i;
00079 }
00080 };
00081 }
00082
00083 #endif // _LOG4CPP_STRINGUTIL_HH
00084
log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sat Jun 8 2019 18:45:46