$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

◆ ElektraDiff() [1/3]

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

Constructs a diff out of a C diff.

Parameters
cdiffthe diff to work with

◆ ElektraDiff() [2/3]

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

◆ ElektraDiff() [3/3]

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

◆ calculateDiff() [1/2]

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

◆ calculateDiff() [2/2]

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

◆ cut() [1/2]

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

◆ cut() [2/2]

ElektraDiff kdb::ElektraDiff::cut ( std::string const &  cutpointName)
inline

◆ dup()

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

◆ getAddedKeys()

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

◆ getAddedMetaKeys() [1/2]

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

◆ getAddedMetaKeys() [2/2]

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

◆ getDiff()

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

◆ getModifiedKeys()

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

◆ getModifiedMetaKeys() [1/2]

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

◆ getModifiedMetaKeys() [2/2]

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

◆ getReferenceCounter()

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

◆ getRemovedKeys()

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

◆ getRemovedMetaKeys() [1/2]

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

◆ getRemovedMetaKeys() [2/2]

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

◆ isEmpty()

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

◆ operator*()

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

◆ operator++() [1/2]

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

◆ operator++() [2/2]

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

◆ operator--() [1/2]

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

◆ operator--() [2/2]

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

◆ operator=()

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

Assign a diff.

Parameters
otherthe diff to assign
Returns
reference to this

◆ removeKey() [1/2]

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

◆ removeKey() [2/2]

void kdb::ElektraDiff::removeKey ( std::string const &  keyName)
inline

◆ removeOther() [1/2]

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

◆ removeOther() [2/2]

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

◆ removeSameOrBelow() [1/2]

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

◆ removeSameOrBelow() [2/2]

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

◆ undo()

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: