1 | // Copyright 2002 and onwards Google Inc. |
2 | // |
3 | // Printf variants that place their output in a C++ string. |
4 | // |
5 | // Usage: |
6 | // string result = StringPrintf("%d %s\n", 10, "hello"); |
7 | // SStringPrintf(&result, "%d %s\n", 10, "hello"); |
8 | // StringAppendF(&result, "%d %s\n", 20, "there"); |
9 | |
10 | #ifndef _STRINGS_STRINGPRINTF_H |
11 | #define _STRINGS_STRINGPRINTF_H |
12 | |
13 | #include <stdarg.h> |
14 | #include <string> |
15 | using std::string; |
16 | |
17 | #include <vector> |
18 | using std::vector; |
19 | |
20 | #include "base/stl_decl.h" |
21 | #include "base/port.h" |
22 | #include "base/stringprintf.h" |
23 | |
24 | // This file formerly contained |
25 | // StringPrintf, SStringPrintf, StringAppendF, and StringAppendV. |
26 | // These routines have moved to base/stringprintf.{h,cc} to allow |
27 | // using them from files in base. We include base/stringprintf.h |
28 | // in this file since so many clients were dependent on these |
29 | // routines being defined in stringprintf.h. |
30 | |
31 | |
32 | // The max arguments supported by StringPrintfVector |
33 | extern const int kStringPrintfVectorMaxArgs; |
34 | |
35 | // You can use this version when all your arguments are strings, but |
36 | // you don't know how many arguments you'll have at compile time. |
37 | // StringPrintfVector will LOG(FATAL) if v.size() > kStringPrintfVectorMaxArgs |
38 | extern string StringPrintfVector(const char* format, const vector<string>& v); |
39 | |
40 | #endif /* _STRINGS_STRINGPRINTF_H */ |
41 | |