Loading...
Searching...
No Matches
juce_StringPairArray.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
class JUCE_API StringPairArray
{
public:
//==============================================================================
StringPairArray (bool ignoreCaseWhenComparingKeys = true);
StringPairArray (const StringPairArray& other);
~StringPairArray() = default;
StringPairArray& operator= (const StringPairArray& other);
//==============================================================================
bool operator== (const StringPairArray& other) const;
bool operator!= (const StringPairArray& other) const;
//==============================================================================
const String& operator[] (StringRef key) const;
String getValue (StringRef, const String& defaultReturnValue) const;
bool containsKey (StringRef key) const noexcept;
const StringArray& getAllKeys() const noexcept { return keys; }
const StringArray& getAllValues() const noexcept { return values; }
inline int size() const noexcept { return keys.size(); }
//==============================================================================
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);
private:
//==============================================================================
template <typename Map>
void addMapImpl (const Map& mapToAdd);
StringArray keys, values;
bool ignoreCase;
JUCE_LEAK_DETECTOR (StringPairArray)
};
} // namespace juce
juce::StringArray
Definition juce_StringArray.h:35
juce::StringPairArray
Definition juce_StringPairArray.h:35
juce::StringPairArray::getValue
String getValue(StringRef, const String &defaultReturnValue) const
Definition juce_StringPairArray.cpp:86
juce::StringPairArray::containsKey
bool containsKey(StringRef key) const noexcept
Definition juce_StringPairArray.cpp:96
juce::StringPairArray::StringPairArray
StringPairArray(bool ignoreCaseWhenComparingKeys=true)
Definition juce_StringPairArray.cpp:26
juce::StringPairArray::getAllValues
const StringArray & getAllValues() const noexcept
Definition juce_StringPairArray.h:90
juce::StringPairArray::~StringPairArray
~StringPairArray()=default
juce::StringPairArray::size
int size() const noexcept
Definition juce_StringPairArray.h:93
juce::StringPairArray::getAllKeys
const StringArray & getAllKeys() const noexcept
Definition juce_StringPairArray.h:87
juce::StringRef
Definition juce_StringRef.h:62
juce::String
Definition juce_String.h:53