Add partial pre-read functionality to browser startup (Windows).
[chromium-blink-merge.git] / base / stringprintf.h
blob40ad107aead14fd3af62aeafb63f6aae21ac861a
1 // Copyright (c) 2011 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.
5 #ifndef BASE_STRINGPRINTF_H_
6 #define BASE_STRINGPRINTF_H_
8 #include <stdarg.h> // va_list
10 #include <string>
12 #include "base/base_export.h"
13 #include "base/compiler_specific.h"
15 namespace base {
17 // Return a C++ string given printf-like input.
18 BASE_EXPORT std::string StringPrintf(const char* format, ...)
19 PRINTF_FORMAT(1, 2);
20 BASE_EXPORT std::wstring StringPrintf(const wchar_t* format, ...)
21 WPRINTF_FORMAT(1, 2);
23 // Return a C++ string given vprintf-like input.
24 BASE_EXPORT std::string StringPrintV(const char* format, va_list ap)
25 PRINTF_FORMAT(1, 0);
27 // Store result into a supplied string and return it.
28 BASE_EXPORT const std::string& SStringPrintf(std::string* dst,
29 const char* format, ...)
30 PRINTF_FORMAT(2, 3);
31 BASE_EXPORT const std::wstring& SStringPrintf(std::wstring* dst,
32 const wchar_t* format, ...)
33 WPRINTF_FORMAT(2, 3);
35 // Append result to a supplied string.
36 BASE_EXPORT void StringAppendF(std::string* dst, const char* format, ...)
37 PRINTF_FORMAT(2, 3);
38 // TODO(evanm): this is only used in a few places in the code;
39 // replace with string16 version.
40 BASE_EXPORT void StringAppendF(std::wstring* dst, const wchar_t* format, ...)
41 WPRINTF_FORMAT(2, 3);
43 // Lower-level routine that takes a va_list and appends to a specified
44 // string. All other routines are just convenience wrappers around it.
45 BASE_EXPORT void StringAppendV(std::string* dst, const char* format, va_list ap)
46 PRINTF_FORMAT(2, 0);
47 BASE_EXPORT void StringAppendV(std::wstring* dst,
48 const wchar_t* format, va_list ap)
49 WPRINTF_FORMAT(2, 0);
51 } // namespace base
53 // Don't require the namespace for legacy code. New code should use "base::" or
54 // have its own using decl.
56 // TODO(brettw) remove these when calling code is converted.
57 using base::StringPrintf;
59 #endif // BASE_STRINGPRINTF_H_