VSTGUI: UTF8StringView Class Reference

VSTGUI 4.10 Graphical User Interface Framework not only for VST plugins

Loading...
Searching...
No Matches
Public Member Functions | List of all members
UTF8StringView Class Reference

a view on a null terminated UTF-8 String More...

`#include <cstring.h>`

## Public Member Functions
| UTF8StringView ()
| UTF8StringView (const UTF8StringPtr string)
| UTF8StringView (const UTF8String &string)
| UTF8StringView (const std::string &string)
| UTF8StringView (const UTF8StringView &other) noexcept
UTF8StringView & | operator= (const UTF8StringView &other) noexcept
| UTF8StringView (UTF8StringView &&other) noexcept=default
UTF8StringView & | operator= (UTF8StringView &&other)=default
size_t | calculateByteCount () const
| calculates the bytes used by this string, including null-character
size_t | calculateCharacterCount () const
| calculates the number of UTF-8 characters in the string
bool | contains (const UTF8StringPtr subString, bool ignoreCase=false) const
| checks this string if it contains a subString
bool | startsWith (const UTF8StringView &startString) const
| checks this string if it starts with startString
bool | endsWith (const UTF8StringView &endString) const
| checks this string if it ends with endString
double | toDouble (uint32_t precision=8) const
| converts the string to a double
float | toFloat (uint32_t precision=8) const
| converts the string to a float
int64_t | toInteger () const
| converts the string to an integer
template<typename T>
Optional< T > | toNumber () const
bool | operator== (const UTF8StringPtr otherString) const
bool | operator!= (const UTF8StringPtr otherString) const
bool | operator== (UTF8StringView otherString) const
bool | operator!= (UTF8StringView otherString) const
bool | operator== (const UTF8String &otherString) const
bool | operator!= (const UTF8String &otherString) const
| operator const UTF8StringPtr () const
template<>
Optional< bool > | toNumber () const

## Detailed Description

a view on a null terminated UTF-8 String

It does not copy the string. It's allowed to put null pointers into it. A null pointer is treaded different than an empty string as they are not equal and the byte count of a null pointer is zero while the empty string has a byte count of one.

## Constructor & Destructor Documentation

## ◆ UTF8StringView() [1/6]

UTF8StringView | ( |  | ) |
| inline

## ◆ UTF8StringView() [2/6]

UTF8StringView | ( | const UTF8StringPtr | string | ) |
| inline

## ◆ UTF8StringView() [3/6]

UTF8StringView | ( | const UTF8String & | string | ) |
| inline

## ◆ UTF8StringView() [4/6]

UTF8StringView | ( | const std::string & | string | ) |
| inline

## ◆ UTF8StringView() [5/6]

UTF8StringView | ( | const UTF8StringView & | other | ) |
| inlinenoexcept

## ◆ UTF8StringView() [6/6]

UTF8StringView | ( | UTF8StringView && | other | ) |
| defaultnoexcept

## Member Function Documentation

## ◆ calculateByteCount()

size_t calculateByteCount | ( |  | ) | const
| inline

calculates the bytes used by this string, including null-character

## ◆ calculateCharacterCount()

size_t calculateCharacterCount | ( |  | ) | const
| inline

calculates the number of UTF-8 characters in the string

## ◆ contains()

bool contains | ( | const UTF8StringPtr | subString,
|  | bool | ignoreCase = false ) const
| inline

checks this string if it contains a subString

## ◆ endsWith()

bool endsWith | ( | const UTF8StringView & | endString | ) | const
| inline

checks this string if it ends with endString

## ◆ operator const UTF8StringPtr()

operator const UTF8StringPtr | ( |  | ) | const
| inline

## ◆ operator!=() [1/3]

bool operator!= | ( | const UTF8String & | otherString | ) | const
| inline

## ◆ operator!=() [2/3]

bool operator!= | ( | const UTF8StringPtr | otherString | ) | const
| inline

## ◆ operator!=() [3/3]

bool operator!= | ( | UTF8StringView | otherString | ) | const
| inline

## ◆ operator=() [1/2]

UTF8StringView & operator= | ( | const UTF8StringView & | other | ) |
| inlinenoexcept

## ◆ operator=() [2/2]

UTF8StringView & operator= | ( | UTF8StringView && | other | ) |
| default

## ◆ operator==() [1/3]

bool operator== | ( | const UTF8String & | otherString | ) | const
| inline

## ◆ operator==() [2/3]

bool operator== | ( | const UTF8StringPtr | otherString | ) | const
| inline

## ◆ operator==() [3/3]

bool operator== | ( | UTF8StringView | otherString | ) | const
| inline

## ◆ startsWith()

bool startsWith | ( | const UTF8StringView & | startString | ) | const
| inline

checks this string if it starts with startString

## ◆ toDouble()

double toDouble | ( | uint32_t | precision = 8 | ) | const

converts the string to a double

## ◆ toFloat()

float toFloat | ( | uint32_t | precision = 8 | ) | const
| inline

converts the string to a float

## ◆ toInteger()

int64_t toInteger | ( |  | ) | const

converts the string to an integer

## ◆ toNumber() [1/2]

template<typename T>

Optional< T > toNumber | ( |  | ) | const
| inline

## ◆ toNumber() [2/2]

template<>

Optional< bool > toNumber | ( |  | ) | const
| inline

The documentation for this class was generated from the following files:

- cstring.h
- cstring.cpp