OpenShot Audio Library | OpenShotAudio 0.4.0
Loading...
Searching...
No Matches
juce::StringPairArray Class Reference

#include <juce_StringPairArray.h>

Public Member Functions

 StringPairArray (bool ignoreCaseWhenComparingKeys=true)
 StringPairArray (const StringPairArray &other)
 ~StringPairArray ()=default
StringPairArrayoperator= (const StringPairArray &other)
bool operator== (const StringPairArray &other) const
bool operator!= (const StringPairArray &other) const
const Stringoperator[] (StringRef key) const
String getValue (StringRef, const String &defaultReturnValue) const
bool containsKey (StringRef key) const noexcept
const StringArraygetAllKeys () const noexcept
const StringArraygetAllValues () const noexcept
int size () const noexcept
void set (const String &key, const String &value)
void addArray (const StringPairArray &other)
void clear ()
void remove (StringRef key)
void remove (int index)
void setIgnoresCase (bool shouldIgnoreCase)
bool getIgnoresCase () const noexcept
String getDescription () const
void minimiseStorageOverheads ()
void addMap (const std::map< String, String > &mapToAdd)
void addUnorderedMap (const std::unordered_map< String, String > &mapToAdd)

Detailed Description

A container for holding a set of strings which are keyed by another string.

See also
StringArray

Definition at line 34 of file juce_StringPairArray.h.

Constructor & Destructor Documentation

◆ StringPairArray() [1/2]

juce::StringPairArray::StringPairArray ( bool ignoreCaseWhenComparingKeys = true)

Creates an empty array

Definition at line 26 of file juce_StringPairArray.cpp.

Referenced by addArray(), operator!=(), operator=(), operator==(), StringPairArray(), and ~StringPairArray().

◆ StringPairArray() [2/2]

juce::StringPairArray::StringPairArray ( const StringPairArray & other)

Creates a copy of another array

Definition at line 30 of file juce_StringPairArray.cpp.

◆ ~StringPairArray()

juce::StringPairArray::~StringPairArray ( )
default

Destructor.

Member Function Documentation

◆ addArray()

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 116 of file juce_StringPairArray.cpp.

◆ addMap()

void juce::StringPairArray::addMap ( const std::map< String, String > & mapToAdd)

Adds the contents of a map to this StringPairArray.

Definition at line 206 of file juce_StringPairArray.cpp.

◆ addUnorderedMap()

void juce::StringPairArray::addUnorderedMap ( const std::unordered_map< String, String > & mapToAdd)

Adds the contents of an unordered map to this StringPairArray.

Definition at line 205 of file juce_StringPairArray.cpp.

◆ clear()

void juce::StringPairArray::clear ( )

Removes all elements from the array.

Definition at line 122 of file juce_StringPairArray.cpp.

◆ containsKey()

bool juce::StringPairArray::containsKey ( StringRef key) const
noexcept

Returns true if the given key exists.

Definition at line 96 of file juce_StringPairArray.cpp.

Referenced by ~StringPairArray().

◆ getAllKeys()

const StringArray & juce::StringPairArray::getAllKeys ( ) const
inlinenoexcept

Returns a list of all keys in the array.

Definition at line 87 of file juce_StringPairArray.h.

Referenced by juce::PropertySet::addAllPropertiesFrom(), and juce::URL::withParameters().

◆ getAllValues()

const StringArray & juce::StringPairArray::getAllValues ( ) const
inlinenoexcept

Returns a list of all values in the array.

Definition at line 90 of file juce_StringPairArray.h.

Referenced by juce::PropertySet::addAllPropertiesFrom(), and juce::URL::withParameters().

◆ getDescription()

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 149 of file juce_StringPairArray.cpp.

◆ getIgnoresCase()

bool juce::StringPairArray::getIgnoresCase ( ) const
noexcept

Indicates whether a case-insensitive search is used when looking up a key string.

Definition at line 144 of file juce_StringPairArray.cpp.

◆ getValue()

String juce::StringPairArray::getValue ( StringRef key,
const String & defaultReturnValue ) const

Finds the value corresponding to a key string. If no such key is found, this will just return the value provided as a default.

See also
operator[]

Definition at line 86 of file juce_StringPairArray.cpp.

Referenced by ~StringPairArray().

◆ minimiseStorageOverheads()

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 164 of file juce_StringPairArray.cpp.

◆ operator!=()

bool juce::StringPairArray::operator!= ( const StringPairArray & other) const

Compares two arrays. Comparisons are case-sensitive.

Returns
false if the other array contains exactly the same strings with the same keys

Definition at line 76 of file juce_StringPairArray.cpp.

◆ operator=()

StringPairArray & juce::StringPairArray::operator= ( const StringPairArray & other)

Copies the contents of another string array into this one

Definition at line 37 of file juce_StringPairArray.cpp.

◆ operator==()

bool juce::StringPairArray::operator== ( const StringPairArray & other) const

Compares two arrays. Comparisons are case-sensitive.

Returns
true only if the other array contains exactly the same strings with the same keys

Definition at line 44 of file juce_StringPairArray.cpp.

Referenced by operator!=().

◆ operator[]()

const String & juce::StringPairArray::operator[] ( StringRef key) const

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.

See also
getValue

Definition at line 81 of file juce_StringPairArray.cpp.

◆ remove() [1/2]

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 133 of file juce_StringPairArray.cpp.

◆ remove() [2/2]

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 128 of file juce_StringPairArray.cpp.

Referenced by remove().

◆ set()

void juce::StringPairArray::set ( const String & key,
const String & value )

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 101 of file juce_StringPairArray.cpp.

Referenced by addArray(), and juce::WavAudioFormat::createBWAVMetadata().

◆ setIgnoresCase()

void juce::StringPairArray::setIgnoresCase ( bool shouldIgnoreCase)

Indicates whether to use a case-insensitive search when looking up a key string.

Definition at line 139 of file juce_StringPairArray.cpp.

◆ size()

int juce::StringPairArray::size ( ) const
inlinenoexcept

Returns the number of strings in the array

Definition at line 93 of file juce_StringPairArray.h.

Referenced by juce::PropertySet::addAllPropertiesFrom(), operator==(), and juce::URL::withParameters().


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