Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
|
Peter Kasting
2010/07/28 22:49:34
Nit: 2010
| |
| 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 #ifndef BASE_UTF_STRING_CONVERSIONS_H_ | 5 #ifndef BASE_UTF_STRING_CONVERSIONS_H_ |
| 6 #define BASE_UTF_STRING_CONVERSIONS_H_ | 6 #define BASE_UTF_STRING_CONVERSIONS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 41 // porting whatever module uses wstring and the conversion is being used as a | 41 // porting whatever module uses wstring and the conversion is being used as a |
| 42 // stopcock. This makes it easy to grep for the ones that should be removed. | 42 // stopcock. This makes it easy to grep for the ones that should be removed. |
| 43 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 44 # define WideToUTF16Hack | 44 # define WideToUTF16Hack |
| 45 # define UTF16ToWideHack | 45 # define UTF16ToWideHack |
| 46 #else | 46 #else |
| 47 # define WideToUTF16Hack WideToUTF16 | 47 # define WideToUTF16Hack WideToUTF16 |
| 48 # define UTF16ToWideHack UTF16ToWide | 48 # define UTF16ToWideHack UTF16ToWide |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 // These convert an ASCII string, typically a hardcoded constant, to a | |
| 52 // UTF16/Wide string. | |
| 53 // | |
| 54 // Note that this doesn't use StringPiece because it's very common to need | |
| 55 // ASCIIToUTF16("foo"), and either we have to include it in this file, or | |
| 56 // forward declare it and force all callers to include string_piece.h. Given | |
| 57 // that string_piece brings in complicated stuff like <algorithm>, it's | |
| 58 // easier to just duplicate these very simple definitions for the two calling | |
| 59 // cases we actually use. | |
| 60 std::wstring ASCIIToWide(const char* ascii); | |
| 61 std::wstring ASCIIToWide(const std::string& ascii); | |
| 62 string16 ASCIIToUTF16(const char* ascii); | |
| 63 string16 ASCIIToUTF16(const std::string& ascii); | |
| 64 | |
| 51 #endif // BASE_UTF_STRING_CONVERSIONS_H_ | 65 #endif // BASE_UTF_STRING_CONVERSIONS_H_ |
| OLD | NEW |