$darkmode
Elektra 0.11.0
Public Member Functions | Static Public Member Functions | List of all members
kdb::ElektraDiff Class Reference

This class is a wrapper around the ElektraDiff C struct. More...

#include <elektradiff.hpp>

Public Member Functions

 ElektraDiff (ckdb::ElektraDiff *cdiff)
 Constructs a diff out of a C diff. More...
 
 ElektraDiff (ElektraDiff &other)
 Takes a reference of another diff. More...
 
 ElektraDiff (ElektraDiff const &other)
 Takes a reference of another diff. More...
 
void undo (KeySet &ks)
 Undo the changes represented in this diff. More...
 
void operator++ (int) const
 
void operator++ () const
 
void operator-- (int) const
 
void operator-- () const
 
ckdb::ElektraDiff * getDiff () const
 Passes out the raw diff pointer. More...
 
ckdb::ElektraDiff * operator* () const
 Passes out the raw diff pointer. More...
 
ElektraDiffoperator= (const ElektraDiff &other)
 Assign a diff. More...
 
uint16_t getReferenceCounter () const
 
void removeOther (std::string const &parentKeyName)
 
void removeOther (const Key &parentKey)
 
void removeSameOrBelow (std::string const &cutpointName)
 
void removeSameOrBelow (const Key &cutpoint)
 
void removeKey (std::string const &keyName)
 
void removeKey (const Key &key)
 
ElektraDiff cut (std::string const &cutpointName)
 
ElektraDiff cut (const Key &cutpoint)
 
ElektraDiff dup () const
 
bool isEmpty () const
 
KeySet getAddedKeys () const
 
KeySet getModifiedKeys () const
 
KeySet getRemovedKeys () const
 
KeySet getAddedMetaKeys (std::string const &keyName) const
 
KeySet getAddedMetaKeys (const Key &key) const
 
KeySet getModifiedMetaKeys (std::string const &keyName) const
 
KeySet getModifiedMetaKeys (const Key &key) const
 
KeySet getRemovedMetaKeys (std::string const &keyName) const
 
KeySet getRemovedMetaKeys (const Key &key) const
 

Static Public Member Functions

static ElektraDiff calculateDiff (const KeySet &newKeys, const KeySet &oldKeys, const std::string &parentKeyName)
 Calculates the difference between the given keysets The diff will contain the keys that were added, modified and removed in newKeys. More...
 
static ElektraDiff calculateDiff (const KeySet &newKeys, const KeySet &oldKeys, const Key &parentKey)
 Calculates the difference between the given keysets The diff will contain the keys that were added, modified and removed in newKeys. More...
 

Detailed Description

This class is a wrapper around the ElektraDiff C struct.

Invariant
always holds an underlying ElektraDiff C object.

Constructor & Destructor Documentation

kdb::ElektraDiff::ElektraDiff ( ckdb::ElektraDiff *  cdiff)
inlineexplicit

Constructs a diff out of a C diff.

Parameters
cdiffthe diff to work with
kdb::ElektraDiff::ElektraDiff ( ElektraDiff other)
inline

Takes a reference of another diff.

The diff will not be copied, but the reference counter will be increased.

Parameters
otherthe diff to work with
kdb::ElektraDiff::ElektraDiff ( ElektraDiff const &  other)
inline

Takes a reference of another diff.

The diff will not be copied, but the reference counter will be increased.

Parameters
otherthe diff to work with

Member Function Documentation

ElektraDiff kdb::ElektraDiff::calculateDiff ( const KeySet newKeys,
const KeySet oldKeys,
const std::string &  parentKeyName 
)
inlinestatic

Calculates the difference between the given keysets The diff will contain the keys that were added, modified and removed in newKeys.

Parameters
newKeysthe new keyset
oldKeysthe old keyset
parentKeyNameonly changes same or below this key will be calculated
Returns
diff of the two given keysets
ElektraDiff kdb::ElektraDiff::calculateDiff ( const KeySet newKeys,
const KeySet oldKeys,
const Key parentKey 
)
inlinestatic

Calculates the difference between the given keysets The diff will contain the keys that were added, modified and removed in newKeys.

Parameters
newKeysthe new keyset
oldKeysthe old keyset
parentKeyonly changes same or below this key will be calculated
Returns
diff of the two given keysets
ElektraDiff kdb::ElektraDiff::cut ( std::string const &  cutpointName)
inline

ElektraDiff kdb::ElektraDiff::cut ( const Key cutpoint)
inline

ElektraDiff kdb::ElektraDiff::dup ( ) const
inline

KeySet kdb::ElektraDiff::getAddedKeys ( ) const
inline

KeySet kdb::ElektraDiff::getAddedMetaKeys ( std::string const &  keyName) const
inline

KeySet kdb::ElektraDiff::getAddedMetaKeys ( const Key key) const
inline

ckdb::ElektraDiff * kdb::ElektraDiff::getDiff ( ) const
inline

Passes out the raw diff pointer.

This pointer can be used to directly change the underlying diff object.

Note
that the ownership remains in the object
KeySet kdb::ElektraDiff::getModifiedKeys ( ) const
inline

KeySet kdb::ElektraDiff::getModifiedMetaKeys ( std::string const &  keyName) const
inline

KeySet kdb::ElektraDiff::getModifiedMetaKeys ( const Key key) const
inline

uint16_t kdb::ElektraDiff::getReferenceCounter ( ) const
inline

KeySet kdb::ElektraDiff::getRemovedKeys ( ) const
inline

KeySet kdb::ElektraDiff::getRemovedMetaKeys ( std::string const &  keyName) const
inline

KeySet kdb::ElektraDiff::getRemovedMetaKeys ( const Key key) const
inline

bool kdb::ElektraDiff::isEmpty ( ) const
inline

ckdb::ElektraDiff * kdb::ElektraDiff::operator* ( ) const
inline

Passes out the raw diff pointer.

This pointer can be used to directly change the underlying diff object.

Note
that the ownership remains in the object
void kdb::ElektraDiff::operator++ ( int  ) const
inline

void kdb::ElektraDiff::operator++ ( ) const
inline

void kdb::ElektraDiff::operator-- ( int  ) const
inline

void kdb::ElektraDiff::operator-- ( ) const
inline

ElektraDiff & kdb::ElektraDiff::operator= ( const ElektraDiff other)
inline

Assign a diff.

Parameters
otherthe diff to assign
Returns
reference to this
void kdb::ElektraDiff::removeKey ( std::string const &  keyName)
inline

void kdb::ElektraDiff::removeKey ( const Key key)
inline

void kdb::ElektraDiff::removeOther ( std::string const &  parentKeyName)
inline

void kdb::ElektraDiff::removeOther ( const Key parentKey)
inline

void kdb::ElektraDiff::removeSameOrBelow ( std::string const &  cutpointName)
inline

void kdb::ElektraDiff::removeSameOrBelow ( const Key cutpoint)
inline

void kdb::ElektraDiff::undo ( KeySet ks)
inline

Undo the changes represented in this diff.

Parameters
ksthe keyset where the changs should be undone

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