tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

WindowsUnicode.h (1117B)


      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 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_glue_WindowsUnicode_h
      8 #define mozilla_glue_WindowsUnicode_h
      9 
     10 #include "mozilla/UniquePtr.h"
     11 
     12 #include <string>
     13 
     14 struct _UNICODE_STRING;
     15 
     16 namespace mozilla {
     17 namespace glue {
     18 
     19 mozilla::UniquePtr<char[]> WideToUTF8(const wchar_t* aStr,
     20                                      const size_t aStrLenExclNul);
     21 
     22 mozilla::UniquePtr<char[]> WideToUTF8(const wchar_t* aStr);
     23 mozilla::UniquePtr<char[]> WideToUTF8(const std::wstring& aStr);
     24 mozilla::UniquePtr<char[]> WideToUTF8(const _UNICODE_STRING* aStr);
     25 
     26 #if defined(bstr_t)
     27 inline mozilla::UniquePtr<char[]> WideToUTF8(const _bstr_t& aStr) {
     28  return WideToUTF8(static_cast<const wchar_t*>(aStr), aStr.length());
     29 }
     30 #endif  // defined(bstr_t)
     31 
     32 }  // namespace glue
     33 }  // namespace mozilla
     34 
     35 #endif  // mozilla_glue_WindowsUnicode_h