swift
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
swift::misc::CValueCachePacket Class Reference

Value class used for signalling changed values in the cache. More...

Inheritance diagram for swift::misc::CValueCachePacket:
[legend]

Public Types

using base_type = CDictionary
 Base class. More...
 
- Public Types inherited from swift::misc::CDictionary< QString, std::pair< CVariant, qint64 >, QMap >
using impl_type = QMap< QString, std::pair< CVariant, qint64 > >
 The implementation container.
 
typedef QString key_type
 STL compatibility.
 
typedef std::pair< CVariant, qint64 > value_type
 STL compatibility.
 
typedef std::pair< CVariant, qint64 > & reference
 STL compatibility.
 
typedef const std::pair< CVariant, qint64 > & const_reference
 STL compatibility.
 
typedef QMap< QString, std::pair< CVariant, qint64 > >::size_type size_type
 STL compatibility.
 
typedef QMap< QString, std::pair< CVariant, qint64 > >::iterator iterator
 STL compatibility.
 
typedef QMap< QString, std::pair< CVariant, qint64 > >::const_iterator const_iterator
 STL compatibility.
 

Public Member Functions

 CValueCachePacket (bool saved=false, bool valuesChanged=true)
 Constructor.
 
 CValueCachePacket (const CVariantMap &values, qint64 timestamp, bool saved=false, bool valuesChanged=true)
 Construct from CVariantMap and a timestamp.
 
bool valuesChanged () const
 Values have been changed.
 
void insert (const QString &key, const CVariant &value, qint64 timestamp)
 Insert a key/value pair with a timestamp.
 
void insert (const CVariantMap &values, qint64 timestamp)
 Insert a CVariantMap with a timestamp.
 
void insert (const CValueCachePacket &other)
 Insert values from another packet.
 
CVariantMap toVariantMap () const
 Discard timestamps and return as variant map.
 
QMap< QString, qint64 > toTimestampMap () const
 Discard values and return as map of timestamps.
 
QString toTimestampMapString (const QStringList &keys) const
 Return map of timestamps converted to string.
 
void setTimestamps (const QMap< QString, qint64 > &)
 Change the timestamps of values.
 
CValueCachePacket takeByKey (const QString &key)
 Remove value matching the given key, and return it in a separate packet.
 
bool isSaved () const
 Values are to be saved.
 
void setSaved (bool saved=true)
 Values are to be saved.
 
const_iterator cbegin () const
 Iterators.
 
const_iterator cend () const
 Iterators.
 
const_iterator begin () const
 Iterators.
 
const_iterator end () const
 Iterators.
 
- Public Member Functions inherited from swift::misc::CDictionary< QString, std::pair< CVariant, qint64 >, QMap >
CDictionary findKeyBy (Predicate p) const
 Return a copy containing only those elements for which the dictionary keys return true for a given predicate.
 
CDictionary findKeyBy (Pairs... pairs) const
 Return a copy containing only those elements which key matches a particular pair. More...
 
CDictionary findValueBy (Predicate p) const
 Return a copy containing only those elements for which a given predicate returns true.
 
CDictionary findValueBy (Pairs... pairs) const
 Return a copy containing only those elements which value matches a particular pair. More...
 
bool containsByKey (Predicate p) const
 Return true if there is an element for which a given predicate returns true.
 
bool containsByKey (MembFunc membFunc, ReturnValue returnValue) const
 Return true if there is an element which key matches a given pair.
 
bool containsByValue (Predicate p) const
 Return true if there is an element for which a given predicate returns true.
 
bool containsByValue (MembFunc membFunc, ReturnValue returnValue) const
 Return true if there is an element which value matches a given pair.
 
void removeByKeyIf (Predicate p)
 Remove elements for which a given predicate for value returns true.
 
void removeByKeyIf (MembFunc membFunc, ReturnValue returnValue)
 Remove elements for which key matches a particular pair.
 
void removeByValueIf (Predicate p)
 Remove elements for which a given predicate for key returns true.
 
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. More...
 
void convertFromJson (const QJsonObject &json)
 Assign from JSON object. More...
 
 CDictionary ()
 Default constructor.
 
 CDictionary (std::initializer_list< std::pair< QString, std::pair< CVariant, qint64 > >> 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 keyValueBegin () const
 Returns const iterator for iterating over keys and values together.
 
auto keyValueEnd ()
 Returns iterator for iterating over keys and values together.
 
auto keyValueEnd () 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 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 QString &key) const
 Returns an const iterator pointing to the item with the key. More...
 
const_iterator find (const QString &key) const
 Returns an const iterator pointing to the item with the key. More...
 
iterator find (const QString &key)
 Returns an iterator pointing to the item with the key. More...
 
bool contains (const QString &key) const
 Returns true if dictionary contains an item with key, otherwise false.
 
int count (const QString &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 QString &key, const std::pair< CVariant, qint64 > &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 QString key (const std::pair< CVariant, qint64 > &value) const
 Return key assigned to value.
 
const QString key (const std::pair< CVariant, qint64 > &value, const QString &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 QString &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 std::pair< CVariant, qint64 > value (const QString &key) const
 Returns the value associated with the key.
 
const std::pair< CVariant, qint64 > value (const QString &key, const std::pair< CVariant, qint64 > &defaultValue) const
 Returns the value associated with the key or if key is not found defaultValue.
 
CRange< const_iteratorvalues () const
 Return a range of all values (does not allocate a temporary container)
 
CDictionaryoperator= (const CDictionary &other)
 Copy assignment.
 
CDictionaryoperator= (CDictionary &&other) noexcept
 Move assignment.
 
std::pair< CVariant, qint64 > & operator[] (const QString &key)
 Access an element by its key. More...
 
const std::pair< CVariant, qint64 > operator[] (const QString &key) const
 Access an element by its key.
 
QString convertToQString (bool i18n=false) const
 Cast as QString. More...
 
void marshallToDbus (QDBusArgument &argument) const
 Marshall without begin/endStructure, for when composed within another object. More...
 
void unmarshallFromDbus (const QDBusArgument &argument)
 Unmarshall without begin/endStructure, for when composed within another object. More...
 
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream. More...
 
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream. More...
 
- Public Member Functions inherited from swift::misc::mixin::String< Derived >
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.
 
- Public Member Functions inherited from swift::misc::mixin::MetaType< CValueCachePacket >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object. More...
 
QString getClassName () const
 Class name.
 
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
 
- Public Member Functions inherited from swift::misc::mixin::DBusByMetaClass< CValueCachePacket >
void marshallToDbus (QDBusArgument &arg, Tags...) const
 Marshall without begin/endStructure, for when composed within another object.
 
void unmarshallFromDbus (const QDBusArgument &arg, Tags...)
 Unmarshall without begin/endStructure, for when composed within another object.
 
- Public Member Functions inherited from swift::misc::mixin::DataStreamByMetaClass< CValueCachePacket >
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
 
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
 

Static Public Member Functions

static void registerMetadata ()
 Register metadata. More...
 
- Static Public Member Functions inherited from swift::misc::mixin::MetaType< CValueCachePacket >
static void registerMetadata ()
 Register metadata.
 

Detailed Description

Value class used for signalling changed values in the cache.

Definition at line 61 of file valuecache.h.

Member Typedef Documentation

◆ base_type

Base class.

Definition at line 73 of file valuecache.h.

Member Function Documentation

◆ registerMetadata()

static void swift::misc::CValueCachePacket::registerMetadata ( )
static

Register metadata.


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