sys_string_conversions.h (1293B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style license that can be 5 // found in the LICENSE file. 6 7 #ifndef BASE_SYS_STRING_CONVERSIONS_H_ 8 #define BASE_SYS_STRING_CONVERSIONS_H_ 9 10 // Provides system-dependent string type conversions for cases where it's 11 // necessary to not use ICU. Generally, you should not need this in Chrome, 12 // but it is used in some shared code. Dependencies should be minimal. 13 14 #include <string> 15 #include "base/basictypes.h" 16 #include "base/string16.h" 17 18 class StringPiece; 19 20 namespace base { 21 22 // Converts between wide and UTF-8 representations of a string. On error, the 23 // result is system-dependent. 24 std::string SysWideToUTF8(const std::wstring& wide); 25 std::wstring SysUTF8ToWide(const StringPiece& utf8); 26 27 // Converts between wide and the system multi-byte representations of a string. 28 // DANGER: This will lose information and can change (on Windows, this can 29 // change between reboots). 30 std::string SysWideToNativeMB(const std::wstring& wide); 31 std::wstring SysNativeMBToWide(const StringPiece& native_mb); 32 33 } // namespace base 34 35 #endif // BASE_SYS_STRING_CONVERSIONS_H_