Strict UTF-8/UTF-16 conversion and ASCII helpers for XML handlers.
More...
#include <OpenMS/FORMAT/HANDLERS/StringManager.h>
|
| static Size | strLength (const char16_t *input_ptr) |
| | Calculates the length of a char16_t* string using SIMDe.
|
| |
| static std::u16string | convert (const char *str) |
| | Transcode the supplied C string to a UTF-16 string.
|
| |
| static void | convert (const char *str, Size length, std::u16string &result) |
| | Converts the UTF-8 sequence [str, str + length) to UTF-16 into result.
|
| |
| static std::u16string | convert (const std::string &str) |
| | Transcode the supplied C++ string to a UTF-16 string.
|
| |
| static std::unique_ptr< char16_t[]> | convertPtr (const char *str) |
| | Transcode the supplied C string to a UTF-16 string pointer.
|
| |
| static std::unique_ptr< char16_t[]> | convertPtr (const std::string &str) |
| | Transcode the supplied C++ string to a UTF-16 string pointer.
|
| |
| static std::string | convert (const char16_t *str) |
| | Transcode the supplied char16_t* to a std::string.
|
| |
| static Int | parseInt (const char16_t *str) |
| | Parse an integer from a UTF-16 numeric string.
|
| |
| static bool | isASCII (const char16_t *chars, const Size length) |
| | Checks if supplied chars in char16_t* can be encoded with ASCII (i.e. the upper byte of each char is 0)
|
| |
| static void | appendASCII (const char16_t *str, const Size length, std::string &result) |
| | Transcodes the supplied char16_t* and appends it to the OpenMS String.
|
| |
|
| static void | compress64_ (const char16_t *input_it, char *output_it) |
| | Compresses eight 8x16bit Chars in char16_t* to 8x8bit Chars by cutting upper byte.
|
| |
Strict UTF-8/UTF-16 conversion and ASCII helpers for XML handlers.
Returned strings and arrays own their storage through the standard library. Invalid Unicode sequences throw Exception::ConversionError.
◆ StringManager()
◆ ~StringManager()
◆ appendASCII()
| static void appendASCII |
( |
const char16_t * |
str, |
|
|
const Size |
length, |
|
|
std::string & |
result |
|
) |
| |
|
static |
Transcodes the supplied char16_t* and appends it to the OpenMS String.
- Note
- Assumes that the char16_t* only contains ASCII characters
◆ compress64_()
| static void compress64_ |
( |
const char16_t * |
input_it, |
|
|
char * |
output_it |
|
) |
| |
|
staticprotected |
Compresses eight 8x16bit Chars in char16_t* to 8x8bit Chars by cutting upper byte.
◆ convert() [1/4]
| static std::u16string convert |
( |
const char * |
str | ) |
|
|
static |
◆ convert() [2/4]
| static void convert |
( |
const char * |
str, |
|
|
Size |
length, |
|
|
std::u16string & |
result |
|
) |
| |
|
static |
Converts the UTF-8 sequence [str, str + length) to UTF-16 into result.
result is overwritten; its capacity is reused. Throws Exception::ConversionError for invalid UTF-8.
◆ convert() [3/4]
| static std::string convert |
( |
const char16_t * |
str | ) |
|
|
static |
Transcode the supplied char16_t* to a std::string.
◆ convert() [4/4]
| static std::u16string convert |
( |
const std::string & |
str | ) |
|
|
static |
Transcode the supplied C++ string to a UTF-16 string.
◆ convertPtr() [1/2]
| static std::unique_ptr< char16_t[]> convertPtr |
( |
const char * |
str | ) |
|
|
static |
Transcode the supplied C string to a UTF-16 string pointer.
◆ convertPtr() [2/2]
| static std::unique_ptr< char16_t[]> convertPtr |
( |
const std::string & |
str | ) |
|
|
static |
Transcode the supplied C++ string to a UTF-16 string pointer.
◆ isASCII()
| static bool isASCII |
( |
const char16_t * |
chars, |
|
|
const Size |
length |
|
) |
| |
|
static |
Checks if supplied chars in char16_t* can be encoded with ASCII (i.e. the upper byte of each char is 0)
◆ parseInt()
| static Int parseInt |
( |
const char16_t * |
str | ) |
|
|
static |
◆ strLength()
| static Size strLength |
( |
const char16_t * |
input_ptr | ) |
|
|
static |
Calculates the length of a char16_t* string using SIMDe.