OpenMS
Loading...
Searching...
No Matches
StringManager.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Chris Bielow $
6// $Authors: Marc Sturm, Chris Bielow $
7// --------------------------------------------------------------------------
8
9#pragma once
10
12
13#include <memory>
14#include <string>
15
16namespace OpenMS::Internal
17{
24 class OPENMS_DLLAPI StringManager
25 {
26protected:
28 static void compress64_ (const char16_t * input_it, char* output_it);
29
30public:
33
36
38 // https://github.com/OpenMS/OpenMS/issues/8122
39 static Size strLength(const char16_t* input_ptr);
40
42 static std::u16string convert(const char * str);
43
49 static void convert(const char * str, Size length, std::u16string & result);
50
52 static std::u16string convert(const std::string & str);
53
55 static std::unique_ptr<char16_t[]> convertPtr(const char * str);
56
58 static std::unique_ptr<char16_t[]> convertPtr(const std::string & str);
59
61 static std::string convert(const char16_t * str);
62
64 static Int parseInt(const char16_t * str);
65
67 static bool isASCII(const char16_t * chars, const Size length);
68
75 static void appendASCII(const char16_t * str, const Size length, std::string & result);
76 };
77
78} // namespace OpenMS::Internal
Strict UTF-8/UTF-16 conversion and ASCII helpers for XML handlers.
Definition StringManager.h:25
static std::unique_ptr< char16_t[]> convertPtr(const char *str)
Transcode the supplied C string to a UTF-16 string pointer.
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 convert(const char *str, Size length, std::u16string &result)
Converts the UTF-8 sequence [str, str + length) to UTF-16 into result.
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 ...
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.
static std::string convert(const char16_t *str)
Transcode the supplied char16_t* to a std::string.
static std::u16string convert(const std::string &str)
Transcode the supplied C++ string to a UTF-16 string.
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 Int parseInt(const char16_t *str)
Parse an integer from a UTF-16 numeric string.
static std::unique_ptr< char16_t[]> convertPtr(const std::string &str)
Transcode the supplied C++ string to a UTF-16 string pointer.
int Int
Signed integer type.
Definition Types.h:72
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Initialization procedures.
Definition BayesianProteinInferenceAlgorithm.h:26