\hypertarget{keyhelper_8cpp}{}\section{keyhelper.\+cpp File Reference}
\label{keyhelper_8cpp}\index{keyhelper.\+cpp@{keyhelper.\+cpp}}


Key helper functions.  


{\ttfamily \#include $<$helper/keyhelper.\+hpp$>$}\newline
Include dependency graph for keyhelper.\+cpp\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{keyhelper_8cpp__incl}
\end{center}
\end{figure}
\subsection*{Namespaces}
\begin{DoxyCompactItemize}
\item 
 \hyperlink{namespacekdb}{kdb}
\begin{DoxyCompactList}\small\item\em This is the main namespace for the C++ binding and libraries. \end{DoxyCompactList}\item 
 \hyperlink{namespacekdb_1_1tools}{kdb\+::tools}
\begin{DoxyCompactList}\small\item\em This namespace is for the libtool library. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
std\+::string \hyperlink{keyhelper_8hpp_ac74dd10f924fa6ed1700d998e010ce90}{kdb\+::tools\+::helper\+::rebase\+Path} (const Key \&key, const Key \&old\+Parent, const Key \&new\+Parent)
\begin{DoxyCompactList}\small\item\em Rebases the relative path of the passed key from the old parent to the new parent and returns the new path. \end{DoxyCompactList}\item 
Key \hyperlink{keyhelper_8hpp_a200ebec872fa549afb18d3987d9e55c0}{kdb\+::tools\+::helper\+::rebase\+Key} (const Key \&key, const Key \&old\+Parent, const Key \&new\+Parent)
\begin{DoxyCompactList}\small\item\em Rebases the supplied key from the old parent to the new parent. \end{DoxyCompactList}\item 
void \hyperlink{keyhelper_8hpp_a16f2181281153b9c60966c9169299e75}{kdb\+::tools\+::helper\+::remove\+Namespace} (Key \&key)
\begin{DoxyCompactList}\small\item\em Removes the namespace. \end{DoxyCompactList}\item 
Key \hyperlink{keyhelper_8hpp_a57892f5d89188bc7dfa44ff198bd7484}{kdb\+::tools\+::helper\+::prepend\+Namespace} (Key const \&root, std\+::string const \&ns)
\begin{DoxyCompactList}\small\item\em Prepends the namespace to the key. \end{DoxyCompactList}\item 
Key\+Set \hyperlink{keyhelper_8hpp_a0395dc4aa13ca356604634c919d431e8}{kdb\+::tools\+::helper\+::prepend\+Namespace} (Key\+Set const \&result\+Keys, std\+::string const \&ns)
\begin{DoxyCompactList}\small\item\em Prepends the namespace to each key of the key set. \end{DoxyCompactList}\item 
void \hyperlink{keyhelper_8hpp_a11066abc4f138f960d7c692937853008}{kdb\+::tools\+::helper\+::copy\+All\+Meta} (Key\+Set \&to, Key\+Set const \&from)
\begin{DoxyCompactList}\small\item\em Copies all metadata of each key in from to their pendant in to. \end{DoxyCompactList}\item 
Key \hyperlink{keyhelper_8hpp_a2e218ea33cf77a9ff9eeb65395f405f0}{kdb\+::tools\+::helper\+::common\+Key\+Name} (Key key1, Key key2)
\begin{DoxyCompactList}\small\item\em Find common name between two keys. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Key helper functions. 

\begin{DoxyCopyright}{Copyright}
B\+SD License (see L\+I\+C\+E\+N\+S\+E.\+md or \href{https://www.libelektra.org}{\tt https\+://www.\+libelektra.\+org}) 
\end{DoxyCopyright}


\subsection{Function Documentation}
\mbox{\Hypertarget{keyhelper_8hpp_file_a2e218ea33cf77a9ff9eeb65395f405f0}\label{keyhelper_8hpp_file_a2e218ea33cf77a9ff9eeb65395f405f0}} 
\index{keyhelper.\+cpp@{keyhelper.\+cpp}!common\+Key\+Name@{common\+Key\+Name}}
\index{common\+Key\+Name@{common\+Key\+Name}!keyhelper.\+cpp@{keyhelper.\+cpp}}
\subsubsection{\texorpdfstring{common\+Key\+Name()}{commonKeyName()}}
{\footnotesize\ttfamily Key kdb\+::tools\+::helper\+::common\+Key\+Name (\begin{DoxyParamCaption}\item[{\hyperlink{classkdb_1_1Key}{Key}}]{key1,  }\item[{\hyperlink{classkdb_1_1Key}{Key}}]{key2 }\end{DoxyParamCaption})}



Find common name between two keys. 

\begin{DoxyReturn}{Returns}
the longest common name found 
\end{DoxyReturn}
\mbox{\Hypertarget{keyhelper_8hpp_file_a11066abc4f138f960d7c692937853008}\label{keyhelper_8hpp_file_a11066abc4f138f960d7c692937853008}} 
\index{keyhelper.\+cpp@{keyhelper.\+cpp}!copy\+All\+Meta@{copy\+All\+Meta}}
\index{copy\+All\+Meta@{copy\+All\+Meta}!keyhelper.\+cpp@{keyhelper.\+cpp}}
\subsubsection{\texorpdfstring{copy\+All\+Meta()}{copyAllMeta()}}
{\footnotesize\ttfamily void kdb\+::tools\+::helper\+::copy\+All\+Meta (\begin{DoxyParamCaption}\item[{\hyperlink{classkdb_1_1KeySet}{Key\+Set} \&}]{to,  }\item[{\hyperlink{classkdb_1_1KeySet}{Key\+Set} const \&}]{from }\end{DoxyParamCaption})}



Copies all metadata of each key in from to their pendant in to. 

The pendant is determined by ks\+Lookup.


\begin{DoxyParams}{Parameters}
{\em to} & metadata is copied to keys in this key set \\
\hline
{\em from} & metadata is copied from keys in this key set \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{keyhelper_8hpp_file_a57892f5d89188bc7dfa44ff198bd7484}\label{keyhelper_8hpp_file_a57892f5d89188bc7dfa44ff198bd7484}} 
\index{keyhelper.\+cpp@{keyhelper.\+cpp}!prepend\+Namespace@{prepend\+Namespace}}
\index{prepend\+Namespace@{prepend\+Namespace}!keyhelper.\+cpp@{keyhelper.\+cpp}}
\subsubsection{\texorpdfstring{prepend\+Namespace()}{prependNamespace()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Key kdb\+::tools\+::helper\+::prepend\+Namespace (\begin{DoxyParamCaption}\item[{\hyperlink{classkdb_1_1Key}{Key} const \&}]{root,  }\item[{std\+::string const \&}]{ns }\end{DoxyParamCaption})}



Prepends the namespace to the key. 


\begin{DoxyParams}{Parameters}
{\em root} & is the key where the namespace will be prepended \\
\hline
{\em ns} & is the namespace to be prepended \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a duplicate of root with the new namespace 
\end{DoxyReturn}
\mbox{\Hypertarget{keyhelper_8hpp_file_a0395dc4aa13ca356604634c919d431e8}\label{keyhelper_8hpp_file_a0395dc4aa13ca356604634c919d431e8}} 
\index{keyhelper.\+cpp@{keyhelper.\+cpp}!prepend\+Namespace@{prepend\+Namespace}}
\index{prepend\+Namespace@{prepend\+Namespace}!keyhelper.\+cpp@{keyhelper.\+cpp}}
\subsubsection{\texorpdfstring{prepend\+Namespace()}{prependNamespace()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Key\+Set kdb\+::tools\+::helper\+::prepend\+Namespace (\begin{DoxyParamCaption}\item[{\hyperlink{classkdb_1_1KeySet}{Key\+Set} const \&}]{result\+Keys,  }\item[{std\+::string const \&}]{ns }\end{DoxyParamCaption})}



Prepends the namespace to each key of the key set. 


\begin{DoxyParams}{Parameters}
{\em result\+Keys} & which keys to prepend the namepsace to \\
\hline
{\em ns} & is the namespace to be prepended to each key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a keyset where each key has the new namespace 
\end{DoxyReturn}
\mbox{\Hypertarget{keyhelper_8hpp_file_a200ebec872fa549afb18d3987d9e55c0}\label{keyhelper_8hpp_file_a200ebec872fa549afb18d3987d9e55c0}} 
\index{keyhelper.\+cpp@{keyhelper.\+cpp}!rebase\+Key@{rebase\+Key}}
\index{rebase\+Key@{rebase\+Key}!keyhelper.\+cpp@{keyhelper.\+cpp}}
\subsubsection{\texorpdfstring{rebase\+Key()}{rebaseKey()}}
{\footnotesize\ttfamily Key kdb\+::tools\+::helper\+::rebase\+Key (\begin{DoxyParamCaption}\item[{const \hyperlink{classkdb_1_1Key}{Key} \&}]{key,  }\item[{const \hyperlink{classkdb_1_1Key}{Key} \&}]{old\+Parent,  }\item[{const \hyperlink{classkdb_1_1Key}{Key} \&}]{new\+Parent }\end{DoxyParamCaption})}



Rebases the supplied key from the old parent to the new parent. 

\begin{DoxySeeAlso}{See also}
Three\+Way\+Merge\+::rebase\+Path 
\end{DoxySeeAlso}

\begin{DoxyParams}{Parameters}
{\em key} & the key to be rebased \\
\hline
{\em old\+Parent} & the old parent of the key \\
\hline
{\em new\+Parent} & the new parent of the key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a rebased copy of the supplied key 
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em Invalid\+Rebase\+Exception} & if the key is not below the old parent \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{keyhelper_8hpp_file_ac74dd10f924fa6ed1700d998e010ce90}\label{keyhelper_8hpp_file_ac74dd10f924fa6ed1700d998e010ce90}} 
\index{keyhelper.\+cpp@{keyhelper.\+cpp}!rebase\+Path@{rebase\+Path}}
\index{rebase\+Path@{rebase\+Path}!keyhelper.\+cpp@{keyhelper.\+cpp}}
\subsubsection{\texorpdfstring{rebase\+Path()}{rebasePath()}}
{\footnotesize\ttfamily string kdb\+::tools\+::helper\+::rebase\+Path (\begin{DoxyParamCaption}\item[{const \hyperlink{classkdb_1_1Key}{Key} \&}]{key,  }\item[{const \hyperlink{classkdb_1_1Key}{Key} \&}]{old\+Parent,  }\item[{const \hyperlink{classkdb_1_1Key}{Key} \&}]{new\+Parent }\end{DoxyParamCaption})}



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.


\begin{DoxyParams}{Parameters}
{\em key} & the key whose path should be rebased \\
\hline
{\em old\+Parent} & the old parent of the key \\
\hline
{\em new\+Parent} & the new parent of the key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the rebased path 
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em Invalid\+Rebase\+Exception} & if the key is not below the old parent \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{keyhelper_8hpp_file_a16f2181281153b9c60966c9169299e75}\label{keyhelper_8hpp_file_a16f2181281153b9c60966c9169299e75}} 
\index{keyhelper.\+cpp@{keyhelper.\+cpp}!remove\+Namespace@{remove\+Namespace}}
\index{remove\+Namespace@{remove\+Namespace}!keyhelper.\+cpp@{keyhelper.\+cpp}}
\subsubsection{\texorpdfstring{remove\+Namespace()}{removeNamespace()}}
{\footnotesize\ttfamily void kdb\+::tools\+::helper\+::remove\+Namespace (\begin{DoxyParamCaption}\item[{\hyperlink{classkdb_1_1Key}{Key} \&}]{key }\end{DoxyParamCaption})}



Removes the namespace. 


\begin{DoxyParams}{Parameters}
{\em key} & will be made to a cascading key \\
\hline
\end{DoxyParams}
