OpenShot Library | OpenShotAudio
0.2.1
|
A container for holding a set of strings which are keyed by another string. More...
#include <juce_StringPairArray.h>
Public Member Functions | |
StringPairArray (bool ignoreCaseWhenComparingKeys=true) | |
Creates an empty array. | |
StringPairArray (const StringPairArray &other) | |
Creates a copy of another array. | |
~StringPairArray () | |
Destructor. More... | |
StringPairArray & | operator= (const StringPairArray &other) |
Copies the contents of another string array into this one. | |
bool | operator== (const StringPairArray &other) const |
Compares two arrays. More... | |
bool | operator!= (const StringPairArray &other) const |
Compares two arrays. More... | |
const String & | operator[] (StringRef key) const |
Finds the value corresponding to a key string. More... | |
String | getValue (StringRef, const String &defaultReturnValue) const |
Finds the value corresponding to a key string. More... | |
bool | containsKey (StringRef key) const noexcept |
Returns true if the given key exists. More... | |
const StringArray & | getAllKeys () const noexcept |
Returns a list of all keys in the array. More... | |
const StringArray & | getAllValues () const noexcept |
Returns a list of all values in the array. More... | |
int | size () const noexcept |
Returns the number of strings in the array. | |
void | set (const String &key, const String &value) |
Adds or amends a key/value pair. More... | |
void | addArray (const StringPairArray &other) |
Adds the items from another array to this one. More... | |
void | clear () |
Removes all elements from the array. More... | |
void | remove (StringRef key) |
Removes a string from the array based on its key. More... | |
void | remove (int index) |
Removes a string from the array based on its index. More... | |
void | setIgnoresCase (bool shouldIgnoreCase) |
Indicates whether to use a case-insensitive search when looking up a key string. | |
String | getDescription () const |
Returns a descriptive string containing the items. More... | |
void | minimiseStorageOverheads () |
Reduces the amount of storage being used by the array. More... | |
A container for holding a set of strings which are keyed by another string.
Definition at line 38 of file juce_StringPairArray.h.
juce::StringPairArray::~StringPairArray | ( | ) |
Destructor.
Definition at line 37 of file juce_StringPairArray.cpp.
bool juce::StringPairArray::operator== | ( | const StringPairArray & | other | ) | const |
Compares two arrays.
Comparisons are case-sensitive.
Definition at line 48 of file juce_StringPairArray.cpp.
References juce::StringArray::indexOf(), and size().
Referenced by operator!=().
bool juce::StringPairArray::operator!= | ( | const StringPairArray & | other | ) | const |
Compares two arrays.
Comparisons are case-sensitive.
Definition at line 80 of file juce_StringPairArray.cpp.
References operator==().
Finds the value corresponding to a key string.
If no such key is found, this will just return an empty string. To check whether a given key actually exists (because it might actually be paired with an empty string), use the getAllKeys() method to obtain a list.
Obviously the reference returned shouldn't be stored for later use, as the string it refers to may disappear when the array changes.
Definition at line 85 of file juce_StringPairArray.cpp.
References juce::StringArray::indexOf().
Finds the value corresponding to a key string.
If no such key is found, this will just return the value provided as a default.
Definition at line 90 of file juce_StringPairArray.cpp.
References juce::StringArray::indexOf().
Referenced by juce::LocalisedStrings::translate().
|
noexcept |
Returns true if the given key exists.
Definition at line 100 of file juce_StringPairArray.cpp.
References juce::StringArray::contains().
Referenced by juce::WavFileHelpers::AcidChunk::AcidChunk(), and juce::LocalisedStrings::translate().
|
inlinenoexcept |
Returns a list of all keys in the array.
Definition at line 91 of file juce_StringPairArray.h.
Referenced by juce::PropertySet::addAllPropertiesFrom(), juce::PropertySet::containsKey(), juce::PropertySet::createXml(), juce::PropertySet::getBoolValue(), juce::PropertySet::getDoubleValue(), juce::PropertySet::getIntValue(), juce::PropertySet::getValue(), juce::PropertySet::removeValue(), juce::PropertySet::setValue(), juce::StringRef::StringRef(), and juce::URL::withParameters().
|
inlinenoexcept |
Returns a list of all values in the array.
Definition at line 94 of file juce_StringPairArray.h.
Referenced by juce::PropertySet::addAllPropertiesFrom(), juce::PropertySet::createXml(), juce::PropertySet::getBoolValue(), juce::PropertySet::getDoubleValue(), juce::PropertySet::getIntValue(), juce::PropertySet::getValue(), juce::PropertySet::setValue(), and juce::URL::withParameters().
Adds or amends a key/value pair.
If a value already exists with this key, its value will be overwritten, otherwise the key/value pair will be added to the array.
Definition at line 105 of file juce_StringPairArray.cpp.
References juce::StringArray::add(), juce::StringArray::indexOf(), and juce::StringArray::set().
Referenced by juce::WavFileHelpers::AcidChunk::AcidChunk(), juce::WebInputStream::connect(), juce::WavAudioFormat::createBWAVMetadata(), juce::WavAudioFormat::replaceMetadataInFile(), juce::PropertySet::restoreFromXml(), juce::PropertiesFile::save(), juce::PropertySet::setValue(), and juce::StringRef::StringRef().
void juce::StringPairArray::addArray | ( | const StringPairArray & | other | ) |
Adds the items from another array to this one.
This is equivalent to using set() to add each of the pairs from the other array.
Definition at line 120 of file juce_StringPairArray.cpp.
References size().
Referenced by juce::WavAudioFormat::replaceMetadataInFile().
void juce::StringPairArray::clear | ( | ) |
Removes all elements from the array.
Definition at line 126 of file juce_StringPairArray.cpp.
References juce::StringArray::clear().
Referenced by juce::PropertySet::clear().
void juce::StringPairArray::remove | ( | StringRef | key | ) |
Removes a string from the array based on its key.
If the key isn't found, nothing will happen.
Definition at line 132 of file juce_StringPairArray.cpp.
References juce::StringArray::indexOf().
Referenced by juce::PropertySet::removeValue().
void juce::StringPairArray::remove | ( | int | index | ) |
Removes a string from the array based on its index.
If the index is out-of-range, no action will be taken.
Definition at line 137 of file juce_StringPairArray.cpp.
References juce::StringArray::remove().
String juce::StringPairArray::getDescription | ( | ) | const |
Returns a descriptive string containing the items.
This is handy for dumping the contents of an array.
Definition at line 148 of file juce_StringPairArray.cpp.
References juce::StringArray::size().
void juce::StringPairArray::minimiseStorageOverheads | ( | ) |
Reduces the amount of storage being used by the array.
Arrays typically allocate slightly more storage than they need, and after removing elements, they may have quite a lot of unused space allocated. This method will reduce the amount of allocated storage to a minimum.
Definition at line 163 of file juce_StringPairArray.cpp.
References juce::StringArray::minimiseStorageOverheads().