89#ifndef WPIUTIL_WPI_CONVERTUTF_H
90#define WPIUTIL_WPI_CONVERTUTF_H
97#include <system_error>
118#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
119#define UNI_MAX_BMP (UTF32)0x0000FFFF
120#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
121#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
122#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
124#define UNI_MAX_UTF8_BYTES_PER_CODE_POINT 4
126#define UNI_UTF16_BYTE_ORDER_MARK_NATIVE 0xFEFF
127#define UNI_UTF16_BYTE_ORDER_MARK_SWAPPED 0xFFFE
142 const UTF8** sourceStart,
const UTF8* sourceEnd,
150 const UTF8** sourceStart,
const UTF8* sourceEnd,
158 const UTF8** sourceStart,
const UTF8* sourceEnd,
162 const UTF16** sourceStart,
const UTF16* sourceEnd,
166 const UTF32** sourceStart,
const UTF32* sourceEnd,
170 const UTF16** sourceStart,
const UTF16* sourceEnd,
174 const UTF32** sourceStart,
const UTF32* sourceEnd,
198 char *&ResultPtr,
const UTF8 *&ErrorPtr);
247 const UTF8 *sourceEnd,
296std::error_code UTF16ToUTF8(
const wchar_t *utf16,
size_t utf16_len,
299std::error_code UTF16ToCurCP(
const wchar_t *utf16,
size_t utf16_len,
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation source
Definition: ThirdPartyNotices.txt:114
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:557
basic_string_view< char > string_view
Definition: core.h:520
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
/file This file defines the SmallVector class.
Definition: AprilTagFieldLayout.h:18
bool convertUTF8ToUTF16String(std::string_view SrcUTF8, SmallVectorImpl< UTF16 > &DstUTF16)
Converts a UTF-8 string into a UTF-16 string with native endianness.
bool ConvertCodePointToUTF8(unsigned Source, char *&ResultPtr)
Convert an Unicode code point to UTF8 sequence.
Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd)
ConversionResult ConvertUTF32toUTF16(const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags)
bool hasUTF16ByteOrderMark(std::span< const char > SrcBytes)
Returns true if a blob of text starts with a UTF-16 big or little endian byte order mark.
ConversionResult convertUTF8Sequence(const UTF8 **source, const UTF8 *sourceEnd, UTF32 *target, ConversionFlags flags)
Convert the first UTF8 sequence in the given source buffer to a UTF32 code point.
Definition: ConvertUTF.h:246
unsigned char UTF8
Definition: ConvertUTF.h:114
unsigned short UTF16
Definition: ConvertUTF.h:113
ConversionResult ConvertUTF8toUTF16(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags)
bool convertWideToUTF8(const std::wstring &Source, SmallVectorImpl< char > &Result)
Converts a std::wstring to a UTF-8 encoded std::string.
bool ConvertUTF8toWide(unsigned WideCharWidth, std::string_view Source, char *&ResultPtr, const UTF8 *&ErrorPtr)
Convert an UTF8 string_view to UTF8, UTF16, or UTF32 depending on WideCharWidth.
unsigned getNumBytesForUTF8(UTF8 firstByte)
flags
Definition: http_parser.h:206
ConversionResult ConvertUTF32toUTF8(const UTF32 **sourceStart, const UTF32 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)
ConversionResult ConvertUTF16toUTF32(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)
ConversionResult ConvertUTF8toUTF32Partial(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)
Convert a partial UTF8 sequence to UTF32.
ConversionFlags
Definition: ConvertUTF.h:136
@ lenientConversion
Definition: ConvertUTF.h:138
@ strictConversion
Definition: ConvertUTF.h:137
unsigned int UTF32
Definition: ConvertUTF.h:112
ConversionResult ConvertUTF8toUTF32(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags)
Convert a partial UTF8 sequence to UTF32.
ConversionResult ConvertUTF16toUTF8(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags)
ConversionResult
Definition: ConvertUTF.h:129
@ sourceIllegal
Definition: ConvertUTF.h:133
@ sourceExhausted
Definition: ConvertUTF.h:131
@ conversionOK
Definition: ConvertUTF.h:130
@ targetExhausted
Definition: ConvertUTF.h:132
bool Boolean
Definition: ConvertUTF.h:115
Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd)
bool convertUTF16ToUTF8String(std::span< const char > SrcBytes, SmallVectorImpl< char > &Out)
Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.