OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/strings/utf_offset_string_conversions.h" | 5 #include "base/strings/utf_offset_string_conversions.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 #include "base/strings/utf_string_conversion_utils.h" | 11 #include "base/strings/utf_string_conversion_utils.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 | 14 |
15 // Converts the given source Unicode character type to the given destination | 15 // Converts the given source Unicode character type to the given destination |
16 // Unicode character type as a STL string. The given input buffer and size | 16 // Unicode character type as a STL string. The given input buffer and size |
17 // determine the source, and the given output STL string will be replaced by | 17 // determine the source, and the given output STL string will be replaced by |
18 // the result. | 18 // the result. |
19 template<typename SrcChar, typename DestStdString> | 19 template<typename SrcChar, typename DestStdString> |
20 bool ConvertUnicode(const SrcChar* src, | 20 bool ConvertUnicode(const SrcChar* src, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (*offset < (i->original_offset + i->original_length)) { | 157 if (*offset < (i->original_offset + i->original_length)) { |
158 *offset = string16::npos; | 158 *offset = string16::npos; |
159 return; | 159 return; |
160 } | 160 } |
161 adjustment += (i->original_length - i->output_length); | 161 adjustment += (i->original_length - i->output_length); |
162 } | 162 } |
163 *offset -= adjustment; | 163 *offset -= adjustment; |
164 } | 164 } |
165 | 165 |
166 } // namespace base | 166 } // namespace base |
OLD | NEW |