Key helper functions.
More...
#include <kdb.hpp>
#include <string>
#include <toolexcept.hpp>
|
| kdb |
| This is the main namespace for the C++ binding and libraries.
|
|
| kdb::tools |
| This namespace is for the libtool library.
|
|
Key helper functions.
- Copyright
- BSD License (see LICENSE.md or https://www.libelektra.org)
◆ commonKeyName()
Key kdb::tools::helper::commonKeyName |
( |
Key |
key1, |
|
|
Key |
key2 |
|
) |
| |
Find common name between two keys.
- Returns
- the longest common name found
◆ rebaseKey()
Key kdb::tools::helper::rebaseKey |
( |
const Key & |
key, |
|
|
const Key & |
oldParent, |
|
|
const Key & |
newParent |
|
) |
| |
Rebases the supplied key from the old parent to the new parent.
- See also
- ThreeWayMerge::rebasePath
- Parameters
-
key | the key to be rebased |
oldParent | the old parent of the key |
newParent | the new parent of the key |
- Returns
- a rebased copy of the supplied key
- Exceptions
-
InvalidRebaseException | if the key is not below the old parent |
◆ rebasePath()
string kdb::tools::helper::rebasePath |
( |
const Key & |
key, |
|
|
const Key & |
oldParent, |
|
|
const Key & |
newParent |
|
) |
| |
Rebases the relative path of the passed key from the old parent to the new parent and returns the new path.
For example a key /user/example/config/key1 with the oldparent /user/example and the new parent /user/newexample/newpath would result in /user/newexample/newpath/config/key1
If any of the parent keys is a cascading key the namespace of the key to be rebased is assumed instead.
- Parameters
-
key | the key whose path should be rebased |
oldParent | the old parent of the key |
newParent | the new parent of the key |
- Returns
- the rebased path
- Exceptions
-
InvalidRebaseException | if the key is not below the old parent |
◆ removeNamespace()
void kdb::tools::helper::removeNamespace |
( |
Key & |
key | ) |
|
Removes the namespace.
- Parameters
-
key | will be made to a cascading key |