swift
Loading...
Searching...
No Matches
swift::misc::CDictionary< Key, Value, Impl > Class Template Reference

Associative container with value semantics, chooses a sensible default implementation container type. More...

#include <dictionary.h>

Inheritance diagram for swift::misc::CDictionary< Key, Value, Impl >:
[legend]

Public Types

using impl_type = Impl<Key, Value>
 The implementation container.
using key_type = Key
 STL compatibility.
using value_type = Value
 STL compatibility.
using reference = Value &
 STL compatibility.
using const_reference = Value &
 STL compatibility.
using size_type = typename Impl<Key, Value>::size_type
 STL compatibility.
using iterator = typename Impl<Key, Value>::iterator
 STL compatibility.
using const_iterator = typename Impl<Key, Value>::const_iterator
 STL compatibility.

Public Member Functions

template<class Predicate>
CDictionary findKeyBy (Predicate p) const
 Return a copy containing only those elements for which the dictionary keys return true for a given predicate.
template<class... Pairs>
CDictionary findKeyBy (Pairs... pairs) const
 Return a copy containing only those elements which key matches a particular pair.
template<class Predicate>
CDictionary findValueBy (Predicate p) const
 Return a copy containing only those elements for which a given predicate returns true.
template<class... Pairs>
CDictionary findValueBy (Pairs... pairs) const
 Return a copy containing only those elements which value matches a particular pair.
template<class Predicate>
bool containsByKey (Predicate p) const
 Return true if there is an element for which a given predicate returns true.
template<class MembFunc, class ReturnValue>
bool containsByKey (MembFunc membFunc, ReturnValue returnValue) const
 Return true if there is an element which key matches a given pair.
template<class Predicate>
bool containsByValue (Predicate p) const
 Return true if there is an element for which a given predicate returns true.
template<class MembFunc, class ReturnValue>
bool containsByValue (MembFunc membFunc, ReturnValue returnValue) const
 Return true if there is an element which value matches a given pair.
template<class Predicate>
void removeByKeyIf (Predicate p)
 Remove elements for which a given predicate for value returns true.
template<class Predicate>
void removeByValueIf (Predicate p)
 Remove elements for which a given predicate for key returns true.
template<class MembFunc, class ReturnValue>
void removeByKeyIf (MembFunc membFunc, ReturnValue returnValue)
 Remove elements for which key matches a particular pair.
template<class MembFunc, class ReturnValue>
void removeByValueIf (MembFunc membFunc, ReturnValue returnValue)
 Remove elements for which value matches a particular pair.
void removeDuplicates (const CDictionary &other)
 Remove elements for which the same key/value pair is present in an other dictionary.
QJsonObject toJson () const
 Cast to JSON object.
void convertFromJson (const QJsonObject &json)
 Assign from JSON object.
 CDictionary ()=default
 Default constructor.
 CDictionary (std::initializer_list< std::pair< Key, Value > > il)
 Initializer list constructor.
 CDictionary (const CDictionary &)=default
 Copy constructor.
 CDictionary (CDictionary &&other) noexcept
 Move constructor.
 ~CDictionary ()=default
 Destructor.
iterator begin ()
 Returns iterator at the beginning of the dictionary.
const_iterator begin () const
 Returns const iterator at the beginning of the dictionary.
const_iterator cbegin () const
 Returns const iterator at the beginning of the dictionary.
iterator end ()
 Returns iterator at the end of the dictionary.
const_iterator end () const
 Returns const iterator at the end of the dictionary.
const_iterator cend () const
 Returns const iterator at the end of the dictionary.
auto keyBegin () const
 Returns const iterator for iterating over keys.
auto keyEnd () const
 Returns const iterator for iterating over keys.
auto keyValueBegin ()
 Returns iterator for iterating over keys and values together.
auto keyValueEnd ()
 Returns iterator for iterating over keys and values together.
auto keyValueBegin () const
 Returns const iterator for iterating over keys and values together.
auto constKeyValueBegin () const
 Returns const iterator for iterating over keys and values together.
auto keyValueEnd () const
 Returns const iterator for iterating over keys and values together.
auto constKeyValueEnd () const
 Returns const iterator for iterating over keys and values together.
void clear ()
 Removes all items from the dictionary.
const_iterator constBegin () const
 Returns const iterator at the beginning of the dictionary.
const_iterator constEnd () const
 Returns const iterator at the end of the dictionary.
const_iterator constFind (const Key &key) const
 Returns an const iterator pointing to the item with the key.
const_iterator find (const Key &key) const
 Returns an const iterator pointing to the item with the key.
iterator find (const Key &key)
 Returns an iterator pointing to the item with the key.
bool contains (const Key &key) const
 Returns true if dictionary contains an item with key, otherwise false.
int count (const Key &key) const
 Returns the number of items with key.
int count () const
 Returns the size of the dictionary.
bool empty () const
 Returns true if the.
iterator erase (iterator pos)
 Removes the key/value pair iterator is currently pointing to and returns an iterator to the next item.
iterator insert (const Key &key, const Value &value)
 Insert new item with key and value.
void insert (const CDictionary &other)
 Insert all items of other dictionary into this dictionary.
bool isEmpty () const
 Returns true if dictionary is empty.
const Key key (const Value &value) const
 Return key assigned to value.
const Key key (const Value &value, const Key &defaultKey) const
 Return key assigned to value or if key is not found defaultKey.
auto keys () const
 Return a range of all keys (does not allocate a temporary container).
int remove (const Key &key)
 Remove all items with key from the dictionary.
int size () const
 Returns the number of items in the hash.
void swap (CDictionary &other) noexcept
 Swaps hash other with this hash. This operation is very fast and never fails.
const Value value (const Key &key) const
 Returns the value associated with the key.
const Value value (const Key &key, const Value &defaultValue) const
 Returns the value associated with the key or if key is not found defaultValue.
CRange< const_iterator > values () const
 Return a range of all values (does not allocate a temporary container).
CDictionary & operator= (const CDictionary &other)
 Copy assignment.
CDictionary & operator= (CDictionary &&other) noexcept
 Move assignment.
Value & operator[] (const Key &key)
 Access an element by its key.
const Value operator[] (const Key &key) const
 Access an element by its key.
QString convertToQString (bool i18n=false) const
 Cast as QString.
void marshallToDbus (QDBusArgument &argument) const
 Marshall without begin/endStructure, for when composed within another object.
void unmarshallFromDbus (const QDBusArgument &argument)
 Unmarshall without begin/endStructure, for when composed within another object.
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
Public Member Functions inherited from swift::misc::mixin::String< CDictionary< Key, Value, TDefaultAssociativeType > >
QString toQString (bool i18n=false) const
 Cast as QString.
std::string toStdString (bool i18n=false) const
 To std string.
QString stringForStreaming () const
 String for streaming operators.

Friends

int compare (const CDictionary &a, const CDictionary &b)
 Return negative, zero, or positive if a is less than, equal to, or greater than b.
impl_type & implementationOf (CDictionary &dict)
 Return reference to the internal implementation object.
const impl_type & implementationOf (const CDictionary &dict)
 Return reference to the internal implementation object.
bool operator== (const CDictionary &a, const CDictionary &b)
 Test for equality.
bool operator!= (const CDictionary &a, const CDictionary &b)
 Test for inequality.

Detailed Description

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
class swift::misc::CDictionary< Key, Value, Impl >

Associative container with value semantics, chooses a sensible default implementation container type.

Definition at line 76 of file dictionary.h.

Member Typedef Documentation

◆ const_iterator

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
using swift::misc::CDictionary< Key, Value, Impl >::const_iterator = typename Impl<Key, Value>::const_iterator

STL compatibility.

Definition at line 119 of file dictionary.h.

◆ const_reference

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
using swift::misc::CDictionary< Key, Value, Impl >::const_reference = Value &

STL compatibility.

Definition at line 110 of file dictionary.h.

◆ impl_type

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
using swift::misc::CDictionary< Key, Value, Impl >::impl_type = Impl<Key, Value>

The implementation container.

Definition at line 98 of file dictionary.h.

◆ iterator

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
using swift::misc::CDictionary< Key, Value, Impl >::iterator = typename Impl<Key, Value>::iterator

STL compatibility.

Definition at line 116 of file dictionary.h.

◆ key_type

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
using swift::misc::CDictionary< Key, Value, Impl >::key_type = Key

STL compatibility.

Definition at line 101 of file dictionary.h.

◆ reference

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
using swift::misc::CDictionary< Key, Value, Impl >::reference = Value &

STL compatibility.

Definition at line 107 of file dictionary.h.

◆ size_type

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
using swift::misc::CDictionary< Key, Value, Impl >::size_type = typename Impl<Key, Value>::size_type

STL compatibility.

Definition at line 113 of file dictionary.h.

◆ value_type

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
using swift::misc::CDictionary< Key, Value, Impl >::value_type = Value

STL compatibility.

Definition at line 104 of file dictionary.h.

Constructor & Destructor Documentation

◆ CDictionary() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
swift::misc::CDictionary< Key, Value, Impl >::CDictionary ( std::initializer_list< std::pair< Key, Value > > il)
inline

Initializer list constructor.

Definition at line 324 of file dictionary.h.

◆ CDictionary() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
swift::misc::CDictionary< Key, Value, Impl >::CDictionary ( CDictionary< Key, Value, Impl > && other)
inlinenoexcept

Move constructor.

Definition at line 330 of file dictionary.h.

Member Function Documentation

◆ begin() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
iterator swift::misc::CDictionary< Key, Value, Impl >::begin ( )
inline

Returns iterator at the beginning of the dictionary.

Definition at line 336 of file dictionary.h.

◆ begin() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const_iterator swift::misc::CDictionary< Key, Value, Impl >::begin ( ) const
inline

Returns const iterator at the beginning of the dictionary.

Definition at line 339 of file dictionary.h.

◆ cbegin()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const_iterator swift::misc::CDictionary< Key, Value, Impl >::cbegin ( ) const
inline

Returns const iterator at the beginning of the dictionary.

Definition at line 342 of file dictionary.h.

◆ cend()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const_iterator swift::misc::CDictionary< Key, Value, Impl >::cend ( ) const
inline

Returns const iterator at the end of the dictionary.

Definition at line 351 of file dictionary.h.

◆ clear()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::clear ( )
inline

Removes all items from the dictionary.

Definition at line 378 of file dictionary.h.

◆ constBegin()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const_iterator swift::misc::CDictionary< Key, Value, Impl >::constBegin ( ) const
inline

Returns const iterator at the beginning of the dictionary.

Definition at line 381 of file dictionary.h.

◆ constEnd()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const_iterator swift::misc::CDictionary< Key, Value, Impl >::constEnd ( ) const
inline

Returns const iterator at the end of the dictionary.

Definition at line 384 of file dictionary.h.

◆ constFind()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const_iterator swift::misc::CDictionary< Key, Value, Impl >::constFind ( const Key & key) const
inline

Returns an const iterator pointing to the item with the key.

Returns
If key is not found, the function returns constEnd()

Definition at line 388 of file dictionary.h.

◆ constKeyValueBegin()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::constKeyValueBegin ( ) const
inline

Returns const iterator for iterating over keys and values together.

Definition at line 369 of file dictionary.h.

◆ constKeyValueEnd()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::constKeyValueEnd ( ) const
inline

Returns const iterator for iterating over keys and values together.

Definition at line 375 of file dictionary.h.

◆ contains()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
bool swift::misc::CDictionary< Key, Value, Impl >::contains ( const Key & key) const
inline

Returns true if dictionary contains an item with key, otherwise false.

Definition at line 399 of file dictionary.h.

◆ containsByKey() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class MembFunc, class ReturnValue>
bool swift::misc::CDictionary< Key, Value, Impl >::containsByKey ( MembFunc membFunc,
ReturnValue returnValue ) const
inline

Return true if there is an element which key matches a given pair.

Definition at line 186 of file dictionary.h.

◆ containsByKey() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class Predicate>
bool swift::misc::CDictionary< Key, Value, Impl >::containsByKey ( Predicate p) const
inline

Return true if there is an element for which a given predicate returns true.

Definition at line 178 of file dictionary.h.

◆ containsByValue() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class MembFunc, class ReturnValue>
bool swift::misc::CDictionary< Key, Value, Impl >::containsByValue ( MembFunc membFunc,
ReturnValue returnValue ) const
inline

Return true if there is an element which value matches a given pair.

Definition at line 200 of file dictionary.h.

◆ containsByValue() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class Predicate>
bool swift::misc::CDictionary< Key, Value, Impl >::containsByValue ( Predicate p) const
inline

Return true if there is an element for which a given predicate returns true.

Definition at line 193 of file dictionary.h.

◆ convertFromJson()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::convertFromJson ( const QJsonObject & json)
inline

Assign from JSON object.

Definition at line 285 of file dictionary.h.

◆ convertToQString()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
QString swift::misc::CDictionary< Key, Value, Impl >::convertToQString ( bool i18n = false) const
inline

Cast as QString.

Definition at line 489 of file dictionary.h.

◆ count() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
int swift::misc::CDictionary< Key, Value, Impl >::count ( ) const
inline

Returns the size of the dictionary.

Definition at line 405 of file dictionary.h.

◆ count() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
int swift::misc::CDictionary< Key, Value, Impl >::count ( const Key & key) const
inline

Returns the number of items with key.

Definition at line 402 of file dictionary.h.

◆ empty()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
bool swift::misc::CDictionary< Key, Value, Impl >::empty ( ) const
inline

Returns true if the.

Definition at line 408 of file dictionary.h.

◆ end() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
iterator swift::misc::CDictionary< Key, Value, Impl >::end ( )
inline

Returns iterator at the end of the dictionary.

Definition at line 345 of file dictionary.h.

◆ end() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const_iterator swift::misc::CDictionary< Key, Value, Impl >::end ( ) const
inline

Returns const iterator at the end of the dictionary.

Definition at line 348 of file dictionary.h.

◆ erase()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
iterator swift::misc::CDictionary< Key, Value, Impl >::erase ( iterator pos)
inline

Removes the key/value pair iterator is currently pointing to and returns an iterator to the next item.

Definition at line 411 of file dictionary.h.

◆ find() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
iterator swift::misc::CDictionary< Key, Value, Impl >::find ( const Key & key)
inline

Returns an iterator pointing to the item with the key.

Returns
If key is not found, the function returns end()

Definition at line 396 of file dictionary.h.

◆ find() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const_iterator swift::misc::CDictionary< Key, Value, Impl >::find ( const Key & key) const
inline

Returns an const iterator pointing to the item with the key.

Returns
If key is not found, the function returns end()

Definition at line 392 of file dictionary.h.

◆ findKeyBy() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class... Pairs>
CDictionary swift::misc::CDictionary< Key, Value, Impl >::findKeyBy ( Pairs... pairs) const
inline

Return a copy containing only those elements which key matches a particular pair.

Parameters
pairsPairs of { pointer to member function of Value, return value to compare it against }.

Definition at line 144 of file dictionary.h.

◆ findKeyBy() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class Predicate>
CDictionary swift::misc::CDictionary< Key, Value, Impl >::findKeyBy ( Predicate p) const
inline

Return a copy containing only those elements for which the dictionary keys return true for a given predicate.

Definition at line 124 of file dictionary.h.

◆ findValueBy() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class... Pairs>
CDictionary swift::misc::CDictionary< Key, Value, Impl >::findValueBy ( Pairs... pairs) const
inline

Return a copy containing only those elements which value matches a particular pair.

Parameters
pairsPairs of { pointer to member function of Value, return value to compare it against }.

Definition at line 171 of file dictionary.h.

◆ findValueBy() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class Predicate>
CDictionary swift::misc::CDictionary< Key, Value, Impl >::findValueBy ( Predicate p) const
inline

Return a copy containing only those elements for which a given predicate returns true.

Definition at line 151 of file dictionary.h.

◆ insert() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::insert ( const CDictionary< Key, Value, Impl > & other)
inline

Insert all items of other dictionary into this dictionary.

Definition at line 417 of file dictionary.h.

◆ insert() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
iterator swift::misc::CDictionary< Key, Value, Impl >::insert ( const Key & key,
const Value & value )
inline

Insert new item with key and value.

Definition at line 414 of file dictionary.h.

◆ isEmpty()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
bool swift::misc::CDictionary< Key, Value, Impl >::isEmpty ( ) const
inline

Returns true if dictionary is empty.

Definition at line 426 of file dictionary.h.

◆ key() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const Key swift::misc::CDictionary< Key, Value, Impl >::key ( const Value & value) const
inline

Return key assigned to value.

Definition at line 429 of file dictionary.h.

◆ key() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const Key swift::misc::CDictionary< Key, Value, Impl >::key ( const Value & value,
const Key & defaultKey ) const
inline

Return key assigned to value or if key is not found defaultKey.

Definition at line 432 of file dictionary.h.

◆ keyBegin()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::keyBegin ( ) const
inline

Returns const iterator for iterating over keys.

Definition at line 354 of file dictionary.h.

◆ keyEnd()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::keyEnd ( ) const
inline

Returns const iterator for iterating over keys.

Definition at line 357 of file dictionary.h.

◆ keys()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::keys ( ) const
inline

Return a range of all keys (does not allocate a temporary container).

Definition at line 435 of file dictionary.h.

◆ keyValueBegin() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::keyValueBegin ( )
inline

Returns iterator for iterating over keys and values together.

Definition at line 360 of file dictionary.h.

◆ keyValueBegin() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::keyValueBegin ( ) const
inline

Returns const iterator for iterating over keys and values together.

Definition at line 366 of file dictionary.h.

◆ keyValueEnd() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::keyValueEnd ( )
inline

Returns iterator for iterating over keys and values together.

Definition at line 363 of file dictionary.h.

◆ keyValueEnd() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
auto swift::misc::CDictionary< Key, Value, Impl >::keyValueEnd ( ) const
inline

Returns const iterator for iterating over keys and values together.

Definition at line 372 of file dictionary.h.

◆ marshallToDbus()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::marshallToDbus ( QDBusArgument & argument) const
inline

Marshall without begin/endStructure, for when composed within another object.

Definition at line 504 of file dictionary.h.

◆ marshalToDataStream()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::marshalToDataStream ( QDataStream & stream) const
inline

Marshal a value to a QDataStream.

Definition at line 510 of file dictionary.h.

◆ operator=() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
CDictionary & swift::misc::CDictionary< Key, Value, Impl >::operator= ( CDictionary< Key, Value, Impl > && other)
inlinenoexcept

Move assignment.

Definition at line 463 of file dictionary.h.

◆ operator=() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
CDictionary & swift::misc::CDictionary< Key, Value, Impl >::operator= ( const CDictionary< Key, Value, Impl > & other)
inline

Copy assignment.

Definition at line 456 of file dictionary.h.

◆ operator[]() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
Value & swift::misc::CDictionary< Key, Value, Impl >::operator[] ( const Key & key)
inline

Access an element by its key.

Note
If dictionary does not contain any item with key, a default constructed value will be inserted.

Definition at line 477 of file dictionary.h.

◆ operator[]() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const Value swift::misc::CDictionary< Key, Value, Impl >::operator[] ( const Key & key) const
inline

Access an element by its key.

Definition at line 480 of file dictionary.h.

◆ remove()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
int swift::misc::CDictionary< Key, Value, Impl >::remove ( const Key & key)
inline

Remove all items with key from the dictionary.

Definition at line 438 of file dictionary.h.

◆ removeByKeyIf() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class MembFunc, class ReturnValue>
void swift::misc::CDictionary< Key, Value, Impl >::removeByKeyIf ( MembFunc membFunc,
ReturnValue returnValue )
inline

Remove elements for which key matches a particular pair.

Definition at line 241 of file dictionary.h.

◆ removeByKeyIf() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class Predicate>
void swift::misc::CDictionary< Key, Value, Impl >::removeByKeyIf ( Predicate p)
inline

Remove elements for which a given predicate for value returns true.

Definition at line 207 of file dictionary.h.

◆ removeByValueIf() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class MembFunc, class ReturnValue>
void swift::misc::CDictionary< Key, Value, Impl >::removeByValueIf ( MembFunc membFunc,
ReturnValue returnValue )
inline

Remove elements for which value matches a particular pair.

Definition at line 248 of file dictionary.h.

◆ removeByValueIf() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
template<class Predicate>
void swift::misc::CDictionary< Key, Value, Impl >::removeByValueIf ( Predicate p)
inline

Remove elements for which a given predicate for key returns true.

Definition at line 224 of file dictionary.h.

◆ removeDuplicates()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::removeDuplicates ( const CDictionary< Key, Value, Impl > & other)
inline

Remove elements for which the same key/value pair is present in an other dictionary.

Definition at line 254 of file dictionary.h.

◆ size()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
int swift::misc::CDictionary< Key, Value, Impl >::size ( ) const
inline

Returns the number of items in the hash.

Definition at line 441 of file dictionary.h.

◆ swap()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::swap ( CDictionary< Key, Value, Impl > & other)
inlinenoexcept

Swaps hash other with this hash. This operation is very fast and never fails.

Definition at line 444 of file dictionary.h.

◆ toJson()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
QJsonObject swift::misc::CDictionary< Key, Value, Impl >::toJson ( ) const
inline

Cast to JSON object.

Definition at line 271 of file dictionary.h.

◆ unmarshalFromDataStream()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::unmarshalFromDataStream ( QDataStream & stream)
inline

Unmarshal a value from a QDataStream.

Definition at line 513 of file dictionary.h.

◆ unmarshallFromDbus()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
void swift::misc::CDictionary< Key, Value, Impl >::unmarshallFromDbus ( const QDBusArgument & argument)
inline

Unmarshall without begin/endStructure, for when composed within another object.

Definition at line 507 of file dictionary.h.

◆ value() [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const Value swift::misc::CDictionary< Key, Value, Impl >::value ( const Key & key) const
inline

Returns the value associated with the key.

Definition at line 447 of file dictionary.h.

◆ value() [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const Value swift::misc::CDictionary< Key, Value, Impl >::value ( const Key & key,
const Value & defaultValue ) const
inline

Returns the value associated with the key or if key is not found defaultValue.

Definition at line 450 of file dictionary.h.

◆ values()

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
CRange< const_iterator > swift::misc::CDictionary< Key, Value, Impl >::values ( ) const
inline

Return a range of all values (does not allocate a temporary container).

Definition at line 453 of file dictionary.h.

◆ compare

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
int compare ( const CDictionary< Key, Value, Impl > & a,
const CDictionary< Key, Value, Impl > & b )
friend

Return negative, zero, or positive if a is less than, equal to, or greater than b.

Definition at line 83 of file dictionary.h.

◆ implementationOf [1/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
impl_type & implementationOf ( CDictionary< Key, Value, Impl > & dict)
friend

Return reference to the internal implementation object.

Definition at line 470 of file dictionary.h.

◆ implementationOf [2/2]

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
const impl_type & implementationOf ( const CDictionary< Key, Value, Impl > & dict)
friend

Return reference to the internal implementation object.

Definition at line 473 of file dictionary.h.

◆ operator!=

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
bool operator!= ( const CDictionary< Key, Value, Impl > & a,
const CDictionary< Key, Value, Impl > & b )
friend

Test for inequality.

Definition at line 486 of file dictionary.h.

◆ operator==

template<class Key, class Value, template< class... > class Impl = TDefaultAssociativeType>
bool operator== ( const CDictionary< Key, Value, Impl > & a,
const CDictionary< Key, Value, Impl > & b )
friend

Test for equality.

Definition at line 483 of file dictionary.h.


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