Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: base/sys_string_conversions.h

Issue 6729002: Base: A few more files using BASE_API (for base.dll) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/string_split.h ('k') | base/task.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 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 #ifndef BASE_SYS_STRING_CONVERSIONS_H_ 5 #ifndef BASE_SYS_STRING_CONVERSIONS_H_
6 #define BASE_SYS_STRING_CONVERSIONS_H_ 6 #define BASE_SYS_STRING_CONVERSIONS_H_
7 #pragma once 7 #pragma once
8 8
9 // Provides system-dependent string type conversions for cases where it's 9 // Provides system-dependent string type conversions for cases where it's
10 // necessary to not use ICU. Generally, you should not need this in Chrome, 10 // necessary to not use ICU. Generally, you should not need this in Chrome,
11 // but it is used in some shared code. Dependencies should be minimal. 11 // but it is used in some shared code. Dependencies should be minimal.
12 12
13 #include <string> 13 #include <string>
14
15 #include "base/base_api.h"
14 #include "base/basictypes.h" 16 #include "base/basictypes.h"
15 #include "base/string16.h" 17 #include "base/string16.h"
16 18
17 #if defined(OS_MACOSX) 19 #if defined(OS_MACOSX)
18 #include <CoreFoundation/CoreFoundation.h> 20 #include <CoreFoundation/CoreFoundation.h>
19 #ifdef __OBJC__ 21 #ifdef __OBJC__
20 @class NSString; 22 @class NSString;
21 #else 23 #else
22 class NSString; 24 class NSString;
23 #endif 25 #endif
24 #endif // OS_MACOSX 26 #endif // OS_MACOSX
25 27
26 namespace base { 28 namespace base {
27 29
28 class StringPiece; 30 class StringPiece;
29 31
30 // Converts between wide and UTF-8 representations of a string. On error, the 32 // Converts between wide and UTF-8 representations of a string. On error, the
31 // result is system-dependent. 33 // result is system-dependent.
32 std::string SysWideToUTF8(const std::wstring& wide); 34 BASE_API std::string SysWideToUTF8(const std::wstring& wide);
33 std::wstring SysUTF8ToWide(const StringPiece& utf8); 35 BASE_API std::wstring SysUTF8ToWide(const StringPiece& utf8);
34 36
35 // Converts between wide and the system multi-byte representations of a string. 37 // Converts between wide and the system multi-byte representations of a string.
36 // DANGER: This will lose information and can change (on Windows, this can 38 // DANGER: This will lose information and can change (on Windows, this can
37 // change between reboots). 39 // change between reboots).
38 std::string SysWideToNativeMB(const std::wstring& wide); 40 BASE_API std::string SysWideToNativeMB(const std::wstring& wide);
39 std::wstring SysNativeMBToWide(const StringPiece& native_mb); 41 BASE_API std::wstring SysNativeMBToWide(const StringPiece& native_mb);
40 42
41 // Windows-specific ------------------------------------------------------------ 43 // Windows-specific ------------------------------------------------------------
42 44
43 #if defined(OS_WIN) 45 #if defined(OS_WIN)
44 46
45 // Converts between 8-bit and wide strings, using the given code page. The 47 // Converts between 8-bit and wide strings, using the given code page. The
46 // code page identifier is one accepted by the Windows function 48 // code page identifier is one accepted by the Windows function
47 // MultiByteToWideChar(). 49 // MultiByteToWideChar().
48 std::wstring SysMultiByteToWide(const StringPiece& mb, uint32 code_page); 50 BASE_API std::wstring SysMultiByteToWide(const StringPiece& mb,
49 std::string SysWideToMultiByte(const std::wstring& wide, uint32 code_page); 51 uint32 code_page);
52 BASE_API std::string SysWideToMultiByte(const std::wstring& wide,
53 uint32 code_page);
50 54
51 #endif // defined(OS_WIN) 55 #endif // defined(OS_WIN)
52 56
53 // Mac-specific ---------------------------------------------------------------- 57 // Mac-specific ----------------------------------------------------------------
54 58
55 #if defined(OS_MACOSX) 59 #if defined(OS_MACOSX)
56 60
57 // Converts between STL strings and CFStringRefs/NSStrings. 61 // Converts between STL strings and CFStringRefs/NSStrings.
58 62
59 // Creates a string, and returns it with a refcount of 1. You are responsible 63 // Creates a string, and returns it with a refcount of 1. You are responsible
(...skipping 16 matching lines...) Expand all
76 // string type of length 0. 80 // string type of length 0.
77 std::string SysNSStringToUTF8(NSString* ref); 81 std::string SysNSStringToUTF8(NSString* ref);
78 string16 SysNSStringToUTF16(NSString* ref); 82 string16 SysNSStringToUTF16(NSString* ref);
79 std::wstring SysNSStringToWide(NSString* ref); 83 std::wstring SysNSStringToWide(NSString* ref);
80 84
81 #endif // defined(OS_MACOSX) 85 #endif // defined(OS_MACOSX)
82 86
83 } // namespace base 87 } // namespace base
84 88
85 #endif // BASE_SYS_STRING_CONVERSIONS_H_ 89 #endif // BASE_SYS_STRING_CONVERSIONS_H_
OLDNEW
« no previous file with comments | « base/string_split.h ('k') | base/task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698