ipc/chromium/src/base/sys_string_conversions.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // Copyright (c) 2006-2008 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.
     5 #ifndef BASE_SYS_STRING_CONVERSIONS_H_
     6 #define BASE_SYS_STRING_CONVERSIONS_H_
     8 // Provides system-dependent string type conversions for cases where it's
     9 // necessary to not use ICU. Generally, you should not need this in Chrome,
    10 // but it is used in some shared code. Dependencies should be minimal.
    12 #include <string>
    13 #include "base/basictypes.h"
    14 #include "base/string16.h"
    16 class StringPiece;
    18 namespace base {
    20 // Converts between wide and UTF-8 representations of a string. On error, the
    21 // result is system-dependent.
    22 std::string SysWideToUTF8(const std::wstring& wide);
    23 std::wstring SysUTF8ToWide(const StringPiece& utf8);
    25 // Converts between wide and the system multi-byte representations of a string.
    26 // DANGER: This will lose information and can change (on Windows, this can
    27 // change between reboots).
    28 std::string SysWideToNativeMB(const std::wstring& wide);
    29 std::wstring SysNativeMBToWide(const StringPiece& native_mb);
    31 // Windows-specific ------------------------------------------------------------
    33 #if defined(OS_WIN)
    35 // Converts between 8-bit and wide strings, using the given code page. The
    36 // code page identifier is one accepted by the Windows function
    37 // MultiByteToWideChar().
    38 std::wstring SysMultiByteToWide(const StringPiece& mb, uint32_t code_page);
    39 std::string SysWideToMultiByte(const std::wstring& wide, uint32_t code_page);
    41 #endif  // defined(OS_WIN)
    43 }  // namespace base
    45 #endif  // BASE_SYS_STRING_CONVERSIONS_H_

mercurial