OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/sync/util/character_set_converters.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 using std::string; |
| 10 |
| 11 namespace browser_sync { |
| 12 |
| 13 void PathStringToUTF8(const PathChar* wide, int size, |
| 14 std::string* output_string) { |
| 15 CHECK(output_string); |
| 16 output_string->clear(); |
| 17 AppendPathStringToUTF8(wide, size, output_string); |
| 18 } |
| 19 |
| 20 bool UTF8ToPathString(const char* utf8, size_t size, |
| 21 PathString* output_string) { |
| 22 CHECK(output_string); |
| 23 output_string->clear(); |
| 24 return AppendUTF8ToPathString(utf8, size, output_string); |
| 25 }; |
| 26 |
| 27 ToUTF8::ToUTF8(const PathChar* wide, size_t size) { |
| 28 PathStringToUTF8(wide, size, &result_); |
| 29 } |
| 30 |
| 31 ToUTF8::ToUTF8(const PathString& wide) { |
| 32 PathStringToUTF8(wide.data(), wide.length(), &result_); |
| 33 } |
| 34 |
| 35 ToUTF8::ToUTF8(const PathChar* wide) { |
| 36 PathStringToUTF8(wide, PathLen(wide), &result_); |
| 37 } |
| 38 |
| 39 ToPathString::ToPathString(const char* utf8, size_t size) { |
| 40 good_ = UTF8ToPathString(utf8, size, &result_); |
| 41 good_checked_ = false; |
| 42 } |
| 43 |
| 44 ToPathString::ToPathString(const std::string& utf8) { |
| 45 good_ = UTF8ToPathString(utf8.data(), utf8.length(), &result_); |
| 46 good_checked_ = false; |
| 47 } |
| 48 |
| 49 ToPathString::ToPathString(const char* utf8) { |
| 50 good_ = UTF8ToPathString(utf8, strlen(utf8), &result_); |
| 51 good_checked_ = false; |
| 52 } |
| 53 |
| 54 } // namespace browser_sync |
OLD | NEW |