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/. */
7 #ifndef mozilla_glue_WindowsUnicode_h
8 #define mozilla_glue_WindowsUnicode_h
10 #include "mozilla/UniquePtr.h"
14 struct _UNICODE_STRING
;
19 mozilla::UniquePtr
<char[]> WideToUTF8(const wchar_t* aStr
,
20 const size_t aStrLenExclNul
);
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
);
27 inline mozilla::UniquePtr
<char[]> WideToUTF8(const _bstr_t
& aStr
) {
28 return WideToUTF8(static_cast<const wchar_t*>(aStr
), aStr
.length());
30 #endif // defined(bstr_t)
33 } // namespace mozilla
35 #endif // mozilla_glue_WindowsUnicode_h