Elliott Hughes | eb4f614 | 2011-07-15 17:43:51 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
Elliott Hughes | eb4f614 | 2011-07-15 17:43:51 -0700 | [diff] [blame] | 2 | |
| 3 | #ifndef STRINGPRINTF_H_ |
| 4 | #define STRINGPRINTF_H_ |
| 5 | |
| 6 | #include <stdarg.h> |
| 7 | #include <string> |
| 8 | |
| 9 | // Returns a string corresponding to printf-like formatting of the arguments. |
| 10 | std::string StringPrintf(const char* fmt, ...) |
Elliott Hughes | 362f9bc | 2011-10-17 18:56:41 -0700 | [diff] [blame] | 11 | __attribute__((__format__(__printf__, 1, 2))); |
Elliott Hughes | eb4f614 | 2011-07-15 17:43:51 -0700 | [diff] [blame] | 12 | |
| 13 | // Appends a printf-like formatting of the arguments to 'dst'. |
| 14 | void StringAppendF(std::string* dst, const char* fmt, ...) |
Elliott Hughes | 362f9bc | 2011-10-17 18:56:41 -0700 | [diff] [blame] | 15 | __attribute__((__format__(__printf__, 2, 3))); |
Elliott Hughes | eb4f614 | 2011-07-15 17:43:51 -0700 | [diff] [blame] | 16 | |
| 17 | // Appends a printf-like formatting of the arguments to 'dst'. |
| 18 | void StringAppendV(std::string* dst, const char* format, va_list ap); |
| 19 | |
| 20 | #endif // STRINGPRINTF_H_ |