| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include <ctype.h> | 9 #include <ctype.h> |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 const std::wstring& EmptyWString() { | 111 const std::wstring& EmptyWString() { |
| 112 return EmptyStrings::GetInstance()->ws; | 112 return EmptyStrings::GetInstance()->ws; |
| 113 } | 113 } |
| 114 | 114 |
| 115 const string16& EmptyString16() { | 115 const string16& EmptyString16() { |
| 116 return EmptyStrings::GetInstance()->s16; | 116 return EmptyStrings::GetInstance()->s16; |
| 117 } | 117 } |
| 118 | 118 |
| 119 #define WHITESPACE_UNICODE \ | |
| 120 0x0009, /* <control-0009> to <control-000D> */ \ | |
| 121 0x000A, \ | |
| 122 0x000B, \ | |
| 123 0x000C, \ | |
| 124 0x000D, \ | |
| 125 0x0020, /* Space */ \ | |
| 126 0x0085, /* <control-0085> */ \ | |
| 127 0x00A0, /* No-Break Space */ \ | |
| 128 0x1680, /* Ogham Space Mark */ \ | |
| 129 0x180E, /* Mongolian Vowel Separator */ \ | |
| 130 0x2000, /* En Quad to Hair Space */ \ | |
| 131 0x2001, \ | |
| 132 0x2002, \ | |
| 133 0x2003, \ | |
| 134 0x2004, \ | |
| 135 0x2005, \ | |
| 136 0x2006, \ | |
| 137 0x2007, \ | |
| 138 0x2008, \ | |
| 139 0x2009, \ | |
| 140 0x200A, \ | |
| 141 0x200C, /* Zero Width Non-Joiner */ \ | |
| 142 0x2028, /* Line Separator */ \ | |
| 143 0x2029, /* Paragraph Separator */ \ | |
| 144 0x202F, /* Narrow No-Break Space */ \ | |
| 145 0x205F, /* Medium Mathematical Space */ \ | |
| 146 0x3000, /* Ideographic Space */ \ | |
| 147 0 | |
| 148 | |
| 149 const wchar_t kWhitespaceWide[] = { | |
| 150 WHITESPACE_UNICODE | |
| 151 }; | |
| 152 const char16 kWhitespaceUTF16[] = { | |
| 153 WHITESPACE_UNICODE | |
| 154 }; | |
| 155 const char kWhitespaceASCII[] = { | |
| 156 0x09, // <control-0009> to <control-000D> | |
| 157 0x0A, | |
| 158 0x0B, | |
| 159 0x0C, | |
| 160 0x0D, | |
| 161 0x20, // Space | |
| 162 0 | |
| 163 }; | |
| 164 | |
| 165 const char kUtf8ByteOrderMark[] = "\xEF\xBB\xBF"; | |
| 166 | |
| 167 template<typename STR> | 119 template<typename STR> |
| 168 bool ReplaceCharsT(const STR& input, | 120 bool ReplaceCharsT(const STR& input, |
| 169 const typename STR::value_type replace_chars[], | 121 const typename STR::value_type replace_chars[], |
| 170 const STR& replace_with, | 122 const STR& replace_with, |
| 171 STR* output) { | 123 STR* output) { |
| 172 bool removed = false; | 124 bool removed = false; |
| 173 size_t replace_length = replace_with.length(); | 125 size_t replace_length = replace_with.length(); |
| 174 | 126 |
| 175 *output = input; | 127 *output = input; |
| 176 | 128 |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 } | 1003 } |
| 1052 | 1004 |
| 1053 } // namespace | 1005 } // namespace |
| 1054 | 1006 |
| 1055 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { | 1007 size_t base::strlcpy(char* dst, const char* src, size_t dst_size) { |
| 1056 return lcpyT<char>(dst, src, dst_size); | 1008 return lcpyT<char>(dst, src, dst_size); |
| 1057 } | 1009 } |
| 1058 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { | 1010 size_t base::wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size) { |
| 1059 return lcpyT<wchar_t>(dst, src, dst_size); | 1011 return lcpyT<wchar_t>(dst, src, dst_size); |
| 1060 } | 1012 } |
| OLD | NEW |