OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // |printf()|-like formatting functions that output/append to C++ strings. |
| 6 // |
| 7 // TODO(vtl): We don't have the |PRINTF_FORMAT()| macros/warnings like |
| 8 // Chromium's version -- should we? (I've rarely seen them being useful.) |
| 9 |
| 10 #ifndef MOJO_EDK_UTIL_STRING_PRINTF_H_ |
| 11 #define MOJO_EDK_UTIL_STRING_PRINTF_H_ |
| 12 |
| 13 #include <stdarg.h> |
| 14 |
| 15 #include <string> |
| 16 |
| 17 #include "mojo/public/c/system/macros.h" |
| 18 |
| 19 namespace mojo { |
| 20 namespace util { |
| 21 |
| 22 // Formats |printf()|-like input and returns it as an |std::string|. |
| 23 std::string StringPrintf(const char* format, ...) MOJO_WARN_UNUSED_RESULT; |
| 24 |
| 25 // Formats |vprintf()|-like input and returns it as an |std::string|. |
| 26 std::string StringVPrintf(const char* format, |
| 27 va_list ap) MOJO_WARN_UNUSED_RESULT; |
| 28 |
| 29 // Formats |printf()|-like input and appends it to |*dest|. |
| 30 void StringAppendf(std::string* dest, const char* format, ...); |
| 31 |
| 32 // Formats |vprintf()|-like input and appends it to |*dest|. |
| 33 void StringVAppendf(std::string* dest, const char* format, va_list ap); |
| 34 |
| 35 } // namespace util |
| 36 } // namespace mojo |
| 37 |
| 38 #endif // MOJO_EDK_UTIL_STRING_PRINTF_H_ |
OLD | NEW |