| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 #else | 105 #else |
| 106 #error Define string operations appropriately for your platform | 106 #error Define string operations appropriately for your platform |
| 107 #endif | 107 #endif |
| 108 | 108 |
| 109 // Returns a reference to a globally unique empty string that functions can | 109 // Returns a reference to a globally unique empty string that functions can |
| 110 // return. Use this to avoid static construction of strings, not to replace | 110 // return. Use this to avoid static construction of strings, not to replace |
| 111 // any and all uses of "std::string()" as nicer-looking sugar. | 111 // any and all uses of "std::string()" as nicer-looking sugar. |
| 112 // These functions are threadsafe. | 112 // These functions are threadsafe. |
| 113 const std::string& EmptyString(); | 113 const std::string& EmptyString(); |
| 114 const std::wstring& EmptyWString(); | 114 const std::wstring& EmptyWString(); |
| 115 const string16& EmptyString16(); |
| 115 | 116 |
| 116 extern const wchar_t kWhitespaceWide[]; | 117 extern const wchar_t kWhitespaceWide[]; |
| 117 extern const char kWhitespaceASCII[]; | 118 extern const char kWhitespaceASCII[]; |
| 118 | 119 |
| 119 // Names of codepages (charsets) understood by icu. | 120 // Names of codepages (charsets) understood by icu. |
| 120 extern const char* const kCodepageUTF8; | 121 extern const char* const kCodepageUTF8; |
| 121 | 122 |
| 122 // Removes characters in trim_chars from the beginning and end of input. | 123 // Removes characters in trim_chars from the beginning and end of input. |
| 123 // NOTE: Safe to use the same variable for both input and output. | 124 // NOTE: Safe to use the same variable for both input and output. |
| 124 bool TrimString(const std::wstring& input, | 125 bool TrimString(const std::wstring& input, |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 // Returns a hex string representation of a binary buffer. | 591 // Returns a hex string representation of a binary buffer. |
| 591 // The returned hex string will be in upper case. | 592 // The returned hex string will be in upper case. |
| 592 // This function does not check if |size| is within reasonable limits since | 593 // This function does not check if |size| is within reasonable limits since |
| 593 // it's written with trusted data in mind. | 594 // it's written with trusted data in mind. |
| 594 // If you suspect that the data you want to format might be large, | 595 // If you suspect that the data you want to format might be large, |
| 595 // the absolute max size for |size| should be is | 596 // the absolute max size for |size| should be is |
| 596 // std::numeric_limits<size_t>::max() / 2 | 597 // std::numeric_limits<size_t>::max() / 2 |
| 597 std::string HexEncode(const void* bytes, size_t size); | 598 std::string HexEncode(const void* bytes, size_t size); |
| 598 | 599 |
| 599 #endif // BASE_STRING_UTIL_H_ | 600 #endif // BASE_STRING_UTIL_H_ |
| OLD | NEW |