1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4// ---------------------------------------------------------------------------
5// FString.h (Fast String)
6//
7
8// ---------------------------------------------------------------------------
9
10// ------------------------------------------------------------------------------------------
11// FString is fast string handling namespace
12
13
14// 1) Simple
15// 2) No C++ exception
16// 3) Optimized for speed
17
18
19#ifndef _FSTRING_H_
20#define _FSTRING_H_
21
22namespace FString
23{
24 // Note: All "length" parameters do not count the space for the null terminator.
25 // Caller of Unicode_Utf8 and Utf8_Unicode must pass in a buffer of size at least length + 1.
26
27 // Scan for ASCII only string, calculate result UTF8 string length
28 HRESULT Unicode_Utf8_Length(__in_z LPCWSTR pString, __out bool * pAllAscii, __out DWORD * pLength);
29
30 // Convert UNICODE string to UTF8 string. Direct/fast conversion if ASCII
31 HRESULT Unicode_Utf8(__in_z LPCWSTR pString, bool allAscii, __out_z LPSTR pBuffer, DWORD length);
32
33 // Scan for ASCII string, calculate result UNICODE string length
34 HRESULT Utf8_Unicode_Length(__in_z LPCSTR pString, __out bool * pAllAscii, __out DWORD * pLength);
35
36 // Convert UTF8 string to UNICODE. Direct/fast conversion if ASCII
37 HRESULT Utf8_Unicode(__in_z LPCSTR pString, bool allAscii, __out_z LPWSTR pBuffer, DWORD length);
38
39 HRESULT ConvertUnicode_Utf8(__in_z LPCWSTR pString, __out_z LPSTR * pBuffer);
40
41 HRESULT ConvertUtf8_Unicode(__in_z LPCSTR pString, __out_z LPWSTR * pBuffer);
42
43} // namespace FString
44
45#endif // _FSTRING_H_
46