| 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 <string> | 10 #include <string> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } // namespace base | 98 } // namespace base |
| 99 | 99 |
| 100 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
| 101 #include "base/string_util_win.h" | 101 #include "base/string_util_win.h" |
| 102 #elif defined(OS_POSIX) | 102 #elif defined(OS_POSIX) |
| 103 #include "base/string_util_posix.h" | 103 #include "base/string_util_posix.h" |
| 104 #else | 104 #else |
| 105 #error Define string operations appropriately for your platform | 105 #error Define string operations appropriately for your platform |
| 106 #endif | 106 #endif |
| 107 | 107 |
| 108 // Old names for the above string functions, kept for compatibility. | |
| 109 // TODO(evanm): excise all references to these old names. | |
| 110 #define StrNCaseCmp base::strncasecmp | |
| 111 #define SWPrintF base::swprintf | |
| 112 #define VSNPrintF base::vsnprintf | |
| 113 #define SNPrintF base::snprintf | |
| 114 #define SWPrintF base::swprintf | |
| 115 | |
| 116 | |
| 117 // Returns a reference to a globally unique empty string that functions can | 108 // Returns a reference to a globally unique empty string that functions can |
| 118 // return. Use this to avoid static construction of strings, not to replace | 109 // return. Use this to avoid static construction of strings, not to replace |
| 119 // any and all uses of "std::string()" as nicer-looking sugar. | 110 // any and all uses of "std::string()" as nicer-looking sugar. |
| 120 // These functions are threadsafe. | 111 // These functions are threadsafe. |
| 121 const std::string& EmptyString(); | 112 const std::string& EmptyString(); |
| 122 const std::wstring& EmptyWString(); | 113 const std::wstring& EmptyWString(); |
| 123 | 114 |
| 124 extern const wchar_t kWhitespaceWide[]; | 115 extern const wchar_t kWhitespaceWide[]; |
| 125 extern const char kWhitespaceASCII[]; | 116 extern const char kWhitespaceASCII[]; |
| 126 | 117 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 // Returns true if the string passed in matches the pattern. The pattern | 523 // Returns true if the string passed in matches the pattern. The pattern |
| 533 // string can contain wildcards like * and ? | 524 // string can contain wildcards like * and ? |
| 534 // TODO(iyengar) This function may not work correctly for CJK strings as | 525 // TODO(iyengar) This function may not work correctly for CJK strings as |
| 535 // it does individual character matches. | 526 // it does individual character matches. |
| 536 // The backslash character (\) is an escape character for * and ? | 527 // The backslash character (\) is an escape character for * and ? |
| 537 bool MatchPattern(const std::wstring& string, const std::wstring& pattern); | 528 bool MatchPattern(const std::wstring& string, const std::wstring& pattern); |
| 538 bool MatchPattern(const std::string& string, const std::string& pattern); | 529 bool MatchPattern(const std::string& string, const std::string& pattern); |
| 539 | 530 |
| 540 #endif // BASE_STRING_UTIL_H_ | 531 #endif // BASE_STRING_UTIL_H_ |
| 541 | 532 |
| OLD | NEW |