![]() |
OpenMS
|
Helper class for XML parsing that handles the conversions of Xerces strings. More...
#include <OpenMS/FORMAT/HANDLERS/StringManager.h>
Public Member Functions | |
| StringManager () | |
| Constructor. | |
| ~StringManager () | |
| Destructor. | |
Static Public Member Functions | |
| static Size | strLength (const char16_t *input_ptr) |
| Calculates the length of a char16_t* string using SIMDe. | |
| static XercesString | convert (const char *str) |
| Transcode the supplied C string to a UTF-16 string. | |
| static XercesString | convert (const std::string &str) |
| Transcode the supplied C++ string to a UTF-16 string. | |
| static unique_xerces_ptr< char16_t > | convertPtr (const char *str) |
| Transcode the supplied C string to a UTF-16 string pointer. | |
| static unique_xerces_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 (as Xerces' XMLString::parseInt would). | |
| 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 Protected Member Functions | |
| 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. | |
Private Types | |
| typedef std::basic_string< char16_t > | XercesString |
Static Private Member Functions | |
| static unique_xerces_ptr< char16_t > | fromNative_ (const char *str) |
| Converts from a narrow-character string to a wide-character string. | |
| static unique_xerces_ptr< char16_t > | fromNative_ (const std::string &str) |
| Converts from a narrow-character string to a wide-character string. | |
| static std::string | toNative_ (const char16_t *str) |
| Converts from a wide-character string to a narrow-character string. | |
| static std::string | toNative_ (const unique_xerces_ptr< char16_t > &str) |
| Converts from a wide-character string to a narrow-character string. | |
Helper class for XML parsing that handles the conversions of Xerces strings.
It provides the convert() function which internally calls XMLString::transcode and ensures that the memory is released properly through XMLString::release internally. It returns a std::string or std::basic_string<char16_t> to the caller who takes ownership of the data.
The public interface uses char16_t (UTF-16 code units), which is guaranteed to match Xerces' XMLCh, so this header stays Xerces-free.
|
private |
| StringManager | ( | ) |
Constructor.
| ~StringManager | ( | ) |
Destructor.
|
static |
Transcodes the supplied char16_t* and appends it to the OpenMS String.
|
staticprotected |
Compresses eight 8x16bit Chars in char16_t* to 8x8bit Chars by cutting upper byte.
|
static |
Transcode the supplied C string to a UTF-16 string.
Referenced by XMLHandler::attributeAsDouble_(), XMLHandler::attributeAsDouble_(), XMLHandler::attributeAsInt_(), XMLHandler::attributeAsString_(), XMLHandler::attributeAsString_(), SAX2HandlerAdapter::message_(), XMLHandler::optionalAttributeAsDouble_(), XMLHandler::optionalAttributeAsDouble_(), XMLHandler::optionalAttributeAsString_(), and XMLHandler::optionalAttributeAsString_().
|
static |
Transcode the supplied char16_t* to a std::string.
|
static |
Transcode the supplied C++ string to a UTF-16 string.
|
static |
Transcode the supplied C string to a UTF-16 string pointer.
|
static |
Transcode the supplied C++ string to a UTF-16 string pointer.
|
staticprivate |
Converts from a narrow-character string to a wide-character string.
|
staticprivate |
Converts from a narrow-character string to a wide-character string.
|
static |
Checks if supplied chars in char16_t* can be encoded with ASCII (i.e. the upper byte of each char is 0)
|
static |
Parse an integer from a UTF-16 numeric string (as Xerces' XMLString::parseInt would).
Referenced by XMLHandler::asInt_(), XMLHandler::attributeAsInt_(), XMLHandler::attributeAsInt_(), XMLHandler::optionalAttributeAsInt_(), XMLHandler::optionalAttributeAsInt_(), XMLHandler::optionalAttributeAsUInt_(), and XMLHandler::optionalAttributeAsUInt_().
|
static |
Calculates the length of a char16_t* string using SIMDe.
|
staticprivate |
Converts from a wide-character string to a narrow-character string.
|
staticprivate |
Converts from a wide-character string to a narrow-character string.