OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file defines utility functions for working with strings. | 5 // This file defines utility functions for working with strings. |
6 | 6 |
7 #ifndef BASE_STRING_UTIL_H_ | 7 #ifndef BASE_STRING_UTIL_H_ |
8 #define BASE_STRING_UTIL_H_ | 8 #define BASE_STRING_UTIL_H_ |
9 | 9 |
10 #include <stdarg.h> // va_list | 10 #include <stdarg.h> // va_list |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 int64 StringToInt64(const string16& value); | 446 int64 StringToInt64(const string16& value); |
447 int HexStringToInt(const std::string& value); | 447 int HexStringToInt(const std::string& value); |
448 int HexStringToInt(const string16& value); | 448 int HexStringToInt(const string16& value); |
449 double StringToDouble(const std::string& value); | 449 double StringToDouble(const std::string& value); |
450 double StringToDouble(const string16& value); | 450 double StringToDouble(const string16& value); |
451 | 451 |
452 // Return a C++ string given printf-like input. | 452 // Return a C++ string given printf-like input. |
453 std::string StringPrintf(const char* format, ...) PRINTF_FORMAT(1, 2); | 453 std::string StringPrintf(const char* format, ...) PRINTF_FORMAT(1, 2); |
454 std::wstring StringPrintf(const wchar_t* format, ...) WPRINTF_FORMAT(1, 2); | 454 std::wstring StringPrintf(const wchar_t* format, ...) WPRINTF_FORMAT(1, 2); |
455 | 455 |
| 456 // Return a C++ string given vprintf-like input. |
| 457 std::string StringPrintV(const char* format, va_list ap) PRINTF_FORMAT(1, 0); |
| 458 |
456 // Store result into a supplied string and return it | 459 // Store result into a supplied string and return it |
457 const std::string& SStringPrintf(std::string* dst, const char* format, ...) | 460 const std::string& SStringPrintf(std::string* dst, const char* format, ...) |
458 PRINTF_FORMAT(2, 3); | 461 PRINTF_FORMAT(2, 3); |
459 const std::wstring& SStringPrintf(std::wstring* dst, | 462 const std::wstring& SStringPrintf(std::wstring* dst, |
460 const wchar_t* format, ...) | 463 const wchar_t* format, ...) |
461 WPRINTF_FORMAT(2, 3); | 464 WPRINTF_FORMAT(2, 3); |
462 | 465 |
463 // Append result to a supplied string | 466 // Append result to a supplied string |
464 void StringAppendF(std::string* dst, const char* format, ...) | 467 void StringAppendF(std::string* dst, const char* format, ...) |
465 PRINTF_FORMAT(2, 3); | 468 PRINTF_FORMAT(2, 3); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 #elif defined(WCHAR_T_IS_UTF32) | 630 #elif defined(WCHAR_T_IS_UTF32) |
628 typedef uint32 Unsigned; | 631 typedef uint32 Unsigned; |
629 #endif | 632 #endif |
630 }; | 633 }; |
631 template<> | 634 template<> |
632 struct ToUnsigned<short> { | 635 struct ToUnsigned<short> { |
633 typedef unsigned short Unsigned; | 636 typedef unsigned short Unsigned; |
634 }; | 637 }; |
635 | 638 |
636 #endif // BASE_STRING_UTIL_H_ | 639 #endif // BASE_STRING_UTIL_H_ |
OLD | NEW |