\hypertarget{classkdb_1_1Key}{}\doxysection{kdb\+::Key Class Reference}
\label{classkdb_1_1Key}\index{kdb::Key@{kdb::Key}}


\mbox{\hyperlink{classkdb_1_1Key}{Key}} is an essential class that encapsulates key \mbox{\hyperlink{group__keyname}{name }}, \mbox{\hyperlink{group__keyvalue}{value }} and \mbox{\hyperlink{group__keymeta}{metainfo }}.  




{\ttfamily \#include $<$key.\+hpp$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} ()
\begin{DoxyCompactList}\small\item\em Constructs a key with the name {\ttfamily /}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key_a41ada34fa45a270e63444267621b59c9}{Key}} (ckdb\+::\+Key $\ast$k)
\begin{DoxyCompactList}\small\item\em Constructs a key out of a C key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key_a33f63e153a7d832a54e02c0cba569feb}{Key}} (\mbox{\hyperlink{classkdb_1_1Key}{Key}} \&k)
\begin{DoxyCompactList}\small\item\em Takes a reference of another key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key_ab68da8be743b2f635ff8e28dfaeaaea6}{Key}} (\mbox{\hyperlink{classkdb_1_1Key}{Key}} const \&k)
\begin{DoxyCompactList}\small\item\em Takes a reference of another key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key_a15b2e9e1cc323cde05b0d1d3805656e0}{Key}} (const char $\ast$\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name}},...)
\begin{DoxyCompactList}\small\item\em A practical way to fully create a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object in one step. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key_acbf7642258d46da2c4427f4104cf01ee}{Key}} (const std\+::string \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name}},...)
\begin{DoxyCompactList}\small\item\em A practical way to fully create a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object in one step. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key_aa0dc94c7e676a0d280e5817e4c6238d3}{Key}} (const char $\ast$\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name}}, va\+\_\+list ap)
\begin{DoxyCompactList}\small\item\em A practical way to fully create a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object in one step. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a1e3c8da218a6a6e9f832f70772bcdc6f}{operator++}} (int) const
\begin{DoxyCompactList}\small\item\em Increment the reference counter of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a325367f8c2291b373ff6a9aa011bc29d}{operator++}} () const
\begin{DoxyCompactList}\small\item\em Increment the reference counter of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_ad282e5dc18bf0e74a086fe63f4dc3b57}{operator-\/-\/}} (int) const
\begin{DoxyCompactList}\small\item\em Decrement the reference counter of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a21958cf1d6b697fc12a9b4f77336e050}{operator-\/-\/}} () const
\begin{DoxyCompactList}\small\item\em Decrement the reference counter of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. \end{DoxyCompactList}\item 
ssize\+\_\+t \mbox{\hyperlink{classkdb_1_1Key_ae050f835e06aa0ecb828315e1fdb63ea}{get\+Reference\+Counter}} () const
\begin{DoxyCompactList}\small\item\em Return how many references the \mbox{\hyperlink{classkdb_1_1Key}{Key}} has. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key}{Key}} \& \mbox{\hyperlink{classkdb_1_1Key_a628f3ee543a1d71d4488233018eddd86}{operator=}} (ckdb\+::\+Key $\ast$k)
\begin{DoxyCompactList}\small\item\em Assign a C key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key}{Key}} \& \mbox{\hyperlink{classkdb_1_1Key_a63a006c140cfd2a633c6fdf3f9eb9d1a}{operator=}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&k)
\begin{DoxyCompactList}\small\item\em Assign a key. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&other, \mbox{\hyperlink{group__key_ga9ff42b1e9a97222562bfda3dd1f8c735}{elektra\+Copy\+Flags}} flags=\mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\+\_\+\+CP\+\_\+\+ALL}})
\begin{DoxyCompactList}\small\item\em Copy or clear a key. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a33a112681b0b2e94e6d369c0f89e361b}{clear}} ()
\begin{DoxyCompactList}\small\item\em Clears/\+Invalidates a key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key}{Key}} $\ast$ \mbox{\hyperlink{classkdb_1_1Key_ab64ec9d578e083dad3e43322535cf108}{operator-\/$>$}} ()
\item 
ckdb\+::\+Key $\ast$ \mbox{\hyperlink{classkdb_1_1Key_a6be9b3bb17434fd4362d137183d51100}{get\+Key}} () const
\begin{DoxyCompactList}\small\item\em Passes out the raw key pointer. \end{DoxyCompactList}\item 
ckdb\+::\+Key $\ast$ \mbox{\hyperlink{classkdb_1_1Key_a66e5af2387ebb86efa465ba2e844cafd}{operator$\ast$}} () const
\begin{DoxyCompactList}\small\item\em Is an abbreviation for get\+Key. \end{DoxyCompactList}\item 
ckdb\+::\+Key $\ast$ \mbox{\hyperlink{classkdb_1_1Key_a9ae719043e6e99f5f3d6fb85837306f8}{release}} ()
\begin{DoxyCompactList}\small\item\em Passes out the raw key pointer and resets internal key handle. \end{DoxyCompactList}\item 
ckdb\+::\+Key $\ast$ \mbox{\hyperlink{classkdb_1_1Key_a51d5873239ba67ffd3b475522e647434}{dup}} (\mbox{\hyperlink{group__key_ga9ff42b1e9a97222562bfda3dd1f8c735}{elektra\+Copy\+Flags}} flags=\mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\+\_\+\+CP\+\_\+\+ALL}}) const
\item 
\mbox{\hyperlink{classkdb_1_1Key_a35dd6ae58d125a298e30aed13b15c1f4}{$\sim$\+Key}} ()
\begin{DoxyCompactList}\small\item\em Destructs the key. \end{DoxyCompactList}\item 
std\+::string \mbox{\hyperlink{classkdb_1_1Key_a6c1812730e9cb714893c9f9b1e503303}{get\+Name}} () const
\begin{DoxyCompactList}\small\item\em Returns a pointer to the abbreviated real internal {\ttfamily key} name. \end{DoxyCompactList}\item 
ssize\+\_\+t \mbox{\hyperlink{classkdb_1_1Key_a976627183cdc6835a969475e99ec8bc1}{get\+Name\+Size}} () const
\begin{DoxyCompactList}\small\item\em Bytes needed to store the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name (excluding owner). \end{DoxyCompactList}\item 
std\+::string \mbox{\hyperlink{classkdb_1_1Key_ab998c6e1b121b956653f01df5762aed8}{get\+Base\+Name}} () const
\begin{DoxyCompactList}\small\item\em Returns a pointer to the unescaped \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name where the basename starts. \end{DoxyCompactList}\item 
ssize\+\_\+t \mbox{\hyperlink{classkdb_1_1Key_aef3cc0ef1621b91718604e899b43ebc0}{get\+Base\+Name\+Size}} () const
\begin{DoxyCompactList}\small\item\em Calculates number of bytes needed to store basename of {\ttfamily key} (including NULL terminator). \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_aac3b5d3a854d02187484bfbdbdf975af}{set\+Name}} (const std\+::string \&new\+Name)
\begin{DoxyCompactList}\small\item\em Set a new name to a \mbox{\hyperlink{classkdb_1_1Key}{Key}}. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a0c8c7cef03d6482d89973be72fb3c8b8}{set\+Base\+Name}} (const std\+::string \&base\+Name)
\begin{DoxyCompactList}\small\item\em Sets a base name for a key. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_ad2f72ce0985413ce588dc33a575ea306}{add\+Base\+Name}} (const std\+::string \&base\+Name)
\begin{DoxyCompactList}\small\item\em Adds a base name for a key. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_aec6af8723a31af40f9a16614ea46c341}{del\+Base\+Name}} ()
\begin{DoxyCompactList}\small\item\em Delete the base\+Name of a key. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_ae52e7f4c4461db5356ddeef64a870cad}{operator==}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&k) const
\begin{DoxyCompactList}\small\item\em Compare the name of two Keys. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a7cf40dd6e79e63765c9535a8fcee6491}{operator!=}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&k) const
\begin{DoxyCompactList}\small\item\em Compare the name of two Keys. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_aae9d359b54dc0df7d7b3ab3755a09732}{operator$<$}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&other) const
\begin{DoxyCompactList}\small\item\em Compare the name of two Keys. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_addb92d7d52f80fc0cafa40d60fe0564f}{operator$<$=}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&other) const
\begin{DoxyCompactList}\small\item\em Compare the name of two Keys. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_af616a48861b70b93e6f5955206c9257e}{operator$>$}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&other) const
\begin{DoxyCompactList}\small\item\em Compare the name of two Keys. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a4e711165a33a127d95f7102307e94bf6}{operator$>$=}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&other) const
\begin{DoxyCompactList}\small\item\em Compare the name of two Keys. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}{is\+Null}} () const
\begin{DoxyCompactList}\small\item\em Checks if C++ wrapper has an underlying key. \end{DoxyCompactList}\item 
\mbox{\hyperlink{classkdb_1_1Key_a15ee99e8447ee526d600e15938e4a1c0}{operator bool}} () const
\begin{DoxyCompactList}\small\item\em This is for loops and lookups only. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_add635e6194c7a05b7d4e470f7b135d9c}{need\+Sync}} () const
\begin{DoxyCompactList}\small\item\em Test if a key needs to be synced to backend storage. \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\T \mbox{\hyperlink{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}{get}} () const
\begin{DoxyCompactList}\small\item\em Get a key value. \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\void \mbox{\hyperlink{classkdb_1_1Key_a615124f0a2b291e03975b49c233654d7}{set}} (T x)
\begin{DoxyCompactList}\small\item\em Set a key value. \end{DoxyCompactList}\item 
std\+::string \mbox{\hyperlink{classkdb_1_1Key_af612ede3a73e57b317a65e40e7f9e01b}{get\+String}} () const
\item 
void \mbox{\hyperlink{classkdb_1_1Key_a18df1f7a447b999fae5faf32fc1ab893}{set\+String}} (const char $\ast$new\+String)
\begin{DoxyCompactList}\small\item\em Set the value for {\ttfamily key} as {\ttfamily new\+String\+Value}. \end{DoxyCompactList}\item 
ssize\+\_\+t \mbox{\hyperlink{classkdb_1_1Key_a4cfc9941a93a94b306b8264d0d21abc2}{get\+String\+Size}} () const
\begin{DoxyCompactList}\small\item\em Returns the number of bytes needed to store the key value, including the NULL terminator. \end{DoxyCompactList}\item 
func\+\_\+t \mbox{\hyperlink{classkdb_1_1Key_aa9643866a567ba5f012a3e9ab2a91721}{get\+Func}} () const
\begin{DoxyCompactList}\small\item\em Elektra can store function pointers as binary. \end{DoxyCompactList}\item 
const void $\ast$ \mbox{\hyperlink{classkdb_1_1Key_a444c6f254536196a7031288e9f4c3088}{get\+Value}} () const
\begin{DoxyCompactList}\small\item\em Return a pointer to the real internal {\ttfamily key} value. \end{DoxyCompactList}\item 
std\+::string \mbox{\hyperlink{classkdb_1_1Key_ada114aba31b321ddc984018b43a8568b}{get\+Binary}} () const
\begin{DoxyCompactList}\small\item\em Copy the binary value of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} into {\ttfamily returned\+Binary}. \end{DoxyCompactList}\item 
ssize\+\_\+t \mbox{\hyperlink{classkdb_1_1Key_af33a66e7b35c0ec6f9a65105257f21aa}{get\+Binary\+Size}} () const
\begin{DoxyCompactList}\small\item\em Returns the number of bytes needed to store the key value, including the NULL terminator. \end{DoxyCompactList}\item 
ssize\+\_\+t \mbox{\hyperlink{classkdb_1_1Key_af7211129a4b95f4d1e335dcd06e9bf0a}{set\+Binary}} (const void $\ast$new\+Binary, size\+\_\+t data\+Size)
\begin{DoxyCompactList}\small\item\em Set the value of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} to the binary value {\ttfamily new\+Binary}. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_ae3c3228bd66be9013a8d686e57aed64b}{has\+Meta}} (const std\+::string \&meta\+Name) const
\item 
{\footnotesize template$<$class T $>$ }\\T \mbox{\hyperlink{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}{get\+Meta}} (const std\+::string \&meta\+Name) const
\begin{DoxyCompactList}\small\item\em Returns the \mbox{\hyperlink{classkdb_1_1Key}{Key}} for a metadata entry with name {\ttfamily meta\+Name}. \end{DoxyCompactList}\item 
{\footnotesize template$<$class T $>$ }\\void \mbox{\hyperlink{classkdb_1_1Key_a4c5a3d463127ade0b766c4298002daa3}{set\+Meta}} (const std\+::string \&meta\+Name, T x)
\begin{DoxyCompactList}\small\item\em Set metadata for key. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a2305da805095605aca38d53f2733fb57}{del\+Meta}} (const std\+::string \&meta\+Name)
\begin{DoxyCompactList}\small\item\em Delete metadata for key. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a53f6d2196a7f17c4bdc544207bdc5f4c}{copy\+Meta}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&other, const std\+::string \&meta\+Name)
\begin{DoxyCompactList}\small\item\em Do a shallow copy of metadata with name {\ttfamily meta\+Name} from source to dest. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_aec0910bf293db33deac6a3f81359cb48}{copy\+All\+Meta}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&other)
\begin{DoxyCompactList}\small\item\em Do a shallow copy of all metadata from source to dest. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classkdb_1_1Key_a002af206119ceed17b106e2449cedc91}{rewind\+Meta}} ()
\begin{DoxyCompactList}\small\item\em Rewind the internal iterator to the first entry in metadata keyset. \end{DoxyCompactList}\item 
const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \mbox{\hyperlink{classkdb_1_1Key_a855f37fef58a4ea4006d9e281f66cfe1}{next\+Meta}} ()
\begin{DoxyCompactList}\small\item\em Get the next metadata entry of a \mbox{\hyperlink{classkdb_1_1Key}{Key}}. \end{DoxyCompactList}\item 
const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \mbox{\hyperlink{classkdb_1_1Key_a848292bf5591e5e845f74a487697cb19}{current\+Meta}} () const
\begin{DoxyCompactList}\small\item\em Returns the metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}} at the internal iterator\textquotesingle{}s current position. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}{is\+Valid}} () const
\item 
Elektra\+Namespace \mbox{\hyperlink{classkdb_1_1Key_aac012cf123370b4e7975984978c81419}{get\+Namespace}} () const
\item 
ssize\+\_\+t \mbox{\hyperlink{classkdb_1_1Key_a50586fabaaf3531ab19b0e9c03f08dcb}{set\+Namespace}} (Elektra\+Namespace ns) const
\begin{DoxyCompactList}\small\item\em Set the namespace of the key. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a024ecb6d7c87244fb83c3fee58a0d696}{is\+Cascading}} () const
\begin{DoxyCompactList}\small\item\em Determines if the key is in cascading namespace. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_acf01e9a60bbd0e2768be782d149ac700}{is\+Spec}} () const
\begin{DoxyCompactList}\small\item\em Determines if the key is in spec namespace. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_aa89cffb4d2a623920ff9abc086fde241}{is\+Proc}} () const
\begin{DoxyCompactList}\small\item\em Determines if the key is in proc namespace. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a0c60f261479e4e21cc5e9acd76c0d26b}{is\+Dir}} () const
\begin{DoxyCompactList}\small\item\em Determines if the key is in dir namespace. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a3b3d0d74246b259b10caed425216d91c}{is\+User}} () const
\begin{DoxyCompactList}\small\item\em Determines if the key is in user namespace. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a44833fb97b02ca58205c48d740c4cada}{is\+System}} () const
\begin{DoxyCompactList}\small\item\em Determines if the key is in system namespace. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a2170b1d9decef951b478454e3ee0b618}{is\+String}} () const
\begin{DoxyCompactList}\small\item\em Check if the value of {\ttfamily key} is of string type. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_ad748648cb25e2dc77972581e12a5b31c}{is\+Binary}} () const
\begin{DoxyCompactList}\small\item\em Check if the value of a {\ttfamily key} is of binary type. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a2ced1c67613e5024f22563318567ed67}{is\+Below}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&k) const
\begin{DoxyCompactList}\small\item\em Check if the \mbox{\hyperlink{classkdb_1_1Key}{Key}} {\ttfamily check} is below the \mbox{\hyperlink{classkdb_1_1Key}{Key}} {\ttfamily key} or not. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a501eda4871a57faf5f7588a372d8f9c4}{is\+Below\+Or\+Same}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&k) const
\begin{DoxyCompactList}\small\item\em Check if a key is below or same. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a6b7ce3736c89225445b7cc49d0e62bbe}{is\+Direct\+Below}} (const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&k) const
\begin{DoxyCompactList}\small\item\em Check whether the \mbox{\hyperlink{classkdb_1_1Key}{Key}} {\ttfamily check} is directly below the \mbox{\hyperlink{classkdb_1_1Key}{Key}} {\ttfamily key}. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a2b9d50da6ab7feed47eb5a80f039e91c}{is\+Name\+Locked}} () const
\item 
bool \mbox{\hyperlink{classkdb_1_1Key_a92daf058cb9896c7a926bddeecf179ef}{is\+Value\+Locked}} () const
\item 
bool \mbox{\hyperlink{classkdb_1_1Key_af499cd8c7d664818327c67624f1489e0}{is\+Meta\+Locked}} () const
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\mbox{\hyperlink{classkdb_1_1Key}{Key}} is an essential class that encapsulates key \mbox{\hyperlink{group__keyname}{name }}, \mbox{\hyperlink{group__keyvalue}{value }} and \mbox{\hyperlink{group__keymeta}{metainfo }}. 

To use it include\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <kdb.h>}}

\end{DoxyCode}


\mbox{\hyperlink{classkdb_1_1Key}{Key}} properties are\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__keyname}{Key name }}
\item \mbox{\hyperlink{group__keyvalue}{Key value }}
\item \mbox{\hyperlink{group__keymeta}{Key metadata }}, including but not limited to\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__meta_gafb89735689929ff717cc9f2d0d0b46a2}{Key comment }}
\item \mbox{\hyperlink{}{Key owner }}
\item \mbox{\hyperlink{group__keymeta}{UID, GID and filesystem-\/like mode permissions }}
\item \mbox{\hyperlink{group__keymeta}{Mode, change and modification times }}
\end{DoxyItemize}
\end{DoxyItemize}

\begin{DoxyParagraph}{ABI}
Due to ABI compatibility, the {\ttfamily \mbox{\hyperlink{classkdb_1_1Key}{Key}}} structure is not defined in kdb.\+h, only declared. So you can only declare {\ttfamily pointers} to {\ttfamily Keys} in your program, and allocate and free memory for them with \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} and \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} respectively.
\end{DoxyParagraph}
\begin{DoxyParagraph}{Reference Counting}
Every key has its reference counter (see \mbox{\hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()}} for longer explanation) that will be initialized with 0, that means a subsequent call of \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} will delete the key. If you append the key to a keyset the reference counter will be incremented by one (see \mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}}) and the key can\textquotesingle{}t be deleted by a \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}}.
\end{DoxyParagraph}
\begin{DoxyParagraph}{}
As you can imagine this refcounting allows you to put the \mbox{\hyperlink{classkdb_1_1Key}{Key}} in your own data structures. It can be a very powerful feature, e.\+g. if you need your own-\/defined ordering or different Models of your configuration.
\end{DoxyParagraph}
This class is an wrapper for an optional, refcounted ckdb\+::\+Key. It is like an shared\+\_\+ptr$<$ckdb\+::\+Key$>$, but the shared\+\_\+ptr functionality is already within the \mbox{\hyperlink{classkdb_1_1Key}{Key}} and exposed with this wrapper.

\begin{DoxyParagraph}{optional}
A key can be constructed with an null pointer, by using \mbox{\hyperlink{classkdb_1_1Key}{Key}} (static\+\_\+cast$<$ckdb\+::\+Key$\ast$$>$(0)); or made empty afterwards by using \mbox{\hyperlink{classkdb_1_1Key_a9ae719043e6e99f5f3d6fb85837306f8}{release()}} or assign a null key. To check if there is an associated managed object the user can use \mbox{\hyperlink{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}{is\+Null()}}.
\end{DoxyParagraph}
\begin{DoxyParagraph}{references}
Copies of keys are cheap because they are only flat. If you really need a deep copy, you can use \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy()}} or \mbox{\hyperlink{classkdb_1_1Key_a51d5873239ba67ffd3b475522e647434}{dup()}}. If you \mbox{\hyperlink{classkdb_1_1Key_a9ae719043e6e99f5f3d6fb85837306f8}{release()}} an object, the reference counter will stay All other operations operate on references.
\end{DoxyParagraph}
\begin{DoxyParagraph}{documentation}
Note that the documentation is typically copied from the underlying function which is wrapped and sometimes extended with C++ specific details. So you might find C examples within the C++ documentation.
\end{DoxyParagraph}
\begin{DoxyInvariant}{Invariant}
\mbox{\hyperlink{classkdb_1_1Key}{Key}} either has a working underlying Elektra \mbox{\hyperlink{classkdb_1_1Key}{Key}} object or a null pointer. The \mbox{\hyperlink{classkdb_1_1Key}{Key}}, however, might be invalid (see \mbox{\hyperlink{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}{is\+Valid()}}) or null (see \mbox{\hyperlink{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}{is\+Null()}}).
\end{DoxyInvariant}
\begin{DoxyNote}{Note}
that the reference counting in the keys is mutable, so that const keys can be passed around by value. 
\end{DoxyNote}


\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}\label{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}} 
\index{kdb::Key@{kdb::Key}!Key@{Key}}
\index{Key@{Key}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{Key()}{Key()}\hspace{0.1cm}{\footnotesize\ttfamily [1/7]}}
{\footnotesize\ttfamily kdb\+::\+Key\+::\+Key (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Constructs a key with the name {\ttfamily /}. 

\begin{DoxyNote}{Note}
That this is not a null key, so the key will evaluate to true.
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}{is\+Valid()}}, \mbox{\hyperlink{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}{is\+Null()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a41ada34fa45a270e63444267621b59c9}\label{classkdb_1_1Key_a41ada34fa45a270e63444267621b59c9}} 
\index{kdb::Key@{kdb::Key}!Key@{Key}}
\index{Key@{Key}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{Key()}{Key()}\hspace{0.1cm}{\footnotesize\ttfamily [2/7]}}
{\footnotesize\ttfamily kdb\+::\+Key\+::\+Key (\begin{DoxyParamCaption}\item[{ckdb\+::\+Key $\ast$}]{k }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Constructs a key out of a C key. 

\begin{DoxyNote}{Note}
If you pass a null pointer here, the key will evaluate to false.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em k} & the key to work with\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}{is\+Valid()}}, \mbox{\hyperlink{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}{is\+Null()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a33f63e153a7d832a54e02c0cba569feb}\label{classkdb_1_1Key_a33f63e153a7d832a54e02c0cba569feb}} 
\index{kdb::Key@{kdb::Key}!Key@{Key}}
\index{Key@{Key}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{Key()}{Key()}\hspace{0.1cm}{\footnotesize\ttfamily [3/7]}}
{\footnotesize\ttfamily kdb\+::\+Key\+::\+Key (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{k }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Takes a reference of another key. 

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


\begin{DoxyParams}{Parameters}
{\em k} & the key to work with \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classkdb_1_1Key_ab68da8be743b2f635ff8e28dfaeaaea6}\label{classkdb_1_1Key_ab68da8be743b2f635ff8e28dfaeaaea6}} 
\index{kdb::Key@{kdb::Key}!Key@{Key}}
\index{Key@{Key}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{Key()}{Key()}\hspace{0.1cm}{\footnotesize\ttfamily [4/7]}}
{\footnotesize\ttfamily kdb\+::\+Key\+::\+Key (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classkdb_1_1Key}{Key}} const \&}]{k }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Takes a reference of another key. 

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


\begin{DoxyParams}{Parameters}
{\em k} & the key to work with \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classkdb_1_1Key_a15b2e9e1cc323cde05b0d1d3805656e0}\label{classkdb_1_1Key_a15b2e9e1cc323cde05b0d1d3805656e0}} 
\index{kdb::Key@{kdb::Key}!Key@{Key}}
\index{Key@{Key}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{Key()}{Key()}\hspace{0.1cm}{\footnotesize\ttfamily [5/7]}}
{\footnotesize\ttfamily kdb\+::\+Key\+::\+Key (\begin{DoxyParamCaption}\item[{const char $\ast$}]{key\+Name,  }\item[{}]{... }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



A practical way to fully create a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object in one step. 

To just get a key object, simple do\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/some/example"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\textcolor{comment}{// work with it}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k);}

\end{DoxyCodeInclude}
 \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} allocates memory for a key object and \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} cleans everything up.

If you want the key object to contain a name, value, comment and other meta info read on.

\begin{DoxyNote}{Note}
When you already have a key with similar properties its easier to key\+Dup() the key.
\end{DoxyNote}
You can call \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} in many different ways depending on the attribute tags you pass as parameters. Tags are represented as \mbox{\hyperlink{group__key_ga9b703ca49f48b482def322b77d3e6bc8}{elektra\+Key\+Flags}} values, and tell \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} which \mbox{\hyperlink{classkdb_1_1Key}{Key}} attribute comes next. The \mbox{\hyperlink{classkdb_1_1Key}{Key}} attribute tags are the following\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\+\_\+\+VALUE}} ~\newline
 Next parameter is a pointer to the value that will be used. If no \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\+\_\+\+BINARY}} was used before, a string is assumed. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex0"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// set a string value}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\+\_\+\+SIZE}} ~\newline
 Define a maximum length of the value. This is only used when setting a binary key. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex1"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 4,               \textcolor{comment}{// has no effect on strings}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// set a string value}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\+\_\+\+META}} ~\newline
 Next two parameter is a metaname and a metavalue. See \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}}. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex3"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}comment"{}}, \textcolor{stringliteral}{"{}a comment"{}},  \textcolor{comment}{// with a comment}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}owner"{}}, \textcolor{stringliteral}{"{}root"{}},         \textcolor{comment}{// and an owner}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}special"{}}, \textcolor{stringliteral}{"{}yes"{}},        \textcolor{comment}{// and any other metadata}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\+\_\+\+END}} ~\newline
 Must be the last parameter passed to \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}. It is always required, unless the {\ttfamily key\+Name} is 0.
\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a4b83f86a07a7a0d6e24ecafe43cfea1b}{KEY\+\_\+\+FLAGS}} ~\newline
 Bitwise disjunction of flags, which don\textquotesingle{}t require one or more values. recommended way to set multiple flags. overrides previously defined flags. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex3"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},                   \textcolor{comment}{// binary key}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 7,                    \textcolor{comment}{// assume binary length 7}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},                \textcolor{comment}{// value that will be truncated in 7 bytes}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                        \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\+\_\+\+BINARY}} ~\newline
 Allows one to change the key to a binary key. Make sure that you also pass \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\+\_\+\+SIZE}} before you set the value. Otherwise it will be cut off with first \textbackslash{}0 in the string. So this flag toggle from \mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{key\+Set\+String()}} to \mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}}. If no value (nor size) is given, it will be a NULL key. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex2"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 4,               \textcolor{comment}{// now the size is important}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// sets the binary value ("{}some"{})}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}


\begin{DoxyRefDesc}{Deprecated}
\item[\mbox{\hyperlink{deprecated__deprecated000002}{Deprecated}}]The flags below are deprecated and \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\+\_\+\+META}} should be preferred. They remain some time, however, for compatibility\+: \end{DoxyRefDesc}

\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac29427bb47cc31689d02912e36161ee3}{KEY\+\_\+\+COMMENT}} ~\newline
 Next parameter is a comment. See \mbox{\hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()}}. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex4"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},                   \textcolor{comment}{// key type}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 7,                    \textcolor{comment}{// assume binary length 7}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},                \textcolor{comment}{// value that will be truncated in 7 bytes}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac29427bb47cc31689d02912e36161ee3}{KEY\_COMMENT}}, \textcolor{stringliteral}{"{}value is truncated"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                        \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}
 \begin{DoxyPrecond}{Precondition}
{\ttfamily name} is a valid \mbox{\hyperlink{classkdb_1_1Key}{Key}} name 

Variable arguments are a valid combination 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
returns a new, fully initialized \mbox{\hyperlink{classkdb_1_1Key}{Key}} object with the valid \mbox{\hyperlink{classkdb_1_1Key}{Key}} name and all data given by variable arguments
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em name} & a valid name to the key (see \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}})\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to a new allocated and initialized \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em NULL} & on allocation error or if an invalid {\ttfamily name} was passed (see \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}}).\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} for deallocating a created \mbox{\hyperlink{classkdb_1_1Key}{Key}} object 

\mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} for rules about which names are considered valid
\end{DoxySeeAlso}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Invalid\+Name} & if key could not be constructed\\
\hline
\end{DoxyExceptions}

\begin{DoxyParams}{Parameters}
{\em key\+Name} & the name of the new key \\
\hline
\end{DoxyParams}

\end{DoxyItemize}\mbox{\Hypertarget{classkdb_1_1Key_acbf7642258d46da2c4427f4104cf01ee}\label{classkdb_1_1Key_acbf7642258d46da2c4427f4104cf01ee}} 
\index{kdb::Key@{kdb::Key}!Key@{Key}}
\index{Key@{Key}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{Key()}{Key()}\hspace{0.1cm}{\footnotesize\ttfamily [6/7]}}
{\footnotesize\ttfamily kdb\+::\+Key\+::\+Key (\begin{DoxyParamCaption}\item[{const std\+::string}]{key\+Name,  }\item[{}]{... }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



A practical way to fully create a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object in one step. 

To just get a key object, simple do\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/some/example"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\textcolor{comment}{// work with it}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k);}

\end{DoxyCodeInclude}
 \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} allocates memory for a key object and \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} cleans everything up.

If you want the key object to contain a name, value, comment and other meta info read on.

\begin{DoxyNote}{Note}
When you already have a key with similar properties its easier to key\+Dup() the key.
\end{DoxyNote}
You can call \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} in many different ways depending on the attribute tags you pass as parameters. Tags are represented as \mbox{\hyperlink{group__key_ga9b703ca49f48b482def322b77d3e6bc8}{elektra\+Key\+Flags}} values, and tell \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} which \mbox{\hyperlink{classkdb_1_1Key}{Key}} attribute comes next. The \mbox{\hyperlink{classkdb_1_1Key}{Key}} attribute tags are the following\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\+\_\+\+VALUE}} ~\newline
 Next parameter is a pointer to the value that will be used. If no \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\+\_\+\+BINARY}} was used before, a string is assumed. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex0"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// set a string value}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\+\_\+\+SIZE}} ~\newline
 Define a maximum length of the value. This is only used when setting a binary key. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex1"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 4,               \textcolor{comment}{// has no effect on strings}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// set a string value}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\+\_\+\+META}} ~\newline
 Next two parameter is a metaname and a metavalue. See \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}}. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex3"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}comment"{}}, \textcolor{stringliteral}{"{}a comment"{}},  \textcolor{comment}{// with a comment}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}owner"{}}, \textcolor{stringliteral}{"{}root"{}},         \textcolor{comment}{// and an owner}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}special"{}}, \textcolor{stringliteral}{"{}yes"{}},        \textcolor{comment}{// and any other metadata}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\+\_\+\+END}} ~\newline
 Must be the last parameter passed to \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}. It is always required, unless the {\ttfamily key\+Name} is 0.
\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a4b83f86a07a7a0d6e24ecafe43cfea1b}{KEY\+\_\+\+FLAGS}} ~\newline
 Bitwise disjunction of flags, which don\textquotesingle{}t require one or more values. recommended way to set multiple flags. overrides previously defined flags. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex3"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},                   \textcolor{comment}{// binary key}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 7,                    \textcolor{comment}{// assume binary length 7}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},                \textcolor{comment}{// value that will be truncated in 7 bytes}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                        \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\+\_\+\+BINARY}} ~\newline
 Allows one to change the key to a binary key. Make sure that you also pass \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\+\_\+\+SIZE}} before you set the value. Otherwise it will be cut off with first \textbackslash{}0 in the string. So this flag toggle from \mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{key\+Set\+String()}} to \mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}}. If no value (nor size) is given, it will be a NULL key. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex2"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 4,               \textcolor{comment}{// now the size is important}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// sets the binary value ("{}some"{})}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}


\begin{DoxyRefDesc}{Deprecated}
\item[\mbox{\hyperlink{deprecated__deprecated000002}{Deprecated}}]The flags below are deprecated and \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\+\_\+\+META}} should be preferred. They remain some time, however, for compatibility\+: \end{DoxyRefDesc}

\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac29427bb47cc31689d02912e36161ee3}{KEY\+\_\+\+COMMENT}} ~\newline
 Next parameter is a comment. See \mbox{\hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()}}. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex4"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},                   \textcolor{comment}{// key type}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 7,                    \textcolor{comment}{// assume binary length 7}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},                \textcolor{comment}{// value that will be truncated in 7 bytes}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac29427bb47cc31689d02912e36161ee3}{KEY\_COMMENT}}, \textcolor{stringliteral}{"{}value is truncated"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                        \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}
 \begin{DoxyPrecond}{Precondition}
{\ttfamily name} is a valid \mbox{\hyperlink{classkdb_1_1Key}{Key}} name 

Variable arguments are a valid combination 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
returns a new, fully initialized \mbox{\hyperlink{classkdb_1_1Key}{Key}} object with the valid \mbox{\hyperlink{classkdb_1_1Key}{Key}} name and all data given by variable arguments
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em name} & a valid name to the key (see \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}})\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to a new allocated and initialized \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em NULL} & on allocation error or if an invalid {\ttfamily name} was passed (see \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}}).\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} for deallocating a created \mbox{\hyperlink{classkdb_1_1Key}{Key}} object 

\mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} for rules about which names are considered valid
\end{DoxySeeAlso}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Invalid\+Name} & if key could not be constructed\\
\hline
\end{DoxyExceptions}
\begin{DoxyWarning}{Warning}
Not supported on some compilers, e.\+g. clang which requires you to only pass non-\/\+POD in varg lists.
\end{DoxyWarning}

\begin{DoxyParams}{Parameters}
{\em key\+Name} & the name of the new key \\
\hline
\end{DoxyParams}

\end{DoxyItemize}\mbox{\Hypertarget{classkdb_1_1Key_aa0dc94c7e676a0d280e5817e4c6238d3}\label{classkdb_1_1Key_aa0dc94c7e676a0d280e5817e4c6238d3}} 
\index{kdb::Key@{kdb::Key}!Key@{Key}}
\index{Key@{Key}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{Key()}{Key()}\hspace{0.1cm}{\footnotesize\ttfamily [7/7]}}
{\footnotesize\ttfamily kdb\+::\+Key\+::\+Key (\begin{DoxyParamCaption}\item[{const char $\ast$}]{key\+Name,  }\item[{va\+\_\+list}]{ap }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [explicit]}}



A practical way to fully create a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object in one step. 

To just get a key object, simple do\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/some/example"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\textcolor{comment}{// work with it}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k);}

\end{DoxyCodeInclude}
 \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} allocates memory for a key object and \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} cleans everything up.

If you want the key object to contain a name, value, comment and other meta info read on.

\begin{DoxyNote}{Note}
When you already have a key with similar properties its easier to key\+Dup() the key.
\end{DoxyNote}
You can call \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} in many different ways depending on the attribute tags you pass as parameters. Tags are represented as \mbox{\hyperlink{group__key_ga9b703ca49f48b482def322b77d3e6bc8}{elektra\+Key\+Flags}} values, and tell \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} which \mbox{\hyperlink{classkdb_1_1Key}{Key}} attribute comes next. The \mbox{\hyperlink{classkdb_1_1Key}{Key}} attribute tags are the following\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\+\_\+\+VALUE}} ~\newline
 Next parameter is a pointer to the value that will be used. If no \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\+\_\+\+BINARY}} was used before, a string is assumed. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex0"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// set a string value}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\+\_\+\+SIZE}} ~\newline
 Define a maximum length of the value. This is only used when setting a binary key. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex1"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 4,               \textcolor{comment}{// has no effect on strings}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// set a string value}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\+\_\+\+META}} ~\newline
 Next two parameter is a metaname and a metavalue. See \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}}. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex3"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}comment"{}}, \textcolor{stringliteral}{"{}a comment"{}},  \textcolor{comment}{// with a comment}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}owner"{}}, \textcolor{stringliteral}{"{}root"{}},         \textcolor{comment}{// and an owner}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\_META}}, \textcolor{stringliteral}{"{}special"{}}, \textcolor{stringliteral}{"{}yes"{}},        \textcolor{comment}{// and any other metadata}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\+\_\+\+END}} ~\newline
 Must be the last parameter passed to \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}. It is always required, unless the {\ttfamily key\+Name} is 0.
\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a4b83f86a07a7a0d6e24ecafe43cfea1b}{KEY\+\_\+\+FLAGS}} ~\newline
 Bitwise disjunction of flags, which don\textquotesingle{}t require one or more values. recommended way to set multiple flags. overrides previously defined flags. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex3"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},                   \textcolor{comment}{// binary key}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 7,                    \textcolor{comment}{// assume binary length 7}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},                \textcolor{comment}{// value that will be truncated in 7 bytes}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                        \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\+\_\+\+BINARY}} ~\newline
 Allows one to change the key to a binary key. Make sure that you also pass \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\+\_\+\+SIZE}} before you set the value. Otherwise it will be cut off with first \textbackslash{}0 in the string. So this flag toggle from \mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{key\+Set\+String()}} to \mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}}. If no value (nor size) is given, it will be a NULL key. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{// Create and initialize a key with a name and nothing else}}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex2"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 4,               \textcolor{comment}{// now the size is important}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},    \textcolor{comment}{// sets the binary value ("{}some"{})}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                  \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}


\begin{DoxyRefDesc}{Deprecated}
\item[\mbox{\hyperlink{deprecated__deprecated000002}{Deprecated}}]The flags below are deprecated and \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a040582834bb2d90049947d7ef74e87e2}{KEY\+\_\+\+META}} should be preferred. They remain some time, however, for compatibility\+: \end{DoxyRefDesc}

\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}

\item \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac29427bb47cc31689d02912e36161ee3}{KEY\+\_\+\+COMMENT}} ~\newline
 Next parameter is a comment. See \mbox{\hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()}}. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/tmp/ex4"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}},                   \textcolor{comment}{// key type}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}}, 7,                    \textcolor{comment}{// assume binary length 7}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}}, \textcolor{stringliteral}{"{}some data"{}},                \textcolor{comment}{// value that will be truncated in 7 bytes}}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8ac29427bb47cc31689d02912e36161ee3}{KEY\_COMMENT}}, \textcolor{stringliteral}{"{}value is truncated"{}},}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});                        \textcolor{comment}{// end of args}}

\end{DoxyCodeInclude}
 \begin{DoxyPrecond}{Precondition}
{\ttfamily name} is a valid \mbox{\hyperlink{classkdb_1_1Key}{Key}} name 

Variable arguments are a valid combination 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
returns a new, fully initialized \mbox{\hyperlink{classkdb_1_1Key}{Key}} object with the valid \mbox{\hyperlink{classkdb_1_1Key}{Key}} name and all data given by variable arguments
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em name} & a valid name to the key (see \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}})\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to a new allocated and initialized \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em NULL} & on allocation error or if an invalid {\ttfamily name} was passed (see \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}}).\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} for deallocating a created \mbox{\hyperlink{classkdb_1_1Key}{Key}} object 

\mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} for rules about which names are considered valid
\end{DoxySeeAlso}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Invalid\+Name} & if key could not be constructed\\
\hline
\end{DoxyExceptions}

\begin{DoxyParams}{Parameters}
{\em key\+Name} & the name of the new key \\
\hline
{\em ap} & the variable argument list pointer \\
\hline
\end{DoxyParams}

\end{DoxyItemize}\mbox{\Hypertarget{classkdb_1_1Key_a35dd6ae58d125a298e30aed13b15c1f4}\label{classkdb_1_1Key_a35dd6ae58d125a298e30aed13b15c1f4}} 
\index{kdb::Key@{kdb::Key}!````~Key@{$\sim$Key}}
\index{````~Key@{$\sim$Key}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{$\sim$Key()}{~Key()}}
{\footnotesize\ttfamily kdb\+::\+Key\+::$\sim$\+Key (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Destructs the key. 

\begin{DoxySeeAlso}{See also}
del() 
\end{DoxySeeAlso}


\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classkdb_1_1Key_ad2f72ce0985413ce588dc33a575ea306}\label{classkdb_1_1Key_ad2f72ce0985413ce588dc33a575ea306}} 
\index{kdb::Key@{kdb::Key}!addBaseName@{addBaseName}}
\index{addBaseName@{addBaseName}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{addBaseName()}{addBaseName()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::add\+Base\+Name (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{base\+Name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Adds a base name for a key. 

Adds {\ttfamily base\+Name} to the name of {\ttfamily key}. {\ttfamily base\+Name} will be escaped before adding it to the name of {\ttfamily key}. No other part of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name will be affected.

Assumes that {\ttfamily key} is a directory and will append {\ttfamily base\+Name} to it. The function adds the path separator for concatenating.

If {\ttfamily key} has the name {\ttfamily \char`\"{}system\+:/dir1/dir2\char`\"{}} and this method is called with {\ttfamily base\+Name} {\ttfamily \char`\"{}mykey\char`\"{}}, the resulting key will have the name {\ttfamily \char`\"{}system\+:/dir1/dir2/mykey\char`\"{}}.

When {\ttfamily base\+Name} is 0, nothing will happen and the size of the name is returned.

The escaping rules apply as in \mbox{\hyperlink{group__keyname}{above }}.

A simple example is\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} * k = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/my/long"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{group__keyname_gaa942091fc4bd5c2699e49ddc50829524}{keyAddBaseName}} (k, \textcolor{stringliteral}{"{}myname"{}});}
\DoxyCodeLine{printf (\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}}, \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (k)); \textcolor{comment}{// will print user:/my/long/myname}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k);}

\end{DoxyCodeInclude}
 E.\+g. if you add . it will be escaped\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{keySetName}} (k, \textcolor{stringliteral}{"{}system:/valid"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keyname_gaa942091fc4bd5c2699e49ddc50829524}{keyAddBaseName}} (k, \textcolor{stringliteral}{"{}."{}}) >= 0, \textcolor{stringliteral}{"{}could not add a base name"{}});}
\DoxyCodeLine{        succeed\_if\_same\_string (\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (k), \textcolor{stringliteral}{"{}system:/valid/\(\backslash\)\(\backslash\)."{}});}
\DoxyCodeLine{        succeed\_if\_same\_string (\mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{keyBaseName}} (k), \textcolor{stringliteral}{"{}."{}});}

\end{DoxyCodeInclude}
 
\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} to add the basename to \\
\hline
{\em base\+Name} & the string to append to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the size in bytes of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s new name including the NULL terminator 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & if the \mbox{\hyperlink{classkdb_1_1Key}{Key}} has no name \\
\hline
{\em -\/1} & on NULL pointers \\
\hline
{\em -\/1} & if \mbox{\hyperlink{classkdb_1_1Key}{Key}} was inserted into \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}} before \\
\hline
{\em -\/1} & if the \mbox{\hyperlink{classkdb_1_1Key}{Key}} was read-\/only \\
\hline
{\em -\/1} & on memory allocation errors\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyname_ga6e804bd453f98c28b0ff51430d1df407}{key\+Set\+Base\+Name()}} for setting the basename of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} 

\mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} for setting the name of a \mbox{\hyperlink{group__key}{Key}}
\end{DoxySeeAlso}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Invalid\+Name} & if the name is not valid \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{classkdb_1_1Key_a33a112681b0b2e94e6d369c0f89e361b}\label{classkdb_1_1Key_a33a112681b0b2e94e6d369c0f89e361b}} 
\index{kdb::Key@{kdb::Key}!clear@{clear}}
\index{clear@{clear}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{clear()}{clear()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::clear (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Clears/\+Invalidates a key. 

Afterwards the object is empty again.

\begin{DoxyNote}{Note}
This is not a null key, so it will evaluate to true. \mbox{\hyperlink{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}{is\+Valid()}} will, however, be false.
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a9ae719043e6e99f5f3d6fb85837306f8}{release()}} 

\mbox{\hyperlink{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}{is\+Valid()}}, \mbox{\hyperlink{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}{is\+Null()}}
\end{DoxySeeAlso}
Will clear all internal data of a \mbox{\hyperlink{classkdb_1_1Key}{Key}}. After this call you will receive a fresh \mbox{\hyperlink{classkdb_1_1Key}{Key}} -\/ with no value, metadata or name.

The reference counter will stay unmodified.

\begin{DoxyNote}{Note}
that you might also \mbox{\hyperlink{classkdb_1_1Key_a33a112681b0b2e94e6d369c0f89e361b}{clear()}} all aliases with this operation.
\end{DoxyNote}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{int} f (\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_gab2242311a36bbc0520e0d36895107ec1}{keyClear}} (k);}
\DoxyCodeLine{        \textcolor{comment}{// you have a fresh Key k here}}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{keySetString}} (k, \textcolor{stringliteral}{"{}value"{}});}
\DoxyCodeLine{        \textcolor{comment}{// the caller will get an empty Key k with an value}}
\DoxyCodeLine{\}}

\end{DoxyCode}


\begin{DoxyPostcond}{Postcondition}
{\ttfamily key\textquotesingle{}s} name is \char`\"{}/\char`\"{} 

{\ttfamily key\textquotesingle{}s} metadata is empty
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} that should be cleared\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
{\em -\/1} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} for completely deleting a \mbox{\hyperlink{classkdb_1_1Key}{Key}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}\label{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}} 
\index{kdb::Key@{kdb::Key}!copy@{copy}}
\index{copy@{copy}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::copy (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{other,  }\item[{\mbox{\hyperlink{group__key_ga9ff42b1e9a97222562bfda3dd1f8c735}{elektra\+Copy\+Flags}}}]{flags = {\ttfamily \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\+\_\+\+CP\+\_\+\+ALL}}} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Copy or clear a key. 

Depending on the chosen {\ttfamily flags} \mbox{\hyperlink{group__key_ga505575ebef060066984fe0f590081e37}{key\+Copy()}} only copies certain parts of {\ttfamily source} into {\ttfamily dest}.


\begin{DoxyItemize}
\item If \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735ab41d70eb97ae5480333e85759318b5a9}{KEY\+\_\+\+CP\+\_\+\+NAME}} is set, the key name will be copied from {\ttfamily source} to {\ttfamily dest}.
\item If \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a6b8bdcae98a0f29d66a6b3d1651cbac6}{KEY\+\_\+\+CP\+\_\+\+META}} is set, the meta keys will be copied from {\ttfamily source} to {\ttfamily dest}.
\item If \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3043a92bfbe465ccff7624e54d89bcf8}{KEY\+\_\+\+CP\+\_\+\+VALUE}} is set, the key value will be copied from {\ttfamily source} to {\ttfamily dest}. Additionally, if {\ttfamily source} is a binary key (\mbox{\hyperlink{group__keytest_ga9526b371087564e43e3dff8ad0dac949}{key\+Is\+Binary()}}), {\ttfamily dest} will also be marked as binary. This means that even if \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a6b8bdcae98a0f29d66a6b3d1651cbac6}{KEY\+\_\+\+CP\+\_\+\+META}} is not set, the {\ttfamily binary} meta key will be copied with \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3043a92bfbe465ccff7624e54d89bcf8}{KEY\+\_\+\+CP\+\_\+\+VALUE}}.
\item If \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a57996652569a901d4e7e58c33f7b3631}{KEY\+\_\+\+CP\+\_\+\+STRING}} is set, the key value will be copied from {\ttfamily source} to {\ttfamily dest}, but only, if {\ttfamily source} is {\itshape not} a binary key (\mbox{\hyperlink{group__keytest_ga9526b371087564e43e3dff8ad0dac949}{key\+Is\+Binary()}}). If {\ttfamily source} is binary, \mbox{\hyperlink{group__key_ga505575ebef060066984fe0f590081e37}{key\+Copy()}} fails. If {\ttfamily dest} is binary, it will still be marked as binary after the copy. This cannot be used together with \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3043a92bfbe465ccff7624e54d89bcf8}{KEY\+\_\+\+CP\+\_\+\+VALUE}}. The main purpose of \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a57996652569a901d4e7e58c33f7b3631}{KEY\+\_\+\+CP\+\_\+\+STRING}} is for copying {\itshape into} known string keys. It ensure that you don\textquotesingle{}t accidentally convert string keys into binary keys.
\end{DoxyItemize}

There is also the shorthand \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\+\_\+\+CP\+\_\+\+ALL}}. It is equivalent to {\ttfamily KEY\+\_\+\+CP\+\_\+\+NAME $\vert$ KEY\+\_\+\+CP\+\_\+\+VALUE $\vert$ KEY\+\_\+\+CP\+\_\+\+META}, i.\+e. all key data supported by \mbox{\hyperlink{group__key_ga505575ebef060066984fe0f590081e37}{key\+Copy()}} will be copied from {\ttfamily source} to {\ttfamily dest}.

Use this function when you need to copy into an existing key, e.\+g. because it was passed by a pointer in a function you can do so\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga505575ebef060066984fe0f590081e37}{keyCopy}} (\mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}}, orig, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}

\end{DoxyCodeInclude}
 Most often you will want to duplicate an existing key. For this purpose the alias key\+Dup() exists. Calling


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} = keyDup (orig, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}

\end{DoxyCodeInclude}
 is equivalent to


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} = \mbox{\hyperlink{group__key_ga505575ebef060066984fe0f590081e37}{keyCopy}} (\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}/"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}), orig, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}

\end{DoxyCodeInclude}
 The reference counter will not be changed for both keys. Affiliation to keysets are also not affected.

Since metadata uses copy-\/on-\/write semantics there is only a constant memory cost to copying metadata.

When you pass a NULL-\/pointer as {\ttfamily source} the pieces of {\ttfamily dest} specified by {\ttfamily flags} will be cleared.

Calling {\ttfamily key\+Copy (dest, NULL, KEY\+\_\+\+CP\+\_\+\+ALL)} is different from calling \mbox{\hyperlink{group__key_gab2242311a36bbc0520e0d36895107ec1}{key\+Clear()}}. The key will not be fully reset, the reference counter and internal flags will remain unchanged. Additionally, \mbox{\hyperlink{group__key_ga505575ebef060066984fe0f590081e37}{key\+Copy()}} respects \mbox{\hyperlink{group__key_ga5e42b653a0f117be7f1f6eb06c569bb8}{key\+Lock()}} state, while \mbox{\hyperlink{group__key_gab2242311a36bbc0520e0d36895107ec1}{key\+Clear()}} always works.


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga505575ebef060066984fe0f590081e37}{keyCopy}} (k, NULL, \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\_CP\_ALL}});}
\DoxyCodeLine{\textcolor{comment}{// name, value and metadata of k have now been clear}}
\DoxyCodeLine{\textcolor{comment}{// lock flags, reference count, etc. remain unchanged}}

\end{DoxyCodeInclude}
 \begin{DoxyPrecond}{Precondition}
{\ttfamily dest} must be a valid \mbox{\hyperlink{classkdb_1_1Key}{Key}} (created with key\+New) 

{\ttfamily dest} must not have read-\/only flags set 

{\ttfamily source} must be a valid \mbox{\hyperlink{classkdb_1_1Key}{Key}} or NULL 
\end{DoxyPrecond}
\begin{DoxyInvariant}{Invariant}
\mbox{\hyperlink{classkdb_1_1Key}{Key}} name stays valid until delete 
\end{DoxyInvariant}
\begin{DoxyPostcond}{Postcondition}
Value from \mbox{\hyperlink{classkdb_1_1Key}{Key}} source is written to \mbox{\hyperlink{classkdb_1_1Key}{Key}} dest
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em dest} & the key which will be written to \\
\hline
{\em source} & the key which should be copied or NULL to clear the data of {\ttfamily dest} \\
\hline
{\em flags} & specifies which parts of the key should be copied\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
{\ttfamily dest} 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em NULL} & on memory allocation problems \\
\hline
{\em NULL} & when a part of {\ttfamily dest} that should be modified (e.\+g. name, value) was marked read-\/only, e.\+g. the name of {\ttfamily dest} will be read-\/only if {\ttfamily dest} is part of a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}} \\
\hline
{\em NULL} & when {\ttfamily dest} is NULL \\
\hline
{\em NULL} & when both \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3043a92bfbe465ccff7624e54d89bcf8}{KEY\+\_\+\+CP\+\_\+\+VALUE}} and \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a57996652569a901d4e7e58c33f7b3631}{KEY\+\_\+\+CP\+\_\+\+STRING}} are set in {\ttfamily flags} \\
\hline
{\em NULL} & when both \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a57996652569a901d4e7e58c33f7b3631}{KEY\+\_\+\+CP\+\_\+\+STRING}} is set in {\ttfamily flags} and {\ttfamily source} is a binary key (\mbox{\hyperlink{group__keytest_ga9526b371087564e43e3dff8ad0dac949}{key\+Is\+Binary()}})\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
0.\+9.\+5
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
key\+Dup() for duplicating an existing \mbox{\hyperlink{classkdb_1_1Key}{Key}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_aec0910bf293db33deac6a3f81359cb48}\label{classkdb_1_1Key_aec0910bf293db33deac6a3f81359cb48}} 
\index{kdb::Key@{kdb::Key}!copyAllMeta@{copyAllMeta}}
\index{copyAllMeta@{copyAllMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{copyAllMeta()}{copyAllMeta()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::copy\+All\+Meta (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{other }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Do a shallow copy of all metadata from source to dest. 

The key dest will additionally have all metadata the source had. Metadata not present in source will not be changed. Metadata which was present in source and dest will be overwritten. If the {\ttfamily dest} \mbox{\hyperlink{classkdb_1_1Key}{Key}} is read-\/only it will not be changed.

For example the metadata type is copied into the \mbox{\hyperlink{classkdb_1_1Key}{Key}} k\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keywordtype}{void} l (\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} * k)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        \textcolor{comment}{// receive copy}}
\DoxyCodeLine{        \mbox{\hyperlink{group__keymeta_ga8e63720a65610a29597494d0671f9401}{keyCopyAllMeta}} (k, \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}});}
\DoxyCodeLine{        \textcolor{comment}{// the caller will see the changed key k}}
\DoxyCodeLine{        \textcolor{comment}{// with all the metadata from copy}}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The main purpose of this function is for plugins or applications which want to add the same metadata to n keys. When you do that with \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}} it will take n times the memory for the key. This can be considerable amount of memory for many keys with some metadata for each.

To avoid that problem you can use \mbox{\hyperlink{group__keymeta_ga8e63720a65610a29597494d0671f9401}{key\+Copy\+All\+Meta()}} or \mbox{\hyperlink{group__keymeta_ga9a22b992478e613c8788bd460b4a1f0c}{key\+Copy\+Meta()}}\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{keywordtype}{void} o (KeySet * ks)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        \mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} * current;}
\DoxyCodeLine{        \mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} * shared = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}/"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{        \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{keySetMeta}} (shared, \textcolor{stringliteral}{"{}shared1"{}}, \textcolor{stringliteral}{"{}this metadata should be shared among many keys"{}});}
\DoxyCodeLine{        \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{keySetMeta}} (shared, \textcolor{stringliteral}{"{}shared2"{}}, \textcolor{stringliteral}{"{}this metadata should be shared among many keys also"{}});}
\DoxyCodeLine{        \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{keySetMeta}} (shared, \textcolor{stringliteral}{"{}shared3"{}}, \textcolor{stringliteral}{"{}this metadata should be shared among many keys too"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_gabe793ff51f1728e3429c84a8a9086b70}{ksRewind}} (ks);}
\DoxyCodeLine{        \textcolor{keywordflow}{while} ((current = \mbox{\hyperlink{group__keyset_ga317321c9065b5a4b3e33fe1c399bcec9}{ksNext}} (ks)) != 0)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                \textcolor{keywordflow}{if} (needsSharedData (current)) \mbox{\hyperlink{group__keymeta_ga8e63720a65610a29597494d0671f9401}{keyCopyAllMeta}} (current, shared);}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (shared);}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 \begin{DoxyPrecond}{Precondition}
{\ttfamily dest\textquotesingle{}s} metadata is not read-\/only 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
for every meta\+Name present in source\+: key\+Get\+Meta(source, meta\+Name) == key\+Get\+Meta(dest, meta\+Name)
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em dest} & the destination where the metadata should be copied too \\
\hline
{\em source} & the key where the metadata should be copied from\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & if metadata was successfully copied \\
\hline
{\em 0} & if source did not have any metadata \\
\hline
{\em -\/1} & on null pointer of dest or source \\
\hline
{\em -\/1} & on memory problems\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keymeta_ga9a22b992478e613c8788bd460b4a1f0c}{key\+Copy\+Meta()}} for copying one metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}} from {\ttfamily dest} to {\ttfamily source} 

\mbox{\hyperlink{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}{get\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a4c5a3d463127ade0b766c4298002daa3}{set\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a53f6d2196a7f17c4bdc544207bdc5f4c}{copy\+Meta()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a53f6d2196a7f17c4bdc544207bdc5f4c}\label{classkdb_1_1Key_a53f6d2196a7f17c4bdc544207bdc5f4c}} 
\index{kdb::Key@{kdb::Key}!copyMeta@{copyMeta}}
\index{copyMeta@{copyMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{copyMeta()}{copyMeta()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::copy\+Meta (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{other,  }\item[{const std\+::string \&}]{meta\+Name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Do a shallow copy of metadata with name {\ttfamily meta\+Name} from source to dest. 

Afterwards {\ttfamily source} and {\ttfamily dest} will have the same metadata referred with {\ttfamily meta\+Name}. If the \mbox{\hyperlink{classkdb_1_1Key}{Key}} with name {\ttfamily meta\+Name} doesn\textquotesingle{}t exist in {\ttfamily source} -\/ it gets deleted in {\ttfamily dest}.

For example the metadata type is copied into the \mbox{\hyperlink{classkdb_1_1Key}{Key}} k.


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{void} l(\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        \textcolor{comment}{// receive c}}
\DoxyCodeLine{        \mbox{\hyperlink{group__keymeta_ga9a22b992478e613c8788bd460b4a1f0c}{keyCopyMeta}}(k, c, \textcolor{stringliteral}{"{}type"{}});}
\DoxyCodeLine{        \textcolor{comment}{// the caller will see the changed key k}}
\DoxyCodeLine{        \textcolor{comment}{// with the metadata "{}type"{} from c}}
\DoxyCodeLine{\}}

\end{DoxyCode}


The main purpose of this function is for plugins or applications, which want to add the same metadata to n keys. When you do that \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}} will take n times the memory for the key. This can be a considerable amount of memory for many keys with some metadata for each.

To avoid that problem you can use \mbox{\hyperlink{group__keymeta_ga8e63720a65610a29597494d0671f9401}{key\+Copy\+All\+Meta()}} or \mbox{\hyperlink{group__keymeta_ga9a22b992478e613c8788bd460b4a1f0c}{key\+Copy\+Meta()}}.


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{void} o(KeySet *ks)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        \mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *current;}
\DoxyCodeLine{        \mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *shared = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}/"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{        \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{keySetMeta}}(shared, \textcolor{stringliteral}{"{}shared"{}}, \textcolor{stringliteral}{"{}this metadata should be shared among many keys"{}});}
\DoxyCodeLine{}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyset_gabe793ff51f1728e3429c84a8a9086b70}{ksRewind}}(ks);}
\DoxyCodeLine{        \textcolor{keywordflow}{while} ((current = \mbox{\hyperlink{group__keyset_ga317321c9065b5a4b3e33fe1c399bcec9}{ksNext}}(ks)) != 0)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                \textcolor{keywordflow}{if} (needs\_shared\_data(current)) \mbox{\hyperlink{group__keymeta_ga9a22b992478e613c8788bd460b4a1f0c}{keyCopyMeta}}(current, shared, \textcolor{stringliteral}{"{}shared"{}});}
\DoxyCodeLine{        \}}
\DoxyCodeLine{\}}

\end{DoxyCode}


\begin{DoxyPrecond}{Precondition}
{\ttfamily dest\textquotesingle{}s} metadata is not read-\/only 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
key\+Get\+Meta(source, meta\+Name) == key\+Get\+Meta(dest, meta\+Name)
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em dest} & the destination where the metadata should be copied to \\
\hline
{\em source} & the key where the metadata should be copied from \\
\hline
{\em meta\+Name} & the name of the metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}} which should be copied\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & if was successfully copied \\
\hline
{\em 0} & if the metadata in dest was removed too \\
\hline
{\em -\/1} & on null pointers (source or dest) \\
\hline
{\em -\/1} & on memory problems \\
\hline
{\em -\/1} & if metadata is read-\/only\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keymeta_ga8e63720a65610a29597494d0671f9401}{key\+Copy\+All\+Meta()}} copies all metadata from {\ttfamily dest} to {\ttfamily src} 

\mbox{\hyperlink{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}{get\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a4c5a3d463127ade0b766c4298002daa3}{set\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_aec0910bf293db33deac6a3f81359cb48}{copy\+All\+Meta()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a848292bf5591e5e845f74a487697cb19}\label{classkdb_1_1Key_a848292bf5591e5e845f74a487697cb19}} 
\index{kdb::Key@{kdb::Key}!currentMeta@{currentMeta}}
\index{currentMeta@{currentMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{currentMeta()}{currentMeta()}}
{\footnotesize\ttfamily const \mbox{\hyperlink{classkdb_1_1Key}{Key}} kdb\+::\+Key\+::current\+Meta (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Returns the metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}} at the internal iterator\textquotesingle{}s current position. 

The returned pointer is NULL if the end has been reached or after calling \mbox{\hyperlink{group__keyset_gabe793ff51f1728e3429c84a8a9086b70}{ks\+Rewind()}}.

\begin{DoxyNote}{Note}
You must not delete or change the returned key, use \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}} if you want to delete or change it.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em key} & \mbox{\hyperlink{classkdb_1_1Key}{Key}} to get the current metadata from\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a buffer to the value pointed by {\ttfamily key\textquotesingle{}s} cursor 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keymeta_ga4c88342f580a4291455a801af71ce048}{key\+Next\+Meta()}} for getting the next value 

\mbox{\hyperlink{group__keymeta_ga5dbb669802eea27e106ee3a5e39717a9}{key\+Rewind\+Meta()}} for rewinding the internal iterator 

\mbox{\hyperlink{group__keyset_ga4287b9416912c5f2ab9c195cb74fb094}{ks\+Current()}} Key\+Sets\textquotesingle{}s equivalent function for getting the current \mbox{\hyperlink{classkdb_1_1Key}{Key}}
\end{DoxySeeAlso}
\begin{DoxyNote}{Note}
that the key will be null if last metadata is found.
\end{DoxyNote}

\begin{DoxyCode}{0}
\DoxyCodeLine{k.rewindMeta();}
\DoxyCodeLine{\textcolor{keywordflow}{while} (meta = k.nextMeta())}
\DoxyCodeLine{\{}
\DoxyCodeLine{        cout << meta.getName() << \textcolor{stringliteral}{"{} "{}} << meta.getString() << endl;}
\DoxyCodeLine{\}}

\end{DoxyCode}


\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a002af206119ceed17b106e2449cedc91}{rewind\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a855f37fef58a4ea4006d9e281f66cfe1}{next\+Meta()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_aec6af8723a31af40f9a16614ea46c341}\label{classkdb_1_1Key_aec6af8723a31af40f9a16614ea46c341}} 
\index{kdb::Key@{kdb::Key}!delBaseName@{delBaseName}}
\index{delBaseName@{delBaseName}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{delBaseName()}{delBaseName()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::del\+Base\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Delete the base\+Name of a key. 


\begin{DoxyExceptions}{Exceptions}
{\em Key\+Invalid\+Name} & if the name is not valid \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{classkdb_1_1Key_a2305da805095605aca38d53f2733fb57}\label{classkdb_1_1Key_a2305da805095605aca38d53f2733fb57}} 
\index{kdb::Key@{kdb::Key}!delMeta@{delMeta}}
\index{delMeta@{delMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{delMeta()}{delMeta()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::del\+Meta (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{meta\+Name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Delete metadata for key. 

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a4c5a3d463127ade0b766c4298002daa3}{set\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}{get\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a53f6d2196a7f17c4bdc544207bdc5f4c}{copy\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_aec0910bf293db33deac6a3f81359cb48}{copy\+All\+Meta()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a51d5873239ba67ffd3b475522e647434}\label{classkdb_1_1Key_a51d5873239ba67ffd3b475522e647434}} 
\index{kdb::Key@{kdb::Key}!dup@{dup}}
\index{dup@{dup}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{dup()}{dup()}}
{\footnotesize\ttfamily ckdb\+::\+Key $\ast$ kdb\+::\+Key\+::dup (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__key_ga9ff42b1e9a97222562bfda3dd1f8c735}{elektra\+Copy\+Flags}}}]{flags = {\ttfamily \mbox{\hyperlink{group__key_gga9ff42b1e9a97222562bfda3dd1f8c735a3e04e17514f102f1e9217308d44e7612}{KEY\+\_\+\+CP\+\_\+\+ALL}}} }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}





\mbox{\Hypertarget{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}\label{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}} 
\index{kdb::Key@{kdb::Key}!get@{get}}
\index{get@{get}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{get()}{get()}}
{\footnotesize\ttfamily template$<$class T $>$ \\
T kdb\+::\+Key\+::get\hspace{0.3cm}{\ttfamily [inline]}}



Get a key value. 

You can write your own template specialication, e.\+g.\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keyword}{template} <>}
\DoxyCodeLine{\textcolor{keyword}{inline} QColor \mbox{\hyperlink{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}{Key::get}}()\textcolor{keyword}{ const}}
\DoxyCodeLine{\textcolor{keyword}{}\{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (\mbox{\hyperlink{classkdb_1_1Key_a4cfc9941a93a94b306b8264d0d21abc2}{getStringSize}}() < 1)}
\DoxyCodeLine{        \{}
\DoxyCodeLine{                \textcolor{keywordflow}{throw} KeyTypeConversion();}
\DoxyCodeLine{        \}}
\DoxyCodeLine{}
\DoxyCodeLine{        std::string str = \mbox{\hyperlink{classkdb_1_1Key_af612ede3a73e57b317a65e40e7f9e01b}{getString}}();}
\DoxyCodeLine{        QColor c(str.c\_str());}
\DoxyCodeLine{        \textcolor{keywordflow}{return} c;}
\DoxyCodeLine{\}}

\end{DoxyCode}


\begin{DoxyReturn}{Returns}
the string directly from the key.
\end{DoxyReturn}
It should be the same as \mbox{\hyperlink{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}{get()}}. \begin{DoxyReturn}{Returns}
empty string on null pointers
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Exception} & on null key or not a valid size \\
\hline
{\em Key\+Type\+Mismatch} & if key holds binary data and not a string\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
unlike in the C version, it is safe to change the returned string.
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a2170b1d9decef951b478454e3ee0b618}{is\+String()}}, \mbox{\hyperlink{classkdb_1_1Key_ada114aba31b321ddc984018b43a8568b}{get\+Binary()}}
\end{DoxySeeAlso}
This method tries to serialise the string to the given type. \mbox{\Hypertarget{classkdb_1_1Key_ab998c6e1b121b956653f01df5762aed8}\label{classkdb_1_1Key_ab998c6e1b121b956653f01df5762aed8}} 
\index{kdb::Key@{kdb::Key}!getBaseName@{getBaseName}}
\index{getBaseName@{getBaseName}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getBaseName()}{getBaseName()}}
{\footnotesize\ttfamily std\+::string kdb\+::\+Key\+::get\+Base\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Returns a pointer to the unescaped \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name where the basename starts. 

This is a much more efficient version of \mbox{\hyperlink{group__keyname_ga0992d26bcfca767cb8e77053a483eb64}{key\+Get\+Base\+Name()}} and you should use it if you are responsible enough to not mess up things. The name might change or even point to a wrong place after a \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}}. So make sure to copy the memory before the name changes.

\mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{key\+Base\+Name()}} returns \char`\"{}\char`\"{} when the \mbox{\hyperlink{classkdb_1_1Key}{Key}} has no basename. The reason is 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{keySetName}} (k, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{        succeed\_if\_same\_string (\mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{keyBaseName}} (k), \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{keySetName}} (k, \textcolor{stringliteral}{"{}user:/"{}});}
\DoxyCodeLine{        succeed\_if\_same\_string (\mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{keyBaseName}} (k), \textcolor{stringliteral}{"{}"{}});}

\end{DoxyCodeInclude}
 There is also support for really empty basenames\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{keySetName}} (k, \textcolor{stringliteral}{"{}system:/valid"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keyname_gaa942091fc4bd5c2699e49ddc50829524}{keyAddBaseName}} (k, \textcolor{stringliteral}{"{}"{}}) >= 0, \textcolor{stringliteral}{"{}could not add a base name"{}});}
\DoxyCodeLine{        succeed\_if\_same\_string (\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (k), \textcolor{stringliteral}{"{}system:/valid/\%"{}});}
\DoxyCodeLine{        succeed\_if\_same\_string (\mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{keyBaseName}} (k), \textcolor{stringliteral}{"{}"{}});}

\end{DoxyCodeInclude}
 \begin{DoxyNote}{Note}
You must never use the pointer returned by \mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{key\+Base\+Name()}} method to change the name. You should use \mbox{\hyperlink{group__keyname_ga6e804bd453f98c28b0ff51430d1df407}{key\+Set\+Base\+Name()}} instead.

Do not assume that \mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{key\+Base\+Name()}} points to the same region as \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} does.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} to obtain the basename from\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s basename 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em \char`\"{}\char`\"{}} & when the \mbox{\hyperlink{classkdb_1_1Key}{Key}} has no (base)name \\
\hline
{\em 0} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyname_ga0992d26bcfca767cb8e77053a483eb64}{key\+Get\+Base\+Name()}} for getting a \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s basename 

\mbox{\hyperlink{group__keyname_ga1a0b76c5d9e5367c7e72211e6c63d43a}{key\+Get\+Base\+Name\+Size()}} for getting the size of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s basename 

\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} for getting a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_aef3cc0ef1621b91718604e899b43ebc0}\label{classkdb_1_1Key_aef3cc0ef1621b91718604e899b43ebc0}} 
\index{kdb::Key@{kdb::Key}!getBaseNameSize@{getBaseNameSize}}
\index{getBaseNameSize@{getBaseNameSize}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getBaseNameSize()}{getBaseNameSize()}}
{\footnotesize\ttfamily ssize\+\_\+t kdb\+::\+Key\+::get\+Base\+Name\+Size (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Calculates number of bytes needed to store basename of {\ttfamily key} (including NULL terminator). 

\mbox{\hyperlink{classkdb_1_1Key}{Key}} names consisting of only root names (e.\+g. {\ttfamily \char`\"{}system\+:/\char`\"{}} or {\ttfamily \char`\"{}user\+:/\char`\"{}} or {\ttfamily \char`\"{}user\+:domain\char`\"{}} ) do not have basenames. In this case the function will return 1, because only a NULL terminator is needed for storage.

Basenames are denoted as\+:
\begin{DoxyItemize}
\item {\ttfamily system\+:/some/thing/basename} -\/$>$ {\ttfamily basename} 
\item {\ttfamily user\+:domain/some/thing/base\textbackslash{}/name} $>$ {\ttfamily base\textbackslash{}/name} 
\end{DoxyItemize}


\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} to get the size of the basename from\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size in bytes of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s basename including NULL terminator 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & if the \mbox{\hyperlink{classkdb_1_1Key}{Key}} or the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s basename is NULL\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{key\+Base\+Name()}} for getting a pointer to a \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s basename 

\mbox{\hyperlink{group__keyname_ga0992d26bcfca767cb8e77053a483eb64}{key\+Get\+Base\+Name()}} for getting a \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} of a \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s basename 

\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}}, \mbox{\hyperlink{group__keyname_gab29a850168d9b31c9529e90cf9ab68be}{key\+Get\+Name()}} for getting a pointer / \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} of the whole name 

\mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} for setting a \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_ada114aba31b321ddc984018b43a8568b}\label{classkdb_1_1Key_ada114aba31b321ddc984018b43a8568b}} 
\index{kdb::Key@{kdb::Key}!getBinary@{getBinary}}
\index{getBinary@{getBinary}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getBinary()}{getBinary()}}
{\footnotesize\ttfamily std\+::string kdb\+::\+Key\+::get\+Binary (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Copy the binary value of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} into {\ttfamily returned\+Binary}. 

\begin{DoxyReturn}{Returns}
the binary Value of the key.
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em \char`\"{}\char`\"{}} & on null pointers (size == 0) and on data only containing \textbackslash{}0\\
\hline
\end{DoxyRetVals}
\begin{DoxyNote}{Note}
if you need to distinguish between null pointers and data containing \textbackslash{}0 you can use \mbox{\hyperlink{classkdb_1_1Key_a444c6f254536196a7031288e9f4c3088}{get\+Value()}}.
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Exception} & on invalid binary size \\
\hline
{\em Key\+Type\+Mismatch} & if key is string and not a binary\\
\hline
\end{DoxyExceptions}
If the type is not binary -\/1 will be returned.

When the binary data is empty (this is not the same as \char`\"{}\char`\"{}!) 0 will be returned and {\ttfamily returned\+Binary} will not be changed.

For string values see \mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} and \mbox{\hyperlink{group__keytest_gaea7670778abd07fee0fe8ac12a149190}{key\+Is\+String()}}.

When {\ttfamily returned\+Binary} is too small to hold the data (maximum size is given by max\+Size), the returned\+Binary will not be changed and -\/1 is returned.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *key = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/keyname"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\textcolor{keywordtype}{char} buffer[300];}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordflow}{if} (\mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{keyGetBinary}}(key,buffer,\textcolor{keyword}{sizeof}(buffer)) == -\/1)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        \textcolor{comment}{// handle error}}
\DoxyCodeLine{\}}

\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object to get the binary value from \\
\hline
{\em returned\+Binary} & pre-\/allocated memory to store a copy of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value \\
\hline
{\em max\+Size} & number of bytes of pre-\/allocated memory in {\ttfamily returned\+Binary} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of bytes copied to {\ttfamily returned\+Binary} 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & if the binary is empty \\
\hline
{\em -\/1} & on NULL pointers \\
\hline
{\em -\/1} & if max\+Size is 0, too small for the value or larger than SSIZE\+\_\+\+MAX \\
\hline
{\em -\/1} & if the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value is a string\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{key\+Value()}} for getting a raw pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 

\mbox{\hyperlink{group__keyvalue_gae326672fffb7474abfe9baf53b73217e}{key\+Get\+Value\+Size()}} for getting the size of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 

\mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}} for setting the binary value of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} 

\mbox{\hyperlink{group__keytest_ga9526b371087564e43e3dff8ad0dac949}{key\+Is\+Binary()}} for checking whether a \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value is binary 

\mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}}, \mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{key\+Set\+String()}} for working with string values

\mbox{\hyperlink{classkdb_1_1Key_ad748648cb25e2dc77972581e12a5b31c}{is\+Binary()}}, \mbox{\hyperlink{classkdb_1_1Key_af612ede3a73e57b317a65e40e7f9e01b}{get\+String()}}, \mbox{\hyperlink{classkdb_1_1Key_a444c6f254536196a7031288e9f4c3088}{get\+Value()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_af33a66e7b35c0ec6f9a65105257f21aa}\label{classkdb_1_1Key_af33a66e7b35c0ec6f9a65105257f21aa}} 
\index{kdb::Key@{kdb::Key}!getBinarySize@{getBinarySize}}
\index{getBinarySize@{getBinarySize}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getBinarySize()}{getBinarySize()}}
{\footnotesize\ttfamily ssize\+\_\+t kdb\+::\+Key\+::get\+Binary\+Size (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Returns the number of bytes needed to store the key value, including the NULL terminator. 

It returns the correct size, independent of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} Type. If the value is binary there might be \textquotesingle{}\textbackslash{}0\textquotesingle{} values in it.

For an empty string you need one byte to store the ending NULL. For that reason 1 is returned. This is not true for binary data, so 0 will be returned.

A binary key has no \textquotesingle{}\textbackslash{}0\textquotesingle{} termination. String types are null-\/terminated, and the terminator will be considered for the length.

This method can be used with \mbox{\hyperlink{internal_8c_a35cdc2e5caed3454cb73b4fc7f37858c}{elektra\+Malloc()}} before \mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} or \mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}} is called.


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{char} *buffer;}
\DoxyCodeLine{buffer = \mbox{\hyperlink{internal_8c_a35cdc2e5caed3454cb73b4fc7f37858c}{elektraMalloc}} (\mbox{\hyperlink{group__keyvalue_gae326672fffb7474abfe9baf53b73217e}{keyGetValueSize}} (key));}
\DoxyCodeLine{\textcolor{comment}{// use this buffer to store the value (binary or string)}}
\DoxyCodeLine{\textcolor{comment}{// pass keyGetValueSize (key) for maxSize}}

\end{DoxyCode}


\begin{DoxyPostcond}{Postcondition}
returns the exact amount of bytes needed to store {\ttfamily key\textquotesingle{}s} value (including NULL terminators)
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object to get the size of the value from\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of bytes needed to store the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 1} & when there is no data and type is a string \\
\hline
{\em 0} & when there is no data and type is binary \\
\hline
{\em -\/1} & on null pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} for getting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as a string 

\mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}} for getting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as a binary 

\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{key\+Value()}} for getting a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_aa9643866a567ba5f012a3e9ab2a91721}\label{classkdb_1_1Key_aa9643866a567ba5f012a3e9ab2a91721}} 
\index{kdb::Key@{kdb::Key}!getFunc@{getFunc}}
\index{getFunc@{getFunc}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getFunc()}{getFunc()}}
{\footnotesize\ttfamily Key\+::func\+\_\+t kdb\+::\+Key\+::get\+Func (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Elektra can store function pointers as binary. 

This function returns such a function pointer.


\begin{DoxyExceptions}{Exceptions}
{\em Key\+Type\+Mismatch} & if no binary data found, or binary data has not correct length\\
\hline
\end{DoxyExceptions}
\begin{DoxyReturn}{Returns}
a function pointer stored with \mbox{\hyperlink{classkdb_1_1Key_af7211129a4b95f4d1e335dcd06e9bf0a}{set\+Binary()}} 
\end{DoxyReturn}
\mbox{\Hypertarget{classkdb_1_1Key_a6be9b3bb17434fd4362d137183d51100}\label{classkdb_1_1Key_a6be9b3bb17434fd4362d137183d51100}} 
\index{kdb::Key@{kdb::Key}!getKey@{getKey}}
\index{getKey@{getKey}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getKey()}{getKey()}}
{\footnotesize\ttfamily ckdb\+::\+Key $\ast$ kdb\+::\+Key\+::get\+Key (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Passes out the raw key pointer. 

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

\begin{DoxyNote}{Note}
that the ownership remains in the object 
\end{DoxyNote}
\mbox{\Hypertarget{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}\label{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}} 
\index{kdb::Key@{kdb::Key}!getMeta@{getMeta}}
\index{getMeta@{getMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getMeta()}{getMeta()}}
{\footnotesize\ttfamily template$<$class T $>$ \\
T kdb\+::\+Key\+::get\+Meta (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{meta\+Name }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Returns the \mbox{\hyperlink{classkdb_1_1Key}{Key}} for a metadata entry with name {\ttfamily meta\+Name}. 

You are not allowed to modify the resulting key.

If {\ttfamily meta\+Name} does not start with \textquotesingle{}meta\+:/\textquotesingle{}, it will be prefixed with \textquotesingle{}meta\+:/\textquotesingle{}.


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} metaData = \mbox{\hyperlink{group__keymeta_ga9ed3875495ddb3d8a8d29158a60a147c}{keyGetMeta}}(k, \textcolor{stringliteral}{"{}type"{}})}
\DoxyCodeLine{\textcolor{comment}{// keyType == "{}boolean"{}}}
\DoxyCodeLine{char keyType[] = \mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{keyValue}}(metaData)}

\end{DoxyCode}


\begin{DoxyNote}{Note}
You must not delete or change the returned key, use \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}} if you want to delete or change it.
\end{DoxyNote}
\begin{DoxyPrecond}{Precondition}
{\ttfamily key} contains metadata 

{\ttfamily meta\+Name} is prefixed with \char`\"{}meta\+:/\char`\"{}
\end{DoxyPrecond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} from which to get metadata \\
\hline
{\em meta\+Name} & the name of the meta information you want the \mbox{\hyperlink{classkdb_1_1Key}{Key}} from.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
value of meta-\/information if meta-\/information is found 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & if key or meta\+Name is NULL \\
\hline
{\em 0} & if no such meta\+Name is found\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}} for setting metadata 

\mbox{\hyperlink{group__keymeta_ga11706f1753e67933f7cffc5c0345cd29}{key\+Meta()}} for getting the \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}} containing metadata
\end{DoxySeeAlso}
You can specify your own template specialisation\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keyword}{template}<>}
\DoxyCodeLine{\textcolor{keyword}{inline} yourtype \mbox{\hyperlink{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}{Key::getMeta}}(\textcolor{keyword}{const} std::string \&name)\textcolor{keyword}{ const}}
\DoxyCodeLine{\textcolor{keyword}{}\{}
\DoxyCodeLine{        yourtype x;}
\DoxyCodeLine{        std::string str;}
\DoxyCodeLine{        str = std::string(}
\DoxyCodeLine{                \textcolor{keyword}{static\_cast<}\textcolor{keyword}{const }\textcolor{keywordtype}{char}*\textcolor{keyword}{>}(}
\DoxyCodeLine{                        \mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{ckdb::keyValue}}(}
\DoxyCodeLine{                                \mbox{\hyperlink{group__keymeta_ga9ed3875495ddb3d8a8d29158a60a147c}{ckdb::keyGetMeta}}(key, name.c\_str())}
\DoxyCodeLine{                                )}
\DoxyCodeLine{                        )}
\DoxyCodeLine{                );}
\DoxyCodeLine{        \textcolor{keywordflow}{return} yourconversion(str);}
\DoxyCodeLine{\}}

\end{DoxyCode}



\begin{DoxyExceptions}{Exceptions}
{\em Key\+Type\+Conversion} & if metadata could not be parsed\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
No exception will be thrown if a const \mbox{\hyperlink{classkdb_1_1Key}{Key}} or char$\ast$ is requested, but don\textquotesingle{}t forget the const\+: get\+Meta$<$const Key$>$, otherwise you will get an compiler error.
\end{DoxyNote}
If no meta is available\+:
\begin{DoxyItemize}
\item char$\ast$ is null (evaluates to 0)
\item const \mbox{\hyperlink{classkdb_1_1Key}{Key}} is null (evaluate to false)
\item otherwise the default constructed type will be returned \begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_ae3c3228bd66be9013a8d686e57aed64b}{has\+Meta}}

\mbox{\hyperlink{classkdb_1_1Key_a2305da805095605aca38d53f2733fb57}{del\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a4c5a3d463127ade0b766c4298002daa3}{set\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a53f6d2196a7f17c4bdc544207bdc5f4c}{copy\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_aec0910bf293db33deac6a3f81359cb48}{copy\+All\+Meta()}} 
\end{DoxySeeAlso}

\end{DoxyItemize}\mbox{\Hypertarget{classkdb_1_1Key_a6c1812730e9cb714893c9f9b1e503303}\label{classkdb_1_1Key_a6c1812730e9cb714893c9f9b1e503303}} 
\index{kdb::Key@{kdb::Key}!getName@{getName}}
\index{getName@{getName}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getName()}{getName()}}
{\footnotesize\ttfamily std\+::string kdb\+::\+Key\+::get\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Returns a pointer to the abbreviated real internal {\ttfamily key} name. 

This is a much more efficient version of \mbox{\hyperlink{group__keyname_gab29a850168d9b31c9529e90cf9ab68be}{key\+Get\+Name()}} and can use it if you are responsible enough to not mess up things. You are not allowed to change anything in the returned array. The content of that string may change after \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} and similar functions. If you need a copy of the name, consider using \mbox{\hyperlink{group__keyname_gab29a850168d9b31c9529e90cf9ab68be}{key\+Get\+Name()}}.


\begin{DoxyRetVals}{Return values}
{\em \char`\"{}\char`\"{}} & when there is no key\+Name. The reason is 
\begin{DoxyCode}{1}
\DoxyCodeLine{key=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(0);}
\DoxyCodeLine{\mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{keySetName}}(key,\textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}}(key); \textcolor{comment}{// you would expect "{}"{} here}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}}(key);}

\end{DoxyCode}
\\
\hline
\end{DoxyRetVals}
Valid key names are\+:


\begin{DoxyItemize}
\item {\ttfamily spec\+:/something} for specification of other keys.
\item {\ttfamily proc\+:/something} for in-\/memory keys, e.\+g. commandline.
\item {\ttfamily dir\+:/something} for dir keys in current working directory
\item {\ttfamily system\+:/something} for system keys in /etc or /
\item {\ttfamily user\+:/something} for user keys in home directory
\item {\ttfamily user\+:username/something} for other users (deprecated\+: \mbox{\hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}} + \mbox{\hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}} currently unsupported)
\item {\ttfamily /something} for cascading keys (actually refers to one of the above, see also \mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}})

\begin{DoxyNote}{Note}
Note that the \mbox{\hyperlink{classkdb_1_1Key}{Key}} structure keeps its own size field that is calculated by library internal calls, so to avoid inconsistencies, you must never use the pointer returned by \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} method to set a new value. Use \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} instead.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} you want to get the name from\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name which must not be changed. 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em \char`\"{}\char`\"{}} & when \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name is empty \\
\hline
{\em 0} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyname_gabdbcfa51ed8a387e47ead207affa2d2e}{key\+Get\+Name\+Size()}} for the string length 

\mbox{\hyperlink{group__keyname_gab29a850168d9b31c9529e90cf9ab68be}{key\+Get\+Name()}} as alternative to \mbox{\hyperlink{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}{get}} a \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} 

\mbox{\hyperlink{group__keyname_ga6fe6af4c27b35d911a533f4ae4d698bb}{key\+Unescaped\+Name}} to \mbox{\hyperlink{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}{get}} an unescaped \mbox{\hyperlink{group__key}{Key}} name
\end{DoxySeeAlso}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Exception} & if key is null\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
unlike in the C version, it is safe to change the returned string. 
\end{DoxyNote}

\end{DoxyItemize}\mbox{\Hypertarget{classkdb_1_1Key_a976627183cdc6835a969475e99ec8bc1}\label{classkdb_1_1Key_a976627183cdc6835a969475e99ec8bc1}} 
\index{kdb::Key@{kdb::Key}!getNameSize@{getNameSize}}
\index{getNameSize@{getNameSize}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getNameSize()}{getNameSize()}}
{\footnotesize\ttfamily ssize\+\_\+t kdb\+::\+Key\+::get\+Name\+Size (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Bytes needed to store the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name (excluding owner). 

For an empty \mbox{\hyperlink{classkdb_1_1Key}{Key}} name you need one byte to store the ending NULL. For that reason, 1 is returned when the name is empty.


\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} to get the name size from\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of bytes needed, including NULL terminator, to store \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name (excluding owner) 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 1} & if \mbox{\hyperlink{classkdb_1_1Key}{Key}} has no name \\
\hline
{\em -\/1} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyname_gab29a850168d9b31c9529e90cf9ab68be}{key\+Get\+Name()}} for getting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name 

\mbox{\hyperlink{group__keyname_ga5e7eff0c77678420199d0d2e8729152b}{key\+Get\+Unescaped\+Name\+Size()}} for getting the size of the unescaped name 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_aac012cf123370b4e7975984978c81419}\label{classkdb_1_1Key_aac012cf123370b4e7975984978c81419}} 
\index{kdb::Key@{kdb::Key}!getNamespace@{getNamespace}}
\index{getNamespace@{getNamespace}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getNamespace()}{getNamespace()}}
{\footnotesize\ttfamily Elektra\+Namespace kdb\+::\+Key\+::get\+Namespace (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

\begin{DoxyReturn}{Returns}
namespace of the key
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
Elektra\+Namespace, \mbox{\hyperlink{group__keyname_gafc3ca03ed10f87eb59bdc02cf2a0de8d}{key\+Get\+Namespace}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_ae050f835e06aa0ecb828315e1fdb63ea}\label{classkdb_1_1Key_ae050f835e06aa0ecb828315e1fdb63ea}} 
\index{kdb::Key@{kdb::Key}!getReferenceCounter@{getReferenceCounter}}
\index{getReferenceCounter@{getReferenceCounter}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getReferenceCounter()}{getReferenceCounter()}}
{\footnotesize\ttfamily ssize\+\_\+t kdb\+::\+Key\+::get\+Reference\+Counter (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Return how many references the \mbox{\hyperlink{classkdb_1_1Key}{Key}} has. 

The reference counting is the essential property of Keys to make sure that they can be put safely into data structures. E.\+g. if you put a \mbox{\hyperlink{classkdb_1_1Key}{Key}} into a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/proper\_name"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}); \textcolor{comment}{// ref counter = 0}}
\DoxyCodeLine{KeySet *ks = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}} (1, k, \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}}(k); \textcolor{comment}{// key will not be deleted, because its in the keyset}}
\DoxyCodeLine{\mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}}(ks); \textcolor{comment}{// now the key will be deleted}}

\end{DoxyCodeInclude}
 You can even add the \mbox{\hyperlink{classkdb_1_1Key}{Key}} to more Key\+Sets\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/proper\_name"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}); \textcolor{comment}{// ref counter 0}}
\DoxyCodeLine{KeySet *ks1 = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}}(1, k, \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}}); \textcolor{comment}{// ref counter of k 1}}
\DoxyCodeLine{KeySet *ks2 = \mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}}(1, k, \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}}); \textcolor{comment}{// ref counter of k 2}}
\DoxyCodeLine{\mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}}(ks1); \textcolor{comment}{// ref counter of k 1}}
\DoxyCodeLine{\mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}}(ks2); \textcolor{comment}{// k is now deleted}}

\end{DoxyCodeInclude}
 If you increment only by one with \mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}} the same as said above is valid\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}/"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}); \textcolor{comment}{// ref counter = 0}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{keyIncRef}}(k); \textcolor{comment}{// ref counter = 1}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}}(k); \textcolor{comment}{// key will not be deleted}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{keyDecRef}}(k);}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}}(k);}

\end{DoxyCodeInclude}
 or use \mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}} more than once\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}/"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}}); \textcolor{comment}{// ref counter 0}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{keyIncRef}}(k); \textcolor{comment}{// ref counter of key 1}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k);   \textcolor{comment}{// has no effect}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{keyIncRef}}(k); \textcolor{comment}{// ref counter of key 2}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k);   \textcolor{comment}{// has no effect}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{keyDecRef}}(k); \textcolor{comment}{// ref counter of key 1}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k);   \textcolor{comment}{// has no effect}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{keyDecRef}}(k); \textcolor{comment}{// ref counter is now 0}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k); \textcolor{comment}{// k is now deleted}}

\end{DoxyCodeInclude}
 The \mbox{\hyperlink{classkdb_1_1Key}{Key}} won\textquotesingle{}t be deleted by a \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} as long refcounter is not 0.

The references will be incremented on successful calls to \mbox{\hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ks\+Append\+Key()}} or \mbox{\hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()}}.

\begin{DoxyNote}{Note}
key\+Dup() will reset the references for duplicated Keys.
\end{DoxyNote}
For your own applications you can use \mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}} and \mbox{\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{key\+Dec\+Ref()}} for reference counting, too.


\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} whose reference counter to retrieve\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the value of the {\ttfamily key\textquotesingle{}s} reference counter 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}}, \mbox{\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{key\+Dec\+Ref()}} for increasing / decreasing the reference counter 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_af612ede3a73e57b317a65e40e7f9e01b}\label{classkdb_1_1Key_af612ede3a73e57b317a65e40e7f9e01b}} 
\index{kdb::Key@{kdb::Key}!getString@{getString}}
\index{getString@{getString}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getString()}{getString()}}
{\footnotesize\ttfamily std\+::string kdb\+::\+Key\+::get\+String (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

\begin{DoxyReturn}{Returns}
the string directly from the key.
\end{DoxyReturn}
It should be the same as \mbox{\hyperlink{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}{get()}}. \begin{DoxyReturn}{Returns}
empty string on null pointers
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Exception} & on null key or not a valid size \\
\hline
{\em Key\+Type\+Mismatch} & if key holds binary data and not a string\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
unlike in the C version, it is safe to change the returned string.
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a2170b1d9decef951b478454e3ee0b618}{is\+String()}}, \mbox{\hyperlink{classkdb_1_1Key_ada114aba31b321ddc984018b43a8568b}{get\+Binary()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a4cfc9941a93a94b306b8264d0d21abc2}\label{classkdb_1_1Key_a4cfc9941a93a94b306b8264d0d21abc2}} 
\index{kdb::Key@{kdb::Key}!getStringSize@{getStringSize}}
\index{getStringSize@{getStringSize}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getStringSize()}{getStringSize()}}
{\footnotesize\ttfamily ssize\+\_\+t kdb\+::\+Key\+::get\+String\+Size (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Returns the number of bytes needed to store the key value, including the NULL terminator. 

It returns the correct size, independent of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} Type. If the value is binary there might be \textquotesingle{}\textbackslash{}0\textquotesingle{} values in it.

For an empty string you need one byte to store the ending NULL. For that reason 1 is returned. This is not true for binary data, so 0 will be returned.

A binary key has no \textquotesingle{}\textbackslash{}0\textquotesingle{} termination. String types are null-\/terminated, and the terminator will be considered for the length.

This method can be used with \mbox{\hyperlink{internal_8c_a35cdc2e5caed3454cb73b4fc7f37858c}{elektra\+Malloc()}} before \mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} or \mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}} is called.


\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{char} *buffer;}
\DoxyCodeLine{buffer = \mbox{\hyperlink{internal_8c_a35cdc2e5caed3454cb73b4fc7f37858c}{elektraMalloc}} (\mbox{\hyperlink{group__keyvalue_gae326672fffb7474abfe9baf53b73217e}{keyGetValueSize}} (key));}
\DoxyCodeLine{\textcolor{comment}{// use this buffer to store the value (binary or string)}}
\DoxyCodeLine{\textcolor{comment}{// pass keyGetValueSize (key) for maxSize}}

\end{DoxyCode}


\begin{DoxyPostcond}{Postcondition}
returns the exact amount of bytes needed to store {\ttfamily key\textquotesingle{}s} value (including NULL terminators)
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object to get the size of the value from\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of bytes needed to store the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 1} & when there is no data and type is a string \\
\hline
{\em 0} & when there is no data and type is binary \\
\hline
{\em -\/1} & on null pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} for getting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as a string 

\mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}} for getting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as a binary 

\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{key\+Value()}} for getting a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a444c6f254536196a7031288e9f4c3088}\label{classkdb_1_1Key_a444c6f254536196a7031288e9f4c3088}} 
\index{kdb::Key@{kdb::Key}!getValue@{getValue}}
\index{getValue@{getValue}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{getValue()}{getValue()}}
{\footnotesize\ttfamily const void $\ast$ kdb\+::\+Key\+::get\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Return a pointer to the real internal {\ttfamily key} value. 

This is a much more efficient version of \mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} \mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}}. You should use it if you are responsible enough to not mess up things. You are not allowed to modify anything in the returned string. If you need a copy of the Value, consider to use \mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} or \mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}} instead.\hypertarget{group__keyvalue_string}{}\doxysubsection{String Handling}\label{group__keyvalue_string}
If {\ttfamily key} is string (\mbox{\hyperlink{group__keytest_gaea7670778abd07fee0fe8ac12a149190}{key\+Is\+String()}}), you may cast the returned as a {\ttfamily \char`\"{}char $\ast$\char`\"{}} because you\textquotesingle{}ll get a NULL terminated regular string.

\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{key\+Value()}} returns \char`\"{}\char`\"{} in string mode when there is no value. The reason is 
\begin{DoxyCode}{0}
\DoxyCodeLine{key=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(0);}
\DoxyCodeLine{\mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{keySetString}}(key,\textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{keyValue}}(key); \textcolor{comment}{// you would expect "{}"{} here}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}}(key);}

\end{DoxyCode}
\hypertarget{group__keyvalue_binary}{}\doxysubsection{Binary Data Handling}\label{group__keyvalue_binary}
If the data is binary, the size of the value must be determined by \mbox{\hyperlink{group__keyvalue_gae326672fffb7474abfe9baf53b73217e}{key\+Get\+Value\+Size()}}, any strlen() operations are not suitable to determine the size.

\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{key\+Value()}} returns 0 in binary mode when there is no value. The reason is 
\begin{DoxyCode}{0}
\DoxyCodeLine{key=\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(0);}
\DoxyCodeLine{\mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{keySetBinary}}(key, 0, 0);}
\DoxyCodeLine{\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{keyValue}}(key); \textcolor{comment}{// you would expect 0 here}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{keySetBinary}}(key,\textcolor{stringliteral}{"{}"{}}, 1);}
\DoxyCodeLine{\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{keyValue}}(key); \textcolor{comment}{// you would expect "{}"{} (a pointer to '\(\backslash\)0') here}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int} i=23;}
\DoxyCodeLine{\mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{keySetBinary}}(key, (\textcolor{keywordtype}{void}*)\&i, 4);}
\DoxyCodeLine{(\textcolor{keywordtype}{int}*)\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{keyValue}}(key); \textcolor{comment}{// you would expect a pointer to (int)23 here}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}}(key);}

\end{DoxyCode}


\begin{DoxyNote}{Note}
Note that the \mbox{\hyperlink{classkdb_1_1Key}{Key}} structure keeps its own size field that is calculated by library internal calls, so to avoid inconsistencies, you must never use the pointer returned by \mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{key\+Value()}} method to set a new value. Use \mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{key\+Set\+String()}} or \mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}} instead.
\end{DoxyNote}
\begin{DoxyWarning}{Warning}
Binary keys will return a NULL pointer when there is no data in contrast to \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}}, \mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{key\+Base\+Name()}} and \mbox{\hyperlink{group__meta_gac89fd319783b3457db45b4c09e55274a}{key\+Comment()}}. For string value the behaviour is the same.
\end{DoxyWarning}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{KDB *handle = \mbox{\hyperlink{group__kdb_ga844e1299a84c3fbf1d3a905c5c893ba5}{kdbOpen}}();}
\DoxyCodeLine{KeySet *ks=\mbox{\hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}}(0, \mbox{\hyperlink{group__keyset_ga7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *current=0;}
\DoxyCodeLine{}
\DoxyCodeLine{kdbGetByName(handle,ks,\textcolor{stringliteral}{"{}system:/sw/my"{}},KDB\_O\_SORT|KDB\_O\_RECURSIVE);}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__keyset_gabe793ff51f1728e3429c84a8a9086b70}{ksRewind}}(ks);}
\DoxyCodeLine{\textcolor{keywordflow}{while} (current=\mbox{\hyperlink{group__keyset_ga317321c9065b5a4b3e33fe1c399bcec9}{ksNext}}(ks)) \{}
\DoxyCodeLine{        \textcolor{keywordtype}{size\_t} size=0;}
\DoxyCodeLine{}
\DoxyCodeLine{        \textcolor{keywordflow}{if} (\mbox{\hyperlink{group__keytest_ga9526b371087564e43e3dff8ad0dac949}{keyIsBinary}}(current)) \{}
\DoxyCodeLine{                size=\mbox{\hyperlink{group__keyvalue_gae326672fffb7474abfe9baf53b73217e}{keyGetValueSize}}(current);}
\DoxyCodeLine{                printf(\textcolor{stringliteral}{"{}Key \%s has a value of size \%d bytes. Value: <BINARY>\(\backslash\)nComment: \%s"{}},}
\DoxyCodeLine{                        \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}}(current),}
\DoxyCodeLine{                        size,}
\DoxyCodeLine{                        \mbox{\hyperlink{group__meta_gac89fd319783b3457db45b4c09e55274a}{keyComment}}(current));}
\DoxyCodeLine{        \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{                size=\mbox{\hyperlink{internal_8c_afd676487565d083a6ad5a1381095acd8}{elektraStrLen}}((\textcolor{keywordtype}{char} *)\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{keyValue}}(current));}
\DoxyCodeLine{                printf(\textcolor{stringliteral}{"{}Key \%s has a value of size \%d bytes. Value: \%s\(\backslash\)nComment: \%s"{}},}
\DoxyCodeLine{                        \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}}(current),}
\DoxyCodeLine{                        size,}
\DoxyCodeLine{                        (\textcolor{keywordtype}{char} *)\mbox{\hyperlink{group__keyvalue_ga6f29609c5da53c6dc26a98678d5752af}{keyValue}}(current),}
\DoxyCodeLine{                        \mbox{\hyperlink{group__meta_gac89fd319783b3457db45b4c09e55274a}{keyComment}}(current));}
\DoxyCodeLine{        \}}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}} (ks);}
\DoxyCodeLine{\mbox{\hyperlink{group__kdb_gadb54dc9fda17ee07deb9444df745c96f}{kdbClose}} (handle);}

\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyPrecond}{Precondition}
{\ttfamily key} is not NULL and has stored data 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
returned pointer points to the stored internal value 

if the value is a string, the value is NULL terminated
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} from which to get the value\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s internal value 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em \char`\"{}\char`\"{}} & when there is no value and \mbox{\hyperlink{classkdb_1_1Key}{Key}} is not binary \\
\hline
{\em 0} & where there is no value and \mbox{\hyperlink{classkdb_1_1Key}{Key}} is binary \\
\hline
{\em 0} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_gae326672fffb7474abfe9baf53b73217e}{key\+Get\+Value\+Size()}} to \mbox{\hyperlink{classkdb_1_1Key_ac558a1f1b2cb50d77fbabcbb24950c05}{get}} the size of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 

\mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} for getting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as string 

\mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}} for getting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as binary
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
the value of the key 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_ada114aba31b321ddc984018b43a8568b}{get\+Binary()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_ae3c3228bd66be9013a8d686e57aed64b}\label{classkdb_1_1Key_ae3c3228bd66be9013a8d686e57aed64b}} 
\index{kdb::Key@{kdb::Key}!hasMeta@{hasMeta}}
\index{hasMeta@{hasMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{hasMeta()}{hasMeta()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::has\+Meta (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{meta\+Name }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}


\begin{DoxyRetVals}{Return values}
{\em true} & if there is a metadata with given name \\
\hline
{\em false} & if no such metadata exists\\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}{get\+Meta()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a2ced1c67613e5024f22563318567ed67}\label{classkdb_1_1Key_a2ced1c67613e5024f22563318567ed67}} 
\index{kdb::Key@{kdb::Key}!isBelow@{isBelow}}
\index{isBelow@{isBelow}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isBelow()}{isBelow()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Below (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{k }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Check if the \mbox{\hyperlink{classkdb_1_1Key}{Key}} {\ttfamily check} is below the \mbox{\hyperlink{classkdb_1_1Key}{Key}} {\ttfamily key} or not. 


\begin{DoxyParams}{Parameters}
{\em k} & the other key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if our key is below k
\end{DoxyReturn}
Example\+: \begin{DoxyVerb}key user:/sw/app
check user:/sw/app/key
\end{DoxyVerb}


returns true because {\ttfamily check} is below {\ttfamily key} 

Example\+: \begin{DoxyVerb}key user:/sw/app
check user:/sw/app/folder/key
\end{DoxyVerb}


returns also true because {\ttfamily check} is indirectly below {\ttfamily key} 

Obviously, there is no \mbox{\hyperlink{classkdb_1_1Key}{Key}} above a namespace (e.\+g. user, system, /)\+:

\begin{DoxyVerb}key *
check user
\end{DoxyVerb}



\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object to check against \\
\hline
{\em check} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object for which it should be checked whether it is below {\ttfamily key} \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & if {\ttfamily check} is below {\ttfamily key} \\
\hline
{\em 0} & if it is not below or if it is the same key \\
\hline
{\em -\/1} & if key or check is null\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keytest_ga0150fb549225d8789e7297b919965e72}{key\+Is\+Directly\+Below()}} for checking whether a \mbox{\hyperlink{classkdb_1_1Key}{Key}} is directly below another 

\mbox{\hyperlink{group__keyname_gab29a850168d9b31c9529e90cf9ab68be}{key\+Get\+Name()}}, \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} for getting / setting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a501eda4871a57faf5f7588a372d8f9c4}\label{classkdb_1_1Key_a501eda4871a57faf5f7588a372d8f9c4}} 
\index{kdb::Key@{kdb::Key}!isBelowOrSame@{isBelowOrSame}}
\index{isBelowOrSame@{isBelowOrSame}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isBelowOrSame()}{isBelowOrSame()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Below\+Or\+Same (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{k }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Check if a key is below or same. 


\begin{DoxyParams}{Parameters}
{\em k} & the other key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if our key is below k or the same as k
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keytest_ga03332b5d97c76a4fd2640aca4762b8df}{key\+Is\+Below()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_ad748648cb25e2dc77972581e12a5b31c}\label{classkdb_1_1Key_ad748648cb25e2dc77972581e12a5b31c}} 
\index{kdb::Key@{kdb::Key}!isBinary@{isBinary}}
\index{isBinary@{isBinary}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isBinary()}{isBinary()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Binary (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Check if the value of a {\ttfamily key} is of binary type. 

The function checks if the value of {\ttfamily key} is binary. Contrary to string values binary values can have \textquotesingle{}\textbackslash{}0\textquotesingle{} inside the value and may not be terminated by a null character. Their disadvantage is that you need to pass their size.

Make sure to use this function and don\textquotesingle{}t test the binary type another way to ensure compatibility and to write less error prone programs.


\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} to check\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & if the value of {\ttfamily key} is binary \\
\hline
{\em 0} & if the value of {\ttfamily key} is not binary \\
\hline
{\em -\/1} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}}, \mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}} for getting / setting a \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as binary 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a024ecb6d7c87244fb83c3fee58a0d696}\label{classkdb_1_1Key_a024ecb6d7c87244fb83c3fee58a0d696}} 
\index{kdb::Key@{kdb::Key}!isCascading@{isCascading}}
\index{isCascading@{isCascading}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isCascading()}{isCascading()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Cascading (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Determines if the key is in cascading namespace. 


\begin{DoxyRetVals}{Return values}
{\em true} & if it is a cascading key \\
\hline
{\em false} & otherwise \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a0c60f261479e4e21cc5e9acd76c0d26b}\label{classkdb_1_1Key_a0c60f261479e4e21cc5e9acd76c0d26b}} 
\index{kdb::Key@{kdb::Key}!isDir@{isDir}}
\index{isDir@{isDir}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isDir()}{isDir()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Dir (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Determines if the key is in dir namespace. 


\begin{DoxyRetVals}{Return values}
{\em true} & if it is a dir key \\
\hline
{\em false} & otherwise \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a6b7ce3736c89225445b7cc49d0e62bbe}\label{classkdb_1_1Key_a6b7ce3736c89225445b7cc49d0e62bbe}} 
\index{kdb::Key@{kdb::Key}!isDirectBelow@{isDirectBelow}}
\index{isDirectBelow@{isDirectBelow}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isDirectBelow()}{isDirectBelow()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Direct\+Below (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{k }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Check whether the \mbox{\hyperlink{classkdb_1_1Key}{Key}} {\ttfamily check} is directly below the \mbox{\hyperlink{classkdb_1_1Key}{Key}} {\ttfamily key}. 


\begin{DoxyParams}{Parameters}
{\em k} & the other key \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if our key is direct below k
\end{DoxyReturn}
\begin{DoxyVerb}Example:
key user:/sw/app
check user:/sw/app/key\end{DoxyVerb}


returns true because check is directly below key

\begin{DoxyVerb}Example:
key user:/sw/app
check user:/sw/app/folder/key\end{DoxyVerb}


does not return true, because it is only indirectly below


\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object to check against \\
\hline
{\em check} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object for which it should be checked whether it is directly below {\ttfamily key} \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & if {\ttfamily check} is directly below {\ttfamily key} \\
\hline
{\em 0} & if {\ttfamily check} is not directly below {\ttfamily key} or if it is the same \\
\hline
{\em -\/1} & on null pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keytest_ga03332b5d97c76a4fd2640aca4762b8df}{key\+Is\+Below()}} for checking whether a \mbox{\hyperlink{classkdb_1_1Key}{Key}} is below another 

\mbox{\hyperlink{group__keyname_gab29a850168d9b31c9529e90cf9ab68be}{key\+Get\+Name()}}, \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} for getting / setting the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_af499cd8c7d664818327c67624f1489e0}\label{classkdb_1_1Key_af499cd8c7d664818327c67624f1489e0}} 
\index{kdb::Key@{kdb::Key}!isMetaLocked@{isMetaLocked}}
\index{isMetaLocked@{isMetaLocked}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isMetaLocked()}{isMetaLocked()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Meta\+Locked (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

\begin{DoxyReturn}{Returns}
true if the metadata of our key has been locked 
\end{DoxyReturn}
\mbox{\Hypertarget{classkdb_1_1Key_a2b9d50da6ab7feed47eb5a80f039e91c}\label{classkdb_1_1Key_a2b9d50da6ab7feed47eb5a80f039e91c}} 
\index{kdb::Key@{kdb::Key}!isNameLocked@{isNameLocked}}
\index{isNameLocked@{isNameLocked}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isNameLocked()}{isNameLocked()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Name\+Locked (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

\begin{DoxyReturn}{Returns}
true if the name of our key has been locked 
\end{DoxyReturn}
\mbox{\Hypertarget{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}\label{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}} 
\index{kdb::Key@{kdb::Key}!isNull@{isNull}}
\index{isNull@{isNull}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isNull()}{isNull()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Null (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Checks if C++ wrapper has an underlying key. 

\begin{DoxySeeAlso}{See also}
operator bool(), \mbox{\hyperlink{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}{is\+Valid()}} 
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
true if no underlying key exists 
\end{DoxyReturn}
\mbox{\Hypertarget{classkdb_1_1Key_aa89cffb4d2a623920ff9abc086fde241}\label{classkdb_1_1Key_aa89cffb4d2a623920ff9abc086fde241}} 
\index{kdb::Key@{kdb::Key}!isProc@{isProc}}
\index{isProc@{isProc}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isProc()}{isProc()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Proc (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Determines if the key is in proc namespace. 


\begin{DoxyRetVals}{Return values}
{\em true} & if it is a proc key \\
\hline
{\em false} & otherwise \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_acf01e9a60bbd0e2768be782d149ac700}\label{classkdb_1_1Key_acf01e9a60bbd0e2768be782d149ac700}} 
\index{kdb::Key@{kdb::Key}!isSpec@{isSpec}}
\index{isSpec@{isSpec}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isSpec()}{isSpec()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Spec (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Determines if the key is in spec namespace. 


\begin{DoxyRetVals}{Return values}
{\em true} & if it is a spec key \\
\hline
{\em false} & otherwise \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a2170b1d9decef951b478454e3ee0b618}\label{classkdb_1_1Key_a2170b1d9decef951b478454e3ee0b618}} 
\index{kdb::Key@{kdb::Key}!isString@{isString}}
\index{isString@{isString}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isString()}{isString()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+String (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Check if the value of {\ttfamily key} is of string type. 

String values are null terminated and are not allowed to have any \textquotesingle{}\textbackslash{}0\textquotesingle{} characters inside the string.

Make sure to use this function and don\textquotesingle{}t test the string type another way to ensure compatibility and to write less error prone programs.


\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} to check\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & if the value of {\ttfamily key} is string \\
\hline
{\em 0} & if the value of {\ttfamily key} is not string \\
\hline
{\em -\/1} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}}, \mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{key\+Set\+String()}} for getting / setting a \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as string 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a44833fb97b02ca58205c48d740c4cada}\label{classkdb_1_1Key_a44833fb97b02ca58205c48d740c4cada}} 
\index{kdb::Key@{kdb::Key}!isSystem@{isSystem}}
\index{isSystem@{isSystem}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isSystem()}{isSystem()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+System (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Determines if the key is in system namespace. 


\begin{DoxyRetVals}{Return values}
{\em true} & if it is a system key \\
\hline
{\em false} & otherwise \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a3b3d0d74246b259b10caed425216d91c}\label{classkdb_1_1Key_a3b3d0d74246b259b10caed425216d91c}} 
\index{kdb::Key@{kdb::Key}!isUser@{isUser}}
\index{isUser@{isUser}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isUser()}{isUser()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+User (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Determines if the key is in user namespace. 


\begin{DoxyRetVals}{Return values}
{\em true} & if it is a user key \\
\hline
{\em false} & otherwise \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}\label{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}} 
\index{kdb::Key@{kdb::Key}!isValid@{isValid}}
\index{isValid@{isValid}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isValid()}{isValid()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Valid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

\begin{DoxyReturn}{Returns}
if the key is valid
\end{DoxyReturn}
An invalid key has no name. The name of valid keys either start with user or system.


\begin{DoxyRetVals}{Return values}
{\em true} & if the key has a valid name \\
\hline
{\em false} & if the key has an invalid name\\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a6c1812730e9cb714893c9f9b1e503303}{get\+Name()}}, \mbox{\hyperlink{classkdb_1_1Key_a3b3d0d74246b259b10caed425216d91c}{is\+User()}}, \mbox{\hyperlink{classkdb_1_1Key_a44833fb97b02ca58205c48d740c4cada}{is\+System()}}, \mbox{\hyperlink{classkdb_1_1Key_aac012cf123370b4e7975984978c81419}{get\+Namespace()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a92daf058cb9896c7a926bddeecf179ef}\label{classkdb_1_1Key_a92daf058cb9896c7a926bddeecf179ef}} 
\index{kdb::Key@{kdb::Key}!isValueLocked@{isValueLocked}}
\index{isValueLocked@{isValueLocked}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{isValueLocked()}{isValueLocked()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::is\+Value\+Locked (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}

\begin{DoxyReturn}{Returns}
true if the value of our key has been locked 
\end{DoxyReturn}
\mbox{\Hypertarget{classkdb_1_1Key_add635e6194c7a05b7d4e470f7b135d9c}\label{classkdb_1_1Key_add635e6194c7a05b7d4e470f7b135d9c}} 
\index{kdb::Key@{kdb::Key}!needSync@{needSync}}
\index{needSync@{needSync}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{needSync()}{needSync()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::need\+Sync (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Test if a key needs to be synced to backend storage. 

If any \mbox{\hyperlink{classkdb_1_1Key}{Key}} modification took place the \mbox{\hyperlink{classkdb_1_1Key}{Key}} will be flagged so that \mbox{\hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}} knows which keys were modified and which not.

After \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} the flag will normally be set, but after \mbox{\hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}} and \mbox{\hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}} the flag will be removed. When you modify the key the flag will be set again.

In your application you can make use of that flag to know if you changed something in a key after a \mbox{\hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}} or \mbox{\hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}}.

\begin{DoxyNote}{Note}
Note that the sync status will be updated on any change, including metadata.
\end{DoxyNote}
\begin{DoxyRefDesc}{Deprecated}
\item[\mbox{\hyperlink{deprecated__deprecated000003}{Deprecated}}]The handling of synchronization is done internally and does not need to be checked by neither application nor plugins.\end{DoxyRefDesc}



\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} which should be checked\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 1} & if {\ttfamily key} was changed in memory \\
\hline
{\em 0} & if {\ttfamily key} wasn\textquotesingle{}t changed \\
\hline
{\em -\/1} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}, key\+Dup() Keys need to be synced after calling those functions 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a855f37fef58a4ea4006d9e281f66cfe1}\label{classkdb_1_1Key_a855f37fef58a4ea4006d9e281f66cfe1}} 
\index{kdb::Key@{kdb::Key}!nextMeta@{nextMeta}}
\index{nextMeta@{nextMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{nextMeta()}{nextMeta()}}
{\footnotesize\ttfamily const \mbox{\hyperlink{classkdb_1_1Key}{Key}} kdb\+::\+Key\+::next\+Meta (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get the next metadata entry of a \mbox{\hyperlink{classkdb_1_1Key}{Key}}. 

Keys have an internal cursor that can be reset with \mbox{\hyperlink{group__keymeta_ga5dbb669802eea27e106ee3a5e39717a9}{key\+Rewind\+Meta()}}. Every time \mbox{\hyperlink{group__keymeta_ga4c88342f580a4291455a801af71ce048}{key\+Next\+Meta()}} is called the cursor is incremented and the new current Name of Meta Information is returned.

You\textquotesingle{}ll get a NULL pointer if the metadata after the end of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} was reached. On subsequent calls of \mbox{\hyperlink{group__keymeta_ga4c88342f580a4291455a801af71ce048}{key\+Next\+Meta()}} it will still return the NULL pointer.

The {\ttfamily key} internal cursor will be changed, so it is not const.

\begin{DoxyNote}{Note}
That the resulting key is guaranteed to have a value, because meta information has no binary or null pointer semantics.

You must not delete or change the returned key, use \mbox{\hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}} if you want to delete or change it.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object to work with\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a key containing metadata 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & when the last \mbox{\hyperlink{classkdb_1_1Key}{Key}} has been reached \\
\hline
{\em 0} & when \mbox{\hyperlink{classkdb_1_1Key}{Key}} is a NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyset_ga317321c9065b5a4b3e33fe1c399bcec9}{ks\+Next()}} for pedant in iterator interface of \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}} 

\mbox{\hyperlink{group__keymeta_ga5dbb669802eea27e106ee3a5e39717a9}{key\+Rewind\+Meta()}} for rewinding the internal iterator 

\mbox{\hyperlink{group__keymeta_ga74a273f529030f4947df52e14fdd2869}{key\+Current\+Meta()}} for getting the current metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}}

\mbox{\hyperlink{classkdb_1_1Key_a002af206119ceed17b106e2449cedc91}{rewind\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a848292bf5591e5e845f74a487697cb19}{current\+Meta()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a15ee99e8447ee526d600e15938e4a1c0}\label{classkdb_1_1Key_a15ee99e8447ee526d600e15938e4a1c0}} 
\index{kdb::Key@{kdb::Key}!operator bool@{operator bool}}
\index{operator bool@{operator bool}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator bool()}{operator bool()}}
{\footnotesize\ttfamily kdb\+::\+Key\+::operator bool (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



This is for loops and lookups only. 

Opposite of \mbox{\hyperlink{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}{is\+Null()}}

For loops it checks if there are still more keys. For lookups it checks if a key could be found.

\begin{DoxyWarning}{Warning}
you should not construct or use null keys
\end{DoxyWarning}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_ab70b89caae5fe1e9a2e774733576fa4c}{is\+Null()}}, \mbox{\hyperlink{classkdb_1_1Key_a69e621790e5717c56f7275e0b8d5e27c}{is\+Valid()}} 
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
false on null keys 

true otherwise 
\end{DoxyReturn}
\mbox{\Hypertarget{classkdb_1_1Key_a7cf40dd6e79e63765c9535a8fcee6491}\label{classkdb_1_1Key_a7cf40dd6e79e63765c9535a8fcee6491}} 
\index{kdb::Key@{kdb::Key}!operator"!=@{operator"!=}}
\index{operator"!=@{operator"!=}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator"!=()}{operator!=()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::operator!= (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{k }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Compare the name of two Keys. 

The comparison is based on a memcmp of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s names. If the names match, the Keys are found to be exactly the same and 0 is returned. These two keys can\textquotesingle{}t be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} defines the sorting order for a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

The following 3 points are the rules for NULL values\+:


\begin{DoxyItemize}
\item A NULL pointer will be found to be smaller than every other \mbox{\hyperlink{classkdb_1_1Key}{Key}}. If both are NULL pointers, 0 is returned.
\item A NULL name will be found to be smaller than every other name. If both are NULL names, 0 is returned.
\end{DoxyItemize}

If the name is equal then\+:


\begin{DoxyItemize}
\item No owner will be found to be smaller than every other owner. If both don\textquotesingle{}t have an owner, 0 is returned.
\end{DoxyItemize}

\begin{DoxyNote}{Note}
the owner will only be used if the names are equal.
\end{DoxyNote}
Given any Keys k1 and k2 constructed with \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}, following equation hold true\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, 0) == 0, \textcolor{stringliteral}{"{}all null pointers same"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (k1, 0) == 1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, k2) == -\/1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}

\end{DoxyCodeInclude}
 Here are some more examples\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k1 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/a"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k2 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/b"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k1,k2) < 0}}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k2,k1) > 0}}

\end{DoxyCode}


Do not strcmp the \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} yourself, because the result differs from simple ascii comparison.

\begin{DoxyPrecond}{Precondition}
The Keys {\ttfamily k1} and {\ttfamily k2} have been properly initialized via \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} or are NULL 
\end{DoxyPrecond}
\begin{DoxyInvariant}{Invariant}
All parts of the Keys remain unchanged 
\end{DoxyInvariant}
\begin{DoxyPostcond}{Postcondition}
If the result is 0, {\ttfamily k1} and {\ttfamily k2} cannot be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em k1} & the first \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared \\
\hline
{\em k2} & the second \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em $<$0} & if k1 $<$ k2 \\
\hline
{\em 0} & if k1 == k2 \\
\hline
{\em $>$0} & if k1 $>$ k2\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ks\+Append\+Key()}}, \mbox{\hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} when appending 

\mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} during searching
\end{DoxySeeAlso}

\begin{DoxyRetVals}{Return values}
{\em true} & != 0 \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a66e5af2387ebb86efa465ba2e844cafd}\label{classkdb_1_1Key_a66e5af2387ebb86efa465ba2e844cafd}} 
\index{kdb::Key@{kdb::Key}!operator$\ast$@{operator$\ast$}}
\index{operator$\ast$@{operator$\ast$}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator$\ast$()}{operator*()}}
{\footnotesize\ttfamily ckdb\+::\+Key $\ast$ kdb\+::\+Key\+::operator$\ast$ (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Is an abbreviation for get\+Key. 

Passes out the raw key pointer. This pointer can be used to directly change the underlying key object.

\begin{DoxyNote}{Note}
that the ownership remains in the object
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a6be9b3bb17434fd4362d137183d51100}{get\+Key()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a325367f8c2291b373ff6a9aa011bc29d}\label{classkdb_1_1Key_a325367f8c2291b373ff6a9aa011bc29d}} 
\index{kdb::Key@{kdb::Key}!operator++@{operator++}}
\index{operator++@{operator++}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator++()}{operator++()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::operator++ (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Increment the reference counter of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. 

This function is intended for applications using their own reference counter for \mbox{\hyperlink{classkdb_1_1Key}{Key}} objects. With it you can increment the reference and thus avoid destruction of the object in a subsequent \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}}.

The reference counter can\textquotesingle{}t be incremented once it reached SSIZE\+\_\+\+MAX. In that situation nothing will happen and SSIZE\+\_\+\+MAX will be returned.

\begin{DoxyNote}{Note}
key\+Dup() will reset the references for duplicated Keys.
\end{DoxyNote}
\begin{DoxyPostcond}{Postcondition}
{\ttfamily key\textquotesingle{}s} reference counter is $>$ 0 

{\ttfamily key\textquotesingle{}s} reference counter is $<$= SSIZE\+\_\+\+MAX
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object whose reference counter should get increased\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the updated value of the reference counter 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on NULL pointer \\
\hline
{\em SSIZE\+\_\+\+MAX} & when reference counter reached SSIZE\+\_\+\+MAX\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()}} for addtional explanations about reference counting 

\mbox{\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{key\+Dec\+Ref()}} for decreasing the reference counter 

\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} for deleting a \mbox{\hyperlink{classkdb_1_1Key}{Key}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a1e3c8da218a6a6e9f832f70772bcdc6f}\label{classkdb_1_1Key_a1e3c8da218a6a6e9f832f70772bcdc6f}} 
\index{kdb::Key@{kdb::Key}!operator++@{operator++}}
\index{operator++@{operator++}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator++()}{operator++()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::operator++ (\begin{DoxyParamCaption}\item[{int}]{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Increment the reference counter of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. 

This function is intended for applications using their own reference counter for \mbox{\hyperlink{classkdb_1_1Key}{Key}} objects. With it you can increment the reference and thus avoid destruction of the object in a subsequent \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}}.

The reference counter can\textquotesingle{}t be incremented once it reached SSIZE\+\_\+\+MAX. In that situation nothing will happen and SSIZE\+\_\+\+MAX will be returned.

\begin{DoxyNote}{Note}
key\+Dup() will reset the references for duplicated Keys.
\end{DoxyNote}
\begin{DoxyPostcond}{Postcondition}
{\ttfamily key\textquotesingle{}s} reference counter is $>$ 0 

{\ttfamily key\textquotesingle{}s} reference counter is $<$= SSIZE\+\_\+\+MAX
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object whose reference counter should get increased\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the updated value of the reference counter 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on NULL pointer \\
\hline
{\em SSIZE\+\_\+\+MAX} & when reference counter reached SSIZE\+\_\+\+MAX\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()}} for addtional explanations about reference counting 

\mbox{\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{key\+Dec\+Ref()}} for decreasing the reference counter 

\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} for deleting a \mbox{\hyperlink{classkdb_1_1Key}{Key}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a21958cf1d6b697fc12a9b4f77336e050}\label{classkdb_1_1Key_a21958cf1d6b697fc12a9b4f77336e050}} 
\index{kdb::Key@{kdb::Key}!operator-\/-\/@{operator-\/-\/}}
\index{operator-\/-\/@{operator-\/-\/}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator-\/-\/()}{operator--()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::operator-\/-\/ (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Decrement the reference counter of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. 

The references will be decremented for \mbox{\hyperlink{group__keyset_gae42530b04defb772059de0600159cf69}{ks\+Pop()}} or successful calls of \mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}} with the option KDB\+\_\+\+O\+\_\+\+POP. It will also be decremented with an following \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} in the case that an old \mbox{\hyperlink{classkdb_1_1Key}{Key}} is replaced with another \mbox{\hyperlink{classkdb_1_1Key}{Key}} with the same name.

The reference counter can\textquotesingle{}t be decremented once it reaches 0. In that situation nothing will happen and 0 will be returned.

\begin{DoxyNote}{Note}
key\+Dup() will reset the references for duplicated \mbox{\hyperlink{classkdb_1_1Key}{Key}}.
\end{DoxyNote}
\begin{DoxyPostcond}{Postcondition}
{\ttfamily key\textquotesingle{}s} reference counter is $>$= 0 

{\ttfamily key\textquotesingle{}s} reference counter is $<$ SSIZE\+\_\+\+MAX
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object whose reference counter should get decreased\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the updated value of the reference counter 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on NULL pointer \\
\hline
{\em 0} & when the \mbox{\hyperlink{classkdb_1_1Key}{Key}} is ready to be freed\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()}} for addtional explanations about reference counting 

\mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}} for increasing the reference counter 

\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} for deleting a \mbox{\hyperlink{classkdb_1_1Key}{Key}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_ad282e5dc18bf0e74a086fe63f4dc3b57}\label{classkdb_1_1Key_ad282e5dc18bf0e74a086fe63f4dc3b57}} 
\index{kdb::Key@{kdb::Key}!operator-\/-\/@{operator-\/-\/}}
\index{operator-\/-\/@{operator-\/-\/}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator-\/-\/()}{operator--()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::operator-\/-\/ (\begin{DoxyParamCaption}\item[{int}]{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Decrement the reference counter of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} object. 

The references will be decremented for \mbox{\hyperlink{group__keyset_gae42530b04defb772059de0600159cf69}{ks\+Pop()}} or successful calls of \mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}} with the option KDB\+\_\+\+O\+\_\+\+POP. It will also be decremented with an following \mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} in the case that an old \mbox{\hyperlink{classkdb_1_1Key}{Key}} is replaced with another \mbox{\hyperlink{classkdb_1_1Key}{Key}} with the same name.

The reference counter can\textquotesingle{}t be decremented once it reaches 0. In that situation nothing will happen and 0 will be returned.

\begin{DoxyNote}{Note}
key\+Dup() will reset the references for duplicated \mbox{\hyperlink{classkdb_1_1Key}{Key}}.
\end{DoxyNote}
\begin{DoxyPostcond}{Postcondition}
{\ttfamily key\textquotesingle{}s} reference counter is $>$= 0 

{\ttfamily key\textquotesingle{}s} reference counter is $<$ SSIZE\+\_\+\+MAX
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object whose reference counter should get decreased\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the updated value of the reference counter 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on NULL pointer \\
\hline
{\em 0} & when the \mbox{\hyperlink{classkdb_1_1Key}{Key}} is ready to be freed\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()}} for addtional explanations about reference counting 

\mbox{\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}} for increasing the reference counter 

\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}} for deleting a \mbox{\hyperlink{classkdb_1_1Key}{Key}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_ab64ec9d578e083dad3e43322535cf108}\label{classkdb_1_1Key_ab64ec9d578e083dad3e43322535cf108}} 
\index{kdb::Key@{kdb::Key}!operator-\/$>$@{operator-\/$>$}}
\index{operator-\/$>$@{operator-\/$>$}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator-\/$>$()}{operator->()}}
{\footnotesize\ttfamily \mbox{\hyperlink{classkdb_1_1Key}{Key}} $\ast$ kdb\+::\+Key\+::operator-\/$>$ (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

\begin{DoxyReturn}{Returns}
a pointer to this object
\end{DoxyReturn}
Needed for \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}} iterators. \begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1KeySetIterator}{Key\+Set\+Iterator}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_aae9d359b54dc0df7d7b3ab3755a09732}\label{classkdb_1_1Key_aae9d359b54dc0df7d7b3ab3755a09732}} 
\index{kdb::Key@{kdb::Key}!operator$<$@{operator$<$}}
\index{operator$<$@{operator$<$}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator$<$()}{operator<()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::operator$<$ (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{other }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Compare the name of two Keys. 

The comparison is based on a memcmp of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s names. If the names match, the Keys are found to be exactly the same and 0 is returned. These two keys can\textquotesingle{}t be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} defines the sorting order for a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

The following 3 points are the rules for NULL values\+:


\begin{DoxyItemize}
\item A NULL pointer will be found to be smaller than every other \mbox{\hyperlink{classkdb_1_1Key}{Key}}. If both are NULL pointers, 0 is returned.
\item A NULL name will be found to be smaller than every other name. If both are NULL names, 0 is returned.
\end{DoxyItemize}

If the name is equal then\+:


\begin{DoxyItemize}
\item No owner will be found to be smaller than every other owner. If both don\textquotesingle{}t have an owner, 0 is returned.
\end{DoxyItemize}

\begin{DoxyNote}{Note}
the owner will only be used if the names are equal.
\end{DoxyNote}
Given any Keys k1 and k2 constructed with \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}, following equation hold true\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, 0) == 0, \textcolor{stringliteral}{"{}all null pointers same"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (k1, 0) == 1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, k2) == -\/1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}

\end{DoxyCodeInclude}
 Here are some more examples\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k1 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/a"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k2 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/b"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k1,k2) < 0}}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k2,k1) > 0}}

\end{DoxyCode}


Do not strcmp the \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} yourself, because the result differs from simple ascii comparison.

\begin{DoxyPrecond}{Precondition}
The Keys {\ttfamily k1} and {\ttfamily k2} have been properly initialized via \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} or are NULL 
\end{DoxyPrecond}
\begin{DoxyInvariant}{Invariant}
All parts of the Keys remain unchanged 
\end{DoxyInvariant}
\begin{DoxyPostcond}{Postcondition}
If the result is 0, {\ttfamily k1} and {\ttfamily k2} cannot be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em k1} & the first \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared \\
\hline
{\em k2} & the second \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em $<$0} & if k1 $<$ k2 \\
\hline
{\em 0} & if k1 == k2 \\
\hline
{\em $>$0} & if k1 $>$ k2\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ks\+Append\+Key()}}, \mbox{\hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} when appending 

\mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} during searching
\end{DoxySeeAlso}

\begin{DoxyRetVals}{Return values}
{\em true} & $<$ 0 \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_addb92d7d52f80fc0cafa40d60fe0564f}\label{classkdb_1_1Key_addb92d7d52f80fc0cafa40d60fe0564f}} 
\index{kdb::Key@{kdb::Key}!operator$<$=@{operator$<$=}}
\index{operator$<$=@{operator$<$=}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator$<$=()}{operator<=()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::operator$<$= (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{other }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Compare the name of two Keys. 

The comparison is based on a memcmp of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s names. If the names match, the Keys are found to be exactly the same and 0 is returned. These two keys can\textquotesingle{}t be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} defines the sorting order for a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

The following 3 points are the rules for NULL values\+:


\begin{DoxyItemize}
\item A NULL pointer will be found to be smaller than every other \mbox{\hyperlink{classkdb_1_1Key}{Key}}. If both are NULL pointers, 0 is returned.
\item A NULL name will be found to be smaller than every other name. If both are NULL names, 0 is returned.
\end{DoxyItemize}

If the name is equal then\+:


\begin{DoxyItemize}
\item No owner will be found to be smaller than every other owner. If both don\textquotesingle{}t have an owner, 0 is returned.
\end{DoxyItemize}

\begin{DoxyNote}{Note}
the owner will only be used if the names are equal.
\end{DoxyNote}
Given any Keys k1 and k2 constructed with \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}, following equation hold true\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, 0) == 0, \textcolor{stringliteral}{"{}all null pointers same"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (k1, 0) == 1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, k2) == -\/1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}

\end{DoxyCodeInclude}
 Here are some more examples\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k1 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/a"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k2 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/b"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k1,k2) < 0}}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k2,k1) > 0}}

\end{DoxyCode}


Do not strcmp the \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} yourself, because the result differs from simple ascii comparison.

\begin{DoxyPrecond}{Precondition}
The Keys {\ttfamily k1} and {\ttfamily k2} have been properly initialized via \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} or are NULL 
\end{DoxyPrecond}
\begin{DoxyInvariant}{Invariant}
All parts of the Keys remain unchanged 
\end{DoxyInvariant}
\begin{DoxyPostcond}{Postcondition}
If the result is 0, {\ttfamily k1} and {\ttfamily k2} cannot be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em k1} & the first \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared \\
\hline
{\em k2} & the second \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em $<$0} & if k1 $<$ k2 \\
\hline
{\em 0} & if k1 == k2 \\
\hline
{\em $>$0} & if k1 $>$ k2\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ks\+Append\+Key()}}, \mbox{\hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} when appending 

\mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} during searching
\end{DoxySeeAlso}

\begin{DoxyRetVals}{Return values}
{\em true} & $<$= 0 \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a628f3ee543a1d71d4488233018eddd86}\label{classkdb_1_1Key_a628f3ee543a1d71d4488233018eddd86}} 
\index{kdb::Key@{kdb::Key}!operator=@{operator=}}
\index{operator=@{operator=}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator=()}{operator=()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{classkdb_1_1Key}{Key}} \& kdb\+::\+Key\+::operator= (\begin{DoxyParamCaption}\item[{ckdb\+::\+Key $\ast$}]{k }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Assign a C key. 

Will call del() on the old key. \mbox{\Hypertarget{classkdb_1_1Key_a63a006c140cfd2a633c6fdf3f9eb9d1a}\label{classkdb_1_1Key_a63a006c140cfd2a633c6fdf3f9eb9d1a}} 
\index{kdb::Key@{kdb::Key}!operator=@{operator=}}
\index{operator=@{operator=}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator=()}{operator=()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \mbox{\hyperlink{classkdb_1_1Key}{Key}} \& kdb\+::\+Key\+::operator= (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{k }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Assign a key. 

Will call del() on the old key. \mbox{\Hypertarget{classkdb_1_1Key_ae52e7f4c4461db5356ddeef64a870cad}\label{classkdb_1_1Key_ae52e7f4c4461db5356ddeef64a870cad}} 
\index{kdb::Key@{kdb::Key}!operator==@{operator==}}
\index{operator==@{operator==}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator==()}{operator==()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::operator== (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{k }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Compare the name of two Keys. 

The comparison is based on a memcmp of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s names. If the names match, the Keys are found to be exactly the same and 0 is returned. These two keys can\textquotesingle{}t be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} defines the sorting order for a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

The following 3 points are the rules for NULL values\+:


\begin{DoxyItemize}
\item A NULL pointer will be found to be smaller than every other \mbox{\hyperlink{classkdb_1_1Key}{Key}}. If both are NULL pointers, 0 is returned.
\item A NULL name will be found to be smaller than every other name. If both are NULL names, 0 is returned.
\end{DoxyItemize}

If the name is equal then\+:


\begin{DoxyItemize}
\item No owner will be found to be smaller than every other owner. If both don\textquotesingle{}t have an owner, 0 is returned.
\end{DoxyItemize}

\begin{DoxyNote}{Note}
the owner will only be used if the names are equal.
\end{DoxyNote}
Given any Keys k1 and k2 constructed with \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}, following equation hold true\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, 0) == 0, \textcolor{stringliteral}{"{}all null pointers same"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (k1, 0) == 1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, k2) == -\/1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}

\end{DoxyCodeInclude}
 Here are some more examples\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k1 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/a"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k2 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/b"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k1,k2) < 0}}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k2,k1) > 0}}

\end{DoxyCode}


Do not strcmp the \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} yourself, because the result differs from simple ascii comparison.

\begin{DoxyPrecond}{Precondition}
The Keys {\ttfamily k1} and {\ttfamily k2} have been properly initialized via \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} or are NULL 
\end{DoxyPrecond}
\begin{DoxyInvariant}{Invariant}
All parts of the Keys remain unchanged 
\end{DoxyInvariant}
\begin{DoxyPostcond}{Postcondition}
If the result is 0, {\ttfamily k1} and {\ttfamily k2} cannot be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em k1} & the first \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared \\
\hline
{\em k2} & the second \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em $<$0} & if k1 $<$ k2 \\
\hline
{\em 0} & if k1 == k2 \\
\hline
{\em $>$0} & if k1 $>$ k2\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ks\+Append\+Key()}}, \mbox{\hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} when appending 

\mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} during searching
\end{DoxySeeAlso}

\begin{DoxyRetVals}{Return values}
{\em true} & == 0 \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_af616a48861b70b93e6f5955206c9257e}\label{classkdb_1_1Key_af616a48861b70b93e6f5955206c9257e}} 
\index{kdb::Key@{kdb::Key}!operator$>$@{operator$>$}}
\index{operator$>$@{operator$>$}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator$>$()}{operator>()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::operator$>$ (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{other }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Compare the name of two Keys. 

The comparison is based on a memcmp of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s names. If the names match, the Keys are found to be exactly the same and 0 is returned. These two keys can\textquotesingle{}t be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} defines the sorting order for a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

The following 3 points are the rules for NULL values\+:


\begin{DoxyItemize}
\item A NULL pointer will be found to be smaller than every other \mbox{\hyperlink{classkdb_1_1Key}{Key}}. If both are NULL pointers, 0 is returned.
\item A NULL name will be found to be smaller than every other name. If both are NULL names, 0 is returned.
\end{DoxyItemize}

If the name is equal then\+:


\begin{DoxyItemize}
\item No owner will be found to be smaller than every other owner. If both don\textquotesingle{}t have an owner, 0 is returned.
\end{DoxyItemize}

\begin{DoxyNote}{Note}
the owner will only be used if the names are equal.
\end{DoxyNote}
Given any Keys k1 and k2 constructed with \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}, following equation hold true\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, 0) == 0, \textcolor{stringliteral}{"{}all null pointers same"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (k1, 0) == 1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, k2) == -\/1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}

\end{DoxyCodeInclude}
 Here are some more examples\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k1 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/a"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k2 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/b"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k1,k2) < 0}}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k2,k1) > 0}}

\end{DoxyCode}


Do not strcmp the \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} yourself, because the result differs from simple ascii comparison.

\begin{DoxyPrecond}{Precondition}
The Keys {\ttfamily k1} and {\ttfamily k2} have been properly initialized via \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} or are NULL 
\end{DoxyPrecond}
\begin{DoxyInvariant}{Invariant}
All parts of the Keys remain unchanged 
\end{DoxyInvariant}
\begin{DoxyPostcond}{Postcondition}
If the result is 0, {\ttfamily k1} and {\ttfamily k2} cannot be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em k1} & the first \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared \\
\hline
{\em k2} & the second \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em $<$0} & if k1 $<$ k2 \\
\hline
{\em 0} & if k1 == k2 \\
\hline
{\em $>$0} & if k1 $>$ k2\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ks\+Append\+Key()}}, \mbox{\hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} when appending 

\mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} during searching
\end{DoxySeeAlso}

\begin{DoxyRetVals}{Return values}
{\em true} & $>$ 0 \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a4e711165a33a127d95f7102307e94bf6}\label{classkdb_1_1Key_a4e711165a33a127d95f7102307e94bf6}} 
\index{kdb::Key@{kdb::Key}!operator$>$=@{operator$>$=}}
\index{operator$>$=@{operator$>$=}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{operator$>$=()}{operator>=()}}
{\footnotesize\ttfamily bool kdb\+::\+Key\+::operator$>$= (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{classkdb_1_1Key}{Key}} \&}]{other }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Compare the name of two Keys. 

The comparison is based on a memcmp of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s names. If the names match, the Keys are found to be exactly the same and 0 is returned. These two keys can\textquotesingle{}t be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} defines the sorting order for a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}.

The following 3 points are the rules for NULL values\+:


\begin{DoxyItemize}
\item A NULL pointer will be found to be smaller than every other \mbox{\hyperlink{classkdb_1_1Key}{Key}}. If both are NULL pointers, 0 is returned.
\item A NULL name will be found to be smaller than every other name. If both are NULL names, 0 is returned.
\end{DoxyItemize}

If the name is equal then\+:


\begin{DoxyItemize}
\item No owner will be found to be smaller than every other owner. If both don\textquotesingle{}t have an owner, 0 is returned.
\end{DoxyItemize}

\begin{DoxyNote}{Note}
the owner will only be used if the names are equal.
\end{DoxyNote}
Given any Keys k1 and k2 constructed with \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}}, following equation hold true\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, 0) == 0, \textcolor{stringliteral}{"{}all null pointers same"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (k1, 0) == 1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}
\DoxyCodeLine{        succeed\_if (\mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{keyCmp}} (0, k2) == -\/1, \textcolor{stringliteral}{"{}null pointer is smaller"{}});}

\end{DoxyCodeInclude}
 Here are some more examples\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k1 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/a"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *k2 = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}}(\textcolor{stringliteral}{"{}user:/b"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k1,k2) < 0}}
\DoxyCodeLine{\textcolor{comment}{// keyCmp(k2,k1) > 0}}

\end{DoxyCode}


Do not strcmp the \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} yourself, because the result differs from simple ascii comparison.

\begin{DoxyPrecond}{Precondition}
The Keys {\ttfamily k1} and {\ttfamily k2} have been properly initialized via \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}} or are NULL 
\end{DoxyPrecond}
\begin{DoxyInvariant}{Invariant}
All parts of the Keys remain unchanged 
\end{DoxyInvariant}
\begin{DoxyPostcond}{Postcondition}
If the result is 0, {\ttfamily k1} and {\ttfamily k2} cannot be used in the same \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em k1} & the first \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared \\
\hline
{\em k2} & the second \mbox{\hyperlink{classkdb_1_1Key}{Key}} to be compared\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em $<$0} & if k1 $<$ k2 \\
\hline
{\em 0} & if k1 == k2 \\
\hline
{\em $>$0} & if k1 $>$ k2\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ks\+Append\+Key()}}, \mbox{\hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} when appending 

\mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}} will compare Keys via \mbox{\hyperlink{group__keytest_gaf6e66e12fe04d535a5d1c8218ced803e}{key\+Cmp()}} during searching
\end{DoxySeeAlso}

\begin{DoxyRetVals}{Return values}
{\em true} & $>$= 0 \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a9ae719043e6e99f5f3d6fb85837306f8}\label{classkdb_1_1Key_a9ae719043e6e99f5f3d6fb85837306f8}} 
\index{kdb::Key@{kdb::Key}!release@{release}}
\index{release@{release}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{release()}{release()}}
{\footnotesize\ttfamily ckdb\+::\+Key $\ast$ kdb\+::\+Key\+::release (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Passes out the raw key pointer and resets internal key handle. 

\begin{DoxyNote}{Note}
that the ownership is moved outside.
\end{DoxyNote}

\begin{DoxyRetVals}{Return values}
{\em 0} & if no key is held (null pointer), no action is done then. \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{classkdb_1_1Key_a002af206119ceed17b106e2449cedc91}\label{classkdb_1_1Key_a002af206119ceed17b106e2449cedc91}} 
\index{kdb::Key@{kdb::Key}!rewindMeta@{rewindMeta}}
\index{rewindMeta@{rewindMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{rewindMeta()}{rewindMeta()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::rewind\+Meta (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Rewind the internal iterator to the first entry in metadata keyset. 

Use this function to set the cursor to the beginning of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} Meta Infos. \mbox{\hyperlink{group__keymeta_ga74a273f529030f4947df52e14fdd2869}{key\+Current\+Meta()}} will always return NULL after rewinding, so you need to call \mbox{\hyperlink{group__keymeta_ga4c88342f580a4291455a801af71ce048}{key\+Next\+Meta()}} first.


\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *key;}
\DoxyCodeLine{\textcolor{keyword}{const} \mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} *meta;}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__keymeta_ga5dbb669802eea27e106ee3a5e39717a9}{keyRewindMeta}} (key);}
\DoxyCodeLine{\textcolor{keywordflow}{while} ((meta = \mbox{\hyperlink{group__keymeta_ga4c88342f580a4291455a801af71ce048}{keyNextMeta}} (key))!=0)}
\DoxyCodeLine{\{}
\DoxyCodeLine{        printf (\textcolor{stringliteral}{"{}name: \%s, value: \%s"{}}, \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}}(meta), \mbox{\hyperlink{group__keyvalue_ga880936f2481d28e6e2acbe7486a21d05}{keyString}}(meta));}
\DoxyCodeLine{\}}

\end{DoxyCode}



\begin{DoxyParams}{Parameters}
{\em key} & \mbox{\hyperlink{classkdb_1_1Key}{Key}} whose internal iterator should be rewinded\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & on success \\
\hline
{\em 0} & if there is no metadata for that key (\mbox{\hyperlink{group__keymeta_ga4c88342f580a4291455a801af71ce048}{key\+Next\+Meta()}} will always return 0 in that case) \\
\hline
{\em -\/1} & on NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keymeta_ga4c88342f580a4291455a801af71ce048}{key\+Next\+Meta()}}, \mbox{\hyperlink{group__keymeta_ga74a273f529030f4947df52e14fdd2869}{key\+Current\+Meta()}} for iterating after rewinding 

\mbox{\hyperlink{group__keyset_gabe793ff51f1728e3429c84a8a9086b70}{ks\+Rewind()}} \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}}\textquotesingle{}s equivalent function for rewinding

\mbox{\hyperlink{classkdb_1_1Key_a855f37fef58a4ea4006d9e281f66cfe1}{next\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a848292bf5591e5e845f74a487697cb19}{current\+Meta()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a615124f0a2b291e03975b49c233654d7}\label{classkdb_1_1Key_a615124f0a2b291e03975b49c233654d7}} 
\index{kdb::Key@{kdb::Key}!set@{set}}
\index{set@{set}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{set()}{set()}}
{\footnotesize\ttfamily template$<$class T $>$ \\
void kdb\+::\+Key\+::set (\begin{DoxyParamCaption}\item[{T}]{x }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set a key value. 

Set the value for {\ttfamily key} as {\ttfamily new\+String\+Value}. The function will allocate and save a private copy of {\ttfamily new\+String\+Value}, so the parameter can be freed after the call.

String values will be saved in backend storage in UTF-\/8 universal encoding, regardless of the program\textquotesingle{}s current encoding (if the iconv plugin is available).

\begin{DoxyPrecond}{Precondition}
{\ttfamily new\+String\+Value} is a NULL terminated string 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
Value of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} is set to the UTF-\/8 encoded value of {\ttfamily new\+String\+Value} 

Metakey {\ttfamily meta\+:/binary} is cleared
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} for which to set the string value \\
\hline
{\em new\+String\+Value} & NULL-\/terminated string to be set as {\ttfamily key\textquotesingle{}s} value\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of bytes actually saved in private struct including final NULL 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 1} & if {\ttfamily new\+String\+Value} is a NULL pointer, this will make the string empty (string only containing null termination) \\
\hline
{\em -\/1} & if {\ttfamily key} is a NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_ga880936f2481d28e6e2acbe7486a21d05}{key\+String()}} for getting a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 

\mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} for getting a \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 

\mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}} for setting binary data
\end{DoxySeeAlso}
This method tries to deserialise the string to the given type. \mbox{\Hypertarget{classkdb_1_1Key_a0c8c7cef03d6482d89973be72fb3c8b8}\label{classkdb_1_1Key_a0c8c7cef03d6482d89973be72fb3c8b8}} 
\index{kdb::Key@{kdb::Key}!setBaseName@{setBaseName}}
\index{setBaseName@{setBaseName}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{setBaseName()}{setBaseName()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::set\+Base\+Name (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{base\+Name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Sets a base name for a key. 

Sets {\ttfamily base\+Name} as the new basename for {\ttfamily key}. Only the basename of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} will be affected.

A simple example is\+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\mbox{\hyperlink{classkdb_1_1Key_a5679f5cae63caddd64a60388b9cc77fa}{Key}} * k = \mbox{\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}} (\textcolor{stringliteral}{"{}user:/my/long/name"{}}, \mbox{\hyperlink{group__key_gga9b703ca49f48b482def322b77d3e6bc8aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}});}
\DoxyCodeLine{\mbox{\hyperlink{group__keyname_ga6e804bd453f98c28b0ff51430d1df407}{keySetBaseName}} (k, \textcolor{stringliteral}{"{}myname"{}});}
\DoxyCodeLine{printf (\textcolor{stringliteral}{"{}\%s\(\backslash\)n"{}}, \mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (k)); \textcolor{comment}{// will print user:/my/long/myname}}
\DoxyCodeLine{\mbox{\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}} (k);}

\end{DoxyCodeInclude}
 All text after the last {\ttfamily \textquotesingle{}/\textquotesingle{}} in the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name is erased and {\ttfamily base\+Name} is appended. If {\ttfamily base\+Name} is 0 (NULL), then the last part of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name is removed without replacement. The root name of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} will not be removed though.

Let us suppose {\ttfamily key} has name {\ttfamily \char`\"{}system\+:/dir1/dir2/key1\char`\"{}}. If {\ttfamily base\+Name} is {\ttfamily \char`\"{}key2\char`\"{}}, the resulting key name will be {\ttfamily \char`\"{}system\+:/dir1/dir2/key2\char`\"{}}. If {\ttfamily base\+Name} is 0 (NULL), the resulting key name will be {\ttfamily \char`\"{}system\+:/dir1/dir2\char`\"{}}. If {\ttfamily base\+Name} is empty, the resulting key name will be {\ttfamily \char`\"{}system\+:/dir1/dir2/\%\char`\"{}}, where {\ttfamily \char`\"{}\%\char`\"{}} denotes an empty base name, as also shown in the following code\+:


\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{keySetName}} (k, \textcolor{stringliteral}{"{}system:/valid"{}});}
\DoxyCodeLine{        \mbox{\hyperlink{group__keyname_ga6e804bd453f98c28b0ff51430d1df407}{keySetBaseName}} (k, \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{        succeed\_if\_same\_string (\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName}} (k), \textcolor{stringliteral}{"{}system:/\%"{}});}
\DoxyCodeLine{        succeed\_if\_same\_string (\mbox{\hyperlink{group__keyname_gaaff35e7ca8af5560c47e662ceb9465f5}{keyBaseName}} (k), \textcolor{stringliteral}{"{}"{}});}

\end{DoxyCodeInclude}
 \mbox{\hyperlink{group__keyname_ga6e804bd453f98c28b0ff51430d1df407}{key\+Set\+Base\+Name()}} does proper escaping on the supplied name argument.

You can use character sequences as {\ttfamily base\+Name} (e.\+g. {\ttfamily \char`\"{}.\char`\"{}} (dot), {\ttfamily \char`\"{}..\char`\"{}} (dot-\/dot), {\ttfamily \char`\"{}\%\char`\"{}} (empty basename)). They will be properly escaped and will not have their usual meaning.

If you want to add to the basename instead of changing it, use \mbox{\hyperlink{group__keyname_gaa942091fc4bd5c2699e49ddc50829524}{key\+Add\+Base\+Name()}}. If you do not want any escaping, use \mbox{\hyperlink{group__keyname_gaa70593a2c772c4b7bc33423b9b10a270}{key\+Add\+Name()}}.


\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} whose basename to set \\
\hline
{\em base\+Name} & the new basename for the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the size in bytes of the new key name 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & if \mbox{\hyperlink{classkdb_1_1Key}{Key}} is NULL \\
\hline
{\em -\/1} & if \mbox{\hyperlink{classkdb_1_1Key}{Key}} was inserted into \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}} before \\
\hline
{\em -\/1} & if \mbox{\hyperlink{classkdb_1_1Key}{Key}} is read-\/only \\
\hline
{\em -\/1} & on allocation errors\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyname_gaa942091fc4bd5c2699e49ddc50829524}{key\+Add\+Base\+Name()}} for adding a basename instead of changing it 

\mbox{\hyperlink{group__keyname_gaa70593a2c772c4b7bc33423b9b10a270}{key\+Add\+Name()}} for adding a name without escaping 

\mbox{\hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}} for setting a completely new name 

\mbox{\hyperlink{group__keyname}{Name Manipulation Methods}} for more details on special names
\end{DoxySeeAlso}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Invalid\+Name} & if the name is not valid \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{classkdb_1_1Key_af7211129a4b95f4d1e335dcd06e9bf0a}\label{classkdb_1_1Key_af7211129a4b95f4d1e335dcd06e9bf0a}} 
\index{kdb::Key@{kdb::Key}!setBinary@{setBinary}}
\index{setBinary@{setBinary}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{setBinary()}{setBinary()}}
{\footnotesize\ttfamily ssize\+\_\+t kdb\+::\+Key\+::set\+Binary (\begin{DoxyParamCaption}\item[{const void $\ast$}]{new\+Binary,  }\item[{size\+\_\+t}]{data\+Size }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the value of a \mbox{\hyperlink{classkdb_1_1Key}{Key}} to the binary value {\ttfamily new\+Binary}. 

A private copy of {\ttfamily new\+Binary} will be allocated and saved inside {\ttfamily key}, so the parameter can be deallocated after the call.

Binary values might be encoded in another way than string values depending on the plugin. Typically character encodings should not take place on binary data. Consider using a string \mbox{\hyperlink{classkdb_1_1Key}{Key}} instead, if encoding should occur.

When {\ttfamily new\+Binary} is a NULL pointer the value will be freed and 0 will be returned.

Read-\/only keys will stay unchanged after calling this function.

\begin{DoxyNote}{Note}
The metadata \char`\"{}binary\char`\"{} will be set to mark that the key is binary from now on. When the \mbox{\hyperlink{classkdb_1_1Key}{Key}} is already binary the metadata won\textquotesingle{}t be changed. This will only happen in the successful case, but not when -\/1 is returned.
\end{DoxyNote}
\begin{DoxyPrecond}{Precondition}
{\ttfamily data\+Size} matches the length of {\ttfamily new\+Binary} 

{\ttfamily new\+Binary} is not NULL and {\ttfamily data\+Size} $>$ 0 

{\ttfamily key} is not read-\/only 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
{\ttfamily key\textquotesingle{}s} value set exactly to the data in {\ttfamily new\+Binary} 

\char`\"{}binary\char`\"{} key set in {\ttfamily key\textquotesingle{}s} metadata
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} object where the value should be set \\
\hline
{\em new\+Binary} & a pointer to any binary data or NULL (to clear the stored value) \\
\hline
{\em data\+Size} & number of bytes to copy from {\ttfamily new\+Binary} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of bytes actually copied to internal struct storage 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & when the internal binary was freed and is now a null pointer \\
\hline
{\em -\/1} & if {\ttfamily key} is NULL \\
\hline
{\em -\/1} & when {\ttfamily data\+Size} is 0 (and new\+Binary not NULL) or larger than SSIZE\+\_\+\+MAX \\
\hline
{\em -\/1} & if {\ttfamily key} is read-\/only\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_ga4c0d8a4a11174197699c231e0b5c3c84}{key\+Get\+Binary()}} for getting a \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value as binary 

\mbox{\hyperlink{group__keytest_ga9526b371087564e43e3dff8ad0dac949}{key\+Is\+Binary()}} to check if the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value is binary 

\mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} and \mbox{\hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{key\+Set\+String()}} for working with string values 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a4c5a3d463127ade0b766c4298002daa3}\label{classkdb_1_1Key_a4c5a3d463127ade0b766c4298002daa3}} 
\index{kdb::Key@{kdb::Key}!setMeta@{setMeta}}
\index{setMeta@{setMeta}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{setMeta()}{setMeta()}}
{\footnotesize\ttfamily template$<$class T $>$ \\
void kdb\+::\+Key\+::set\+Meta (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{meta\+Name,  }\item[{T}]{x }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set metadata for key. 

Set a new metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}}. Will set a new metadata pair with name {\ttfamily meta\+Name} and value {\ttfamily new\+Meta\+String}.

Will add a new metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}}, if {\ttfamily meta\+Name} was unused until now.

It will modify an existing Pair of metadata if {\ttfamily meta\+Name} was already present.

It will remove a metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}} if {\ttfamily new\+Meta\+String} is 0.

If {\ttfamily meta\+Name} does not start with \textquotesingle{}meta\+:/\textquotesingle{}, it will be prefixed with \textquotesingle{}meta\+:/\textquotesingle{}.

\begin{DoxyPrecond}{Precondition}
{\ttfamily meta\+Name} is prefixed with \char`\"{}meta\+:/\char`\"{} 

{\ttfamily key\textquotesingle{}s} metadata is not read-\/only 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
The value in {\ttfamily key\textquotesingle{}s} metadata Keyset for {\ttfamily meta\+Name} is {\ttfamily new\+Meta\+String} 
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & \mbox{\hyperlink{classkdb_1_1Key}{Key}} whose metadata should be set \\
\hline
{\em meta\+Name} & name of the metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}} that should be set \\
\hline
{\em new\+Meta\+String} & new value for the metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
size ($>$0) of {\ttfamily new\+Meta\+String} if metadata has been successfully added 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & if the meta-\/information for meta\+Name was removed \\
\hline
{\em -\/1} & if key or meta\+Name is 0 \\
\hline
{\em -\/1} & if system is out of memory \\
\hline
{\em -\/1} & if {\ttfamily meta\+Name} is not a valid metadata name\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keymeta_ga9ed3875495ddb3d8a8d29158a60a147c}{key\+Get\+Meta()}} for getting the value of a metadata \mbox{\hyperlink{classkdb_1_1Key}{Key}} 

\mbox{\hyperlink{group__keymeta_ga11706f1753e67933f7cffc5c0345cd29}{key\+Meta()}} for getting the \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}} containing metadata
\end{DoxySeeAlso}
\begin{DoxyWarning}{Warning}
unlike the C Interface, it is not possible to remove metadata with this method. k.\+set\+Meta(\char`\"{}something\char`\"{}, NULL) will lead to set the number 0 or to something different (may depend on compiler definition of NULL). See discussion in Issue \href{https://github.com/ElektraInitiative/libelektra/issues/8}{\texttt{ https\+://github.\+com/\+Elektra\+Initiative/libelektra/issues/8}}
\end{DoxyWarning}
Use \mbox{\hyperlink{classkdb_1_1Key_a2305da805095605aca38d53f2733fb57}{del\+Meta()}} to avoid these issues.

\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{classkdb_1_1Key_a2305da805095605aca38d53f2733fb57}{del\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_acdd4e81b0565756c99826bf926fd6fe4}{get\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_a53f6d2196a7f17c4bdc544207bdc5f4c}{copy\+Meta()}}, \mbox{\hyperlink{classkdb_1_1Key_aec0910bf293db33deac6a3f81359cb48}{copy\+All\+Meta()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_aac3b5d3a854d02187484bfbdbdf975af}\label{classkdb_1_1Key_aac3b5d3a854d02187484bfbdbdf975af}} 
\index{kdb::Key@{kdb::Key}!setName@{setName}}
\index{setName@{setName}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{setName()}{setName()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::set\+Name (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{new\+Name }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set a new name to a \mbox{\hyperlink{classkdb_1_1Key}{Key}}. 

A valid name is one of the forms\+:
\begin{DoxyItemize}
\item {\ttfamily spec\+:/something} for specification of other keys.
\item {\ttfamily proc\+:/something} for in-\/memory keys, e.\+g. commandline.
\item {\ttfamily dir\+:/something} for dir keys in current working directory
\item {\ttfamily system\+:/something} for system keys in /etc or /
\item {\ttfamily user\+:/something} for user keys in home directory
\item {\ttfamily user\+:username/something} for other users (deprecated\+: \mbox{\hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}} + \mbox{\hyperlink{group__kdb_ga11436b058408f83d303ca5e996832bcf}{kdb\+Set()}} currently unsupported)
\item {\ttfamily /something} for cascading keys (actually refers to one of the above, see also \mbox{\hyperlink{group__keyset_ga60f1ddcf23272f2b29b90e92ebe9b56f}{ks\+Lookup()}})
\end{DoxyItemize}

An invalid name either has an invalid namespace or a wrongly escaped \textbackslash{} at the end of the name.

See \mbox{\hyperlink{group__keyname}{key names }} for the exact rules.

The last form has explicitly set the owner, to let the library know in which user folder to save the \mbox{\hyperlink{classkdb_1_1Key}{Key}}. A owner is a user name. If it is not defined (the second form), current user is used.

You should always follow the guidelines for \mbox{\hyperlink{classkdb_1_1Key}{Key}} tree structure creation.

A private copy of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} name will be stored, and the {\ttfamily new\+Name} parameter can be freed after this call.

.., . and / will be handled as in filesystem paths. A valid name will be build out of the (valid) name what you pass, e.\+g. user\+:///sw/../sw//././\+My\+App -\/$>$ user\+:/sw/\+My\+App

Trailing slashes will be stripped.

On invalid names, the name stays unchanged.

\begin{DoxyReturn}{Returns}
size of the new \mbox{\hyperlink{classkdb_1_1Key}{Key}} name in bytes, including NULL terminator 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & if {\ttfamily key} or {\ttfamily key\+Name} is NULL or {\ttfamily key\+Name} is empty or invalid \\
\hline
{\em -\/1} & if \mbox{\hyperlink{classkdb_1_1Key}{Key}} was inserted to a \mbox{\hyperlink{classkdb_1_1KeySet}{Key\+Set}} before \\
\hline
{\em -\/1} & if \mbox{\hyperlink{classkdb_1_1Key}{Key}} name is read-\/only\\
\hline
\end{DoxyRetVals}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} whose name to set \\
\hline
{\em new\+Name} & the new name for the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\\
\hline
\end{DoxyParams}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyname_gab29a850168d9b31c9529e90cf9ab68be}{key\+Get\+Name()}} for getting a \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name 

\mbox{\hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{key\+Name()}} for getting a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s name 

\mbox{\hyperlink{group__keyname_ga6e804bd453f98c28b0ff51430d1df407}{key\+Set\+Base\+Name()}}, \mbox{\hyperlink{group__keyname_gaa942091fc4bd5c2699e49ddc50829524}{key\+Add\+Base\+Name()}} for manipulating the base name
\end{DoxySeeAlso}

\begin{DoxyExceptions}{Exceptions}
{\em Key\+Invalid\+Name} & if the name is not valid \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{classkdb_1_1Key_a50586fabaaf3531ab19b0e9c03f08dcb}\label{classkdb_1_1Key_a50586fabaaf3531ab19b0e9c03f08dcb}} 
\index{kdb::Key@{kdb::Key}!setNamespace@{setNamespace}}
\index{setNamespace@{setNamespace}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{setNamespace()}{setNamespace()}}
{\footnotesize\ttfamily ssize\+\_\+t kdb\+::\+Key\+::set\+Namespace (\begin{DoxyParamCaption}\item[{Elektra\+Namespace}]{ns }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Set the namespace of the key. 

\begin{DoxySeeAlso}{See also}
Elektra\+Namespace, \mbox{\hyperlink{group__keyname_ga98c1c1307419e689c98e556e5c542073}{key\+Set\+Namespace}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{classkdb_1_1Key_a18df1f7a447b999fae5faf32fc1ab893}\label{classkdb_1_1Key_a18df1f7a447b999fae5faf32fc1ab893}} 
\index{kdb::Key@{kdb::Key}!setString@{setString}}
\index{setString@{setString}!kdb::Key@{kdb::Key}}
\doxysubsubsection{\texorpdfstring{setString()}{setString()}}
{\footnotesize\ttfamily void kdb\+::\+Key\+::set\+String (\begin{DoxyParamCaption}\item[{const char $\ast$}]{new\+String }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the value for {\ttfamily key} as {\ttfamily new\+String\+Value}. 

The function will allocate and save a private copy of {\ttfamily new\+String\+Value}, so the parameter can be freed after the call.

String values will be saved in backend storage in UTF-\/8 universal encoding, regardless of the program\textquotesingle{}s current encoding (if the iconv plugin is available).

\begin{DoxyPrecond}{Precondition}
{\ttfamily new\+String\+Value} is a NULL terminated string 
\end{DoxyPrecond}
\begin{DoxyPostcond}{Postcondition}
Value of the \mbox{\hyperlink{classkdb_1_1Key}{Key}} is set to the UTF-\/8 encoded value of {\ttfamily new\+String\+Value} 

Metakey {\ttfamily meta\+:/binary} is cleared
\end{DoxyPostcond}

\begin{DoxyParams}{Parameters}
{\em key} & the \mbox{\hyperlink{classkdb_1_1Key}{Key}} for which to set the string value \\
\hline
{\em new\+String\+Value} & NULL-\/terminated string to be set as {\ttfamily key\textquotesingle{}s} value\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of bytes actually saved in private struct including final NULL 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 1} & if {\ttfamily new\+String\+Value} is a NULL pointer, this will make the string empty (string only containing null termination) \\
\hline
{\em -\/1} & if {\ttfamily key} is a NULL pointer\\
\hline
\end{DoxyRetVals}
\begin{DoxySince}{Since}
1.\+0.\+0
\end{DoxySince}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__keyvalue_ga880936f2481d28e6e2acbe7486a21d05}{key\+String()}} for getting a pointer to the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 

\mbox{\hyperlink{group__keyvalue_ga41b9fac5ccddafe407fc0ae1e2eb8778}{key\+Get\+String()}} for getting a \mbox{\hyperlink{classkdb_1_1Key_a0aa7da64aac085e0eff5912fec977848}{copy}} of the \mbox{\hyperlink{classkdb_1_1Key}{Key}}\textquotesingle{}s value 

\mbox{\hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}} for setting binary data 
\end{DoxySeeAlso}


The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{key_8hpp}{key.\+hpp}}\item 
\mbox{\hyperlink{kdbvalue_8hpp}{kdbvalue.\+hpp}}\end{DoxyCompactItemize}
