13 #define VSNPRINTF _vsnprintf 15 #ifdef LOG4CPP_HAVE_SNPRINTF 16 #define VSNPRINTF vsnprintf 21 #define PREFER_PORTABLE_SNPRINTF 30 #define VSNPRINTF portable_vsnprintf 32 #endif // LOG4CPP_HAVE_SNPRINTF 39 char* buffer =
new char[size];
44 #if defined(_MSC_VER) || defined(__BORLANDC__) 47 va_copy(args_copy, args);
50 int n =
VSNPRINTF(buffer, size, format, args_copy);
55 if ((n > -1) && (static_cast<size_t>(n) < size)) {
56 std::string s(buffer);
67 buffer =
new char[size];
72 static const char* whiteSpace =
" \t\r\n";
79 std::string::size_type b = s.find_first_not_of(whiteSpace);
80 if(b == std::string::npos)
84 std::string::size_type e = s.find_last_not_of(whiteSpace);
87 return std::string(s, b, e - b + 1);
92 char delimiter,
unsigned int maxSegments) {
94 std::back_insert_iterator<std::vector<std::string> > it(v);
95 return split(it, s, delimiter, maxSegments);
static std::string vform(const char *format, va_list args)
static std::string trim(const std::string &s)
static unsigned int split(std::vector< std::string > &v, const std::string &s, char delimiter, unsigned int maxSegments=INT_MAX)