Remove DnsConfigServiceTest.GetSystemConfig test
[chromium-blink-merge.git] / base / strings / stringprintf.h
blob523f7ee55bf3693895b2d2d43d73f1c50565cb12
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.
5 #ifndef BASE_STRINGS_STRINGPRINTF_H_
6 #define BASE_STRINGS_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) WARN_UNUSED_RESULT;
20 #if defined(OS_WIN)
21 BASE_EXPORT std::wstring StringPrintf(const wchar_t* format, ...)
22 WPRINTF_FORMAT(1, 2) WARN_UNUSED_RESULT;
23 #endif
25 // Return a C++ string given vprintf-like input.
26 BASE_EXPORT std::string StringPrintV(const char* format, va_list ap)
27 PRINTF_FORMAT(1, 0) WARN_UNUSED_RESULT;
29 // Store result into a supplied string and return it.
30 BASE_EXPORT const std::string& SStringPrintf(std::string* dst,
31 const char* format, ...)
32 PRINTF_FORMAT(2, 3);
33 #if defined(OS_WIN)
34 BASE_EXPORT const std::wstring& SStringPrintf(std::wstring* dst,
35 const wchar_t* format, ...)
36 WPRINTF_FORMAT(2, 3);
37 #endif
39 // Append result to a supplied string.
40 BASE_EXPORT void StringAppendF(std::string* dst, const char* format, ...)
41 PRINTF_FORMAT(2, 3);
42 #if defined(OS_WIN)
43 BASE_EXPORT void StringAppendF(std::wstring* dst, const wchar_t* format, ...)
44 WPRINTF_FORMAT(2, 3);
45 #endif
47 // Lower-level routine that takes a va_list and appends to a specified
48 // string. All other routines are just convenience wrappers around it.
49 BASE_EXPORT void StringAppendV(std::string* dst, const char* format, va_list ap)
50 PRINTF_FORMAT(2, 0);
51 #if defined(OS_WIN)
52 BASE_EXPORT void StringAppendV(std::wstring* dst,
53 const wchar_t* format, va_list ap)
54 WPRINTF_FORMAT(2, 0);
55 #endif
57 } // namespace base
59 #endif // BASE_STRINGS_STRINGPRINTF_H_