openshot-audio
0.1.2
|
#include <juce_core.h>
Public Member Functions | |
StringRef (const char *stringLiteral) noexcept | |
StringRef (String::CharPointerType stringLiteral) noexcept | |
StringRef (const String &string) noexcept | |
StringRef () noexcept | |
operator const String::CharPointerType::CharType * () const noexcept | |
operator String::CharPointerType () const noexcept | |
bool | isEmpty () const noexcept |
bool | isNotEmpty () const noexcept |
int | length () const noexcept |
juce_wchar | operator[] (int index) const noexcept |
bool | operator== (const String &s) const noexcept |
bool | operator!= (const String &s) const noexcept |
bool | operator== (StringRef s) const noexcept |
bool | operator!= (StringRef s) const noexcept |
Public Attributes | |
String::CharPointerType | text |
A simple class for holding temporary references to a string literal or String.
Unlike a real String object, the StringRef does not allocate any memory or take ownership of the strings you give to it - it simply holds a reference to a string that has been allocated elsewhere. The main purpose of the class is to be used instead of a const String& as the type of function arguments where the caller may pass either a string literal or a String object. This means that when the called uses a string literal, there's no need for an temporary String object to be allocated, and this cuts down overheads substantially.
Because the class is simply a wrapper around a pointer, you should always pass it by value, not by reference.
For examples of it in use, see the XmlElement or StringArray classes.
Bear in mind that there are still many cases where it's better to use an argument which is a const String&. For example if the function stores the string or needs to internally create a String from the argument, then it's better for the original argument to already be a String.
|
noexcept |
|
noexcept |
|
noexcept |
Creates a StringRef pointer to an empty string.
|
inlinenoexcept |
Returns true if the string is empty.
|
inlinenoexcept |
Returns true if the string is not empty.
|
inlinenoexcept |
Returns the number of characters in the string.
|
inlinenoexcept |
Returns a raw pointer to the underlying string data.
|
inlinenoexcept |
Returns a pointer to the underlying string data as a char pointer object.
|
inlinenoexcept |
Case-sensitive comparison of two StringRefs.
|
inlinenoexcept |
Case-sensitive comparison of two StringRefs.
|
inlinenoexcept |
Retrieves a character by index.
String::CharPointerType juce::StringRef::text |
The text that is referenced.