|
FLANG
|
#include <flang/Evaluate/character-value.h>
Public Member Functions | |
| CharacterValue (const CharacterValue &) | |
| CharacterValue (CharacterValue &&) | |
| CharacterValue & | operator= (const CharacterValue &) |
| CharacterValue & | operator= (CharacterValue &&) |
| CharacterValue () | |
| CharacterValue (int kind, std::string s) | |
| CharacterValue (int kind, std::u16string s) | |
| CharacterValue (int kind, std::u32string s) | |
| CharacterValue (int kind, std::size_t n, char32_t c) | |
| Fill constructor: create a string of n copies of the given character. | |
| void | print (llvm::raw_ostream &os) const |
| LLVM_DUMP_METHOD void | dump () const |
| bool | IsNull () const |
| int | kind () const |
| The kind of the value currently stored. | |
| bool | empty () const |
| std::size_t | size () const |
| std::size_t | length () const |
| std::size_t | charSize () const |
| Byte size of one character unit (1, 2, or 4). | |
| size_t | bytesStored () const |
| Number of bytes accessed by FromRawBytes/StoreRawBytes. | |
| std::optional< llvm::StringRef > | AsStringRef () const |
| std::optional< std::string > | AsStdString () const |
| std::optional< std::u16string > | AsU16String () const |
| std::optional< std::u32string > | AsU32String () const |
| std::string | ToStdString () const |
| Force conversion to Ascii even if this means loss of information. | |
| template<typename CharT, typename = std::void_t<std::basic_string<CharT>>> | |
| std::optional< std::basic_string< CharT > > | AsBasicString () const |
| Ordering | Compare (const CharacterValue &y) const |
| bool | operator< (const CharacterValue &y) const |
| bool | operator<= (const CharacterValue &y) const |
| bool | operator== (const CharacterValue &y) const |
| bool | operator!= (const CharacterValue &y) const |
| bool | operator>= (const CharacterValue &y) const |
| bool | operator> (const CharacterValue &y) const |
| CharacterValue | ToAscii (int kind) const |
| void | assign (int kind, std::size_t n, char32_t c) |
| void | assign (const char *p, std::size_t n) |
| Assign from a raw character pointer and length. | |
| void | assign (const char16_t *p, std::size_t n) |
| void | assign (const char32_t *p, std::size_t n) |
| void | erase (std::size_t pos) |
| Erase from position pos to end. | |
| void | append (std::size_t n, char32_t c) |
| Append n copies of the given character (widened to the stored type). | |
| CharacterValue & | replace (std::size_t pos, std::size_t len, const CharacterValue &other) |
| Replace the substring [pos, pos+len) with characters from other. | |
| CharacterValue | substr (std::size_t pos) const |
| Return a suffix starting at pos. | |
| CharacterValue | substr (std::size_t pos, std::size_t len) const |
| Return a substring of len characters starting at pos. | |
| void | reserve (std::size_t n) |
| Reserve storage for at least n characters. | |
| char32_t | operator[] (std::size_t i) const |
| Return the character at position i. | |
| CharacterValue | operator+ (const CharacterValue &y) const |
| Concatenate two same-kind strings. | |
| CharacterValue & | operator+= (const CharacterValue &y) |
| Append another same-kind string. | |
| CharacterValue & | operator+= (char32_t c) |
| Append a character, converting it to the string's element type. | |
| std::size_t | find (const CharacterValue &pattern) const |
| std::size_t | rfind (const CharacterValue &pattern) const |
| std::size_t | find_first_of (const CharacterValue &set) const |
| std::size_t | find_last_of (const CharacterValue &set) const |
| std::size_t | find_first_not_of (char32_t c) const |
| std::size_t | find_last_not_of (char32_t c) const |
| std::size_t | find_first_not_of (const CharacterValue &set) const |
| std::size_t | find_last_not_of (const CharacterValue &set) const |
| void * | data () |
| Raw byte pointer to the underlying character data. | |
| const void * | data () const |
| char * | charData () |
| Like data(), but pre-casted to char. | |
| const char * | charData () const |
| void * | at (size_t pos) |
| const void * | at (size_t pos) const |
| void | StoreRawBytes (void *dst, size_t size, bool *changed=nullptr) const |
| template<typename F> | |
| decltype(auto) | withStdString (F &&f) const |
Static Public Member Functions | |
| static CharacterValue | Zero (int kind) |
| static CharacterValue | FromRawBytes (int kind, const void *raw, size_t byteSize) |
| template<typename F> | |
| static auto | withCharProto (int kind, F &&f) -> decltype(std::declval< F >()(std::declval< char >())) |
Static Public Attributes | |
| static constexpr std::size_t | npos {std::string::npos} |
| Sentinel value for "not found" positions (same as std::string::npos). | |
A character string with dynamic character representation with std::basic_string-like API.
The character type is dynamic between char, char16_t, and char32_t. As being able to represent all values, char32_t is used when passing single characters. It is also kind-aware, i.e. knows which CHARACTER kind it currently represents.
The implementation is hidden from this header using a pImpl-like idiom.
| Fortran::evaluate::value::CharacterValue::CharacterValue | ( | ) |
A default-initialized CharacterValue is in a null state; it represents an empty string, but its kind is not yet known. Not all operations are supported in this state.
| void Fortran::evaluate::value::CharacterValue::assign | ( | int | kind, |
| std::size_t | n, | ||
| char32_t | c ) |
Assign n copies of the given character, fixing the kind from the char type.
| bool Fortran::evaluate::value::CharacterValue::IsNull | ( | ) | const |
Whether this object represents a default-initialized value (zero) of not-yet-known kind.
| void Fortran::evaluate::value::CharacterValue::StoreRawBytes | ( | void * | dst, |
| size_t | size, | ||
| bool * | changed = nullptr ) const |
Writes a string of characters to dst. \o is the the number of bytes to be written; must be a multiple of the size of a single character. If s is smaller that size, the rest of the memory is set to spaces. If s is shorter than size, only the first characters are written. If changes points to bool, it will be set to true if any bytes at dst have changed.