\hypertarget{group__key}{}\section{Key}
\label{group__key}\index{Key@{Key}}


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


Collaboration diagram for Key\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=303pt]{group__key}
\end{center}
\end{figure}
\subsection*{Modules}
\begin{DoxyCompactItemize}
\item 
\hyperlink{group__keymeta}{Meta Info Manipulation Methods}
\begin{DoxyCompactList}\small\item\em Methods to do various operations on Key metadata. \end{DoxyCompactList}\item 
\hyperlink{group__keytest}{Methods for Making Tests}
\begin{DoxyCompactList}\small\item\em Methods to do various tests on Keys. \end{DoxyCompactList}\item 
\hyperlink{group__keyname}{Name Manipulation Methods}
\begin{DoxyCompactList}\small\item\em Methods to do various operations on Key names. \end{DoxyCompactList}\item 
\hyperlink{group__keyvalue}{Value Manipulation Methods}
\begin{DoxyCompactList}\small\item\em Methods to do various operations on Key values. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{group__key_ga91fb3178848bd682000958089abbaf40}{keyswitch\+\_\+t} \{ \newline
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ad6127fc38f96410bf7c8f6e93b0397da}{K\+E\+Y\+\_\+\+N\+A\+ME} =1, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{K\+E\+Y\+\_\+\+V\+A\+L\+UE} =1$<$$<$1, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a4b83f86a07a7a0d6e24ecafe43cfea1b}{K\+E\+Y\+\_\+\+F\+L\+A\+GS} =3, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a77ca60362fa8daca8d5347db4385068b}{K\+E\+Y\+\_\+\+O\+W\+N\+ER} =1$<$$<$2, 
\newline
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac29427bb47cc31689d02912e36161ee3}{K\+E\+Y\+\_\+\+C\+O\+M\+M\+E\+NT} =1$<$$<$3, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1ca18d4e094ae7487d35ecedda2235ff}{K\+E\+Y\+\_\+\+B\+I\+N\+A\+RY} =1$<$$<$4, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a28f01a87d65f065172f734c9c9446c0e}{K\+E\+Y\+\_\+\+U\+ID} =1$<$$<$5, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac0628bbaba7c837ca73323681393d15f}{K\+E\+Y\+\_\+\+G\+ID} =1$<$$<$6, 
\newline
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1b0a91ff3a855d6993930ebf0abaa518}{K\+E\+Y\+\_\+\+M\+O\+DE} =1$<$$<$7, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40af303f9ebb4983d7500ba8e06ef3ec178}{K\+E\+Y\+\_\+\+A\+T\+I\+ME} =1$<$$<$8, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40abfbab4bf55be6c53a7ffb2e43a82b355}{K\+E\+Y\+\_\+\+M\+T\+I\+ME} =1$<$$<$9, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40afbad53ecfc1512b1b49ca04b57a628b4}{K\+E\+Y\+\_\+\+C\+T\+I\+ME} =1$<$$<$10, 
\newline
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}{K\+E\+Y\+\_\+\+S\+I\+ZE} =1$<$$<$11, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a9e43e47c8a21478538e2d20e049981d5}{K\+E\+Y\+\_\+\+D\+IR} =1$<$$<$14, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{K\+E\+Y\+\_\+\+M\+E\+TA} =1$<$$<$15, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ab089c5e7977d6e58737eb586ee153b7f}{K\+E\+Y\+\_\+\+N\+U\+LL} =1$<$$<$16, 
\newline
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40afc1567f74444ff9c219f7456b652b4ec}{K\+E\+Y\+\_\+\+C\+A\+S\+C\+A\+D\+I\+N\+G\+\_\+\+N\+A\+ME} =1$<$$<$20, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a5205cbd2831bc881da3589a95c08e054}{K\+E\+Y\+\_\+\+M\+E\+T\+A\+\_\+\+N\+A\+ME} =1$<$$<$21, 
\hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{K\+E\+Y\+\_\+\+E\+ND} =0
 \}\begin{DoxyCompactList}\small\item\em Allows \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} to determine which information comes next. \end{DoxyCompactList}
\item 
enum \hyperlink{group__key_gaec3b8d6f430ae49b91bafe8a86310a68}{elektra\+Namespace} \{ \newline
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a3659698b0a07454ca8055ab693e8efd1}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+N\+O\+NE} =0, 
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a33d6c53529b4e6921d0b1d6565df2f1f}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+E\+M\+P\+TY} =1, 
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ac5fbf2c3a7ae79fa2d60c48ae3e72688}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+M\+E\+TA} =2, 
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a2c9133e3095dccbcde5ca3bb13987b5d}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+C\+A\+S\+C\+A\+D\+I\+NG} =3, 
\newline
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ae06281f94c2b7a221115afbaa1e0ff45}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+F\+I\+R\+ST} =4, 
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a2be047b124b1ca0e92b5ef124169f0d2}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+P\+EC} =4, 
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a470ecc9254fcdfccf9923a3e526c9c11}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+P\+R\+OC} =5, 
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68aa0006cf27dbb2586bafba6ff1ae4f4ec}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+D\+IR} =6, 
\newline
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a8ce23c70010e8ac8bb540b0947e03a4e}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+U\+S\+ER} =7, 
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a61adca2f9dff47e65dfcdb492ffa7a20}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+Y\+S\+T\+EM} =8, 
\hyperlink{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ad4d0f219a657517ddd50cd06c8190310}{K\+E\+Y\+\_\+\+N\+S\+\_\+\+L\+A\+ST} =8
 \}\begin{DoxyCompactList}\small\item\em Elektra currently supported Key namespaces. \end{DoxyCompactList}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
Key $\ast$ \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New} (const char $\ast$name,...)
\begin{DoxyCompactList}\small\item\em A practical way to fully create a Key object in one step. \end{DoxyCompactList}\item 
Key $\ast$ \hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{key\+Dup} (const Key $\ast$source)
\begin{DoxyCompactList}\small\item\em Return a duplicate of a key. \end{DoxyCompactList}\item 
int \hyperlink{group__key_ga6a12cbbe656a1ad9f41b8c681d7a2f92}{key\+Copy} (Key $\ast$dest, const Key $\ast$source)
\begin{DoxyCompactList}\small\item\em Copy or Clear a key. \end{DoxyCompactList}\item 
int \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del} (Key $\ast$key)
\begin{DoxyCompactList}\small\item\em A destructor for Key objects. \end{DoxyCompactList}\item 
int \hyperlink{group__key_gab2242311a36bbc0520e0d36895107ec1}{key\+Clear} (Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Key Object Cleaner. \end{DoxyCompactList}\item 
ssize\+\_\+t \hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref} (Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Increment the viability of a key object. \end{DoxyCompactList}\item 
ssize\+\_\+t \hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{key\+Dec\+Ref} (Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Decrement the viability of a key object. \end{DoxyCompactList}\item 
ssize\+\_\+t \hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Return how many references the key has. \end{DoxyCompactList}\end{DoxyCompactItemize}


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

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


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

\begin{DoxyParagraph}{A\+BI}
Due to A\+BI compatibility, the {\ttfamily 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 \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} and \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()} respectively.
\end{DoxyParagraph}
\begin{DoxyParagraph}{Reference Counting}
Every key has its reference counter (see \hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()} for longer explanation) that will be initialized with 0, that means a subsequent call of \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 \hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}) and the key can\textquotesingle{}t be deleted by a \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}.
\end{DoxyParagraph}
\begin{DoxyParagraph}{}
As you can imagine this refcounting allows you to put the 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}


\subsection{Enumeration Type Documentation}
\mbox{\Hypertarget{group__key_gaec3b8d6f430ae49b91bafe8a86310a68}\label{group__key_gaec3b8d6f430ae49b91bafe8a86310a68}} 
\index{Key@{Key}!elektra\+Namespace@{elektra\+Namespace}}
\index{elektra\+Namespace@{elektra\+Namespace}!Key@{Key}}
\subsubsection{\texorpdfstring{elektra\+Namespace}{elektraNamespace}}
{\footnotesize\ttfamily enum \hyperlink{group__key_gaec3b8d6f430ae49b91bafe8a86310a68}{elektra\+Namespace}}



Elektra currently supported Key namespaces. 

\begin{DoxySeeAlso}{See also}
\hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()}, \hyperlink{group__keyname_gafc3ca03ed10f87eb59bdc02cf2a0de8d}{key\+Get\+Namespace()} 
\end{DoxySeeAlso}
\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+N\+O\+NE@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+N\+O\+NE}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+N\+O\+NE@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+N\+O\+NE}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a3659698b0a07454ca8055ab693e8efd1}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a3659698b0a07454ca8055ab693e8efd1}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+N\+O\+NE&no key given as parameter to \hyperlink{group__keyname_gafc3ca03ed10f87eb59bdc02cf2a0de8d}{key\+Get\+Namespace()} \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+E\+M\+P\+TY@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+E\+M\+P\+TY}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+E\+M\+P\+TY@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+E\+M\+P\+TY}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a33d6c53529b4e6921d0b1d6565df2f1f}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a33d6c53529b4e6921d0b1d6565df2f1f}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+E\+M\+P\+TY&key name was empty, e.\+g. invalid key name \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+M\+E\+TA@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+M\+E\+TA}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+M\+E\+TA@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+M\+E\+TA}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ac5fbf2c3a7ae79fa2d60c48ae3e72688}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ac5fbf2c3a7ae79fa2d60c48ae3e72688}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+M\+E\+TA&metakey, i.\+e. any key name not under other categories \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+C\+A\+S\+C\+A\+D\+I\+NG@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+C\+A\+S\+C\+A\+D\+I\+NG}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+C\+A\+S\+C\+A\+D\+I\+NG@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+C\+A\+S\+C\+A\+D\+I\+NG}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a2c9133e3095dccbcde5ca3bb13987b5d}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a2c9133e3095dccbcde5ca3bb13987b5d}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+C\+A\+S\+C\+A\+D\+I\+NG&cascading key, starts with /, abstract name for any of the namespaces below \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+F\+I\+R\+ST@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+F\+I\+R\+ST}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+F\+I\+R\+ST@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+F\+I\+R\+ST}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ae06281f94c2b7a221115afbaa1e0ff45}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ae06281f94c2b7a221115afbaa1e0ff45}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+F\+I\+R\+ST&For iteration over namespaces (first element, inclusive) \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+P\+EC@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+P\+EC}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+P\+EC@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+P\+EC}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a2be047b124b1ca0e92b5ef124169f0d2}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a2be047b124b1ca0e92b5ef124169f0d2}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+P\+EC&spec contains the specification of the other namespaces \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+P\+R\+OC@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+P\+R\+OC}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+P\+R\+OC@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+P\+R\+OC}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a470ecc9254fcdfccf9923a3e526c9c11}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a470ecc9254fcdfccf9923a3e526c9c11}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+P\+R\+OC&proc contains process-\/specific configuration \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+D\+IR@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+D\+IR}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+D\+IR@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+D\+IR}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68aa0006cf27dbb2586bafba6ff1ae4f4ec}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68aa0006cf27dbb2586bafba6ff1ae4f4ec}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+D\+IR&dir contains configuration from a specific directory \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+U\+S\+ER@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+U\+S\+ER}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+U\+S\+ER@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+U\+S\+ER}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a8ce23c70010e8ac8bb540b0947e03a4e}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a8ce23c70010e8ac8bb540b0947e03a4e}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+U\+S\+ER&user key in the home directory of the current user \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+Y\+S\+T\+EM@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+Y\+S\+T\+EM}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+Y\+S\+T\+EM@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+Y\+S\+T\+EM}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a61adca2f9dff47e65dfcdb492ffa7a20}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68a61adca2f9dff47e65dfcdb492ffa7a20}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+S\+Y\+S\+T\+EM&system key is shared for a computer system \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+S\+\_\+\+L\+A\+ST@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+L\+A\+ST}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+S\+\_\+\+L\+A\+ST@{K\+E\+Y\+\_\+\+N\+S\+\_\+\+L\+A\+ST}}}\mbox{\Hypertarget{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ad4d0f219a657517ddd50cd06c8190310}\label{group__key_ggaec3b8d6f430ae49b91bafe8a86310a68ad4d0f219a657517ddd50cd06c8190310}} 
K\+E\+Y\+\_\+\+N\+S\+\_\+\+L\+A\+ST&For iteration over namespaces (last element, inclusive) \\
\hline

\end{DoxyEnumFields}
\mbox{\Hypertarget{group__key_ga91fb3178848bd682000958089abbaf40}\label{group__key_ga91fb3178848bd682000958089abbaf40}} 
\index{Key@{Key}!keyswitch\+\_\+t@{keyswitch\+\_\+t}}
\index{keyswitch\+\_\+t@{keyswitch\+\_\+t}!Key@{Key}}
\subsubsection{\texorpdfstring{keyswitch\+\_\+t}{keyswitch\_t}}
{\footnotesize\ttfamily enum \hyperlink{group__key_ga91fb3178848bd682000958089abbaf40}{keyswitch\+\_\+t}}



Allows \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} to determine which information comes next. 

\begin{DoxySeeAlso}{See also}
\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} 
\end{DoxySeeAlso}
\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+A\+ME@{K\+E\+Y\+\_\+\+N\+A\+ME}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+A\+ME@{K\+E\+Y\+\_\+\+N\+A\+ME}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40ad6127fc38f96410bf7c8f6e93b0397da}\label{group__key_gga91fb3178848bd682000958089abbaf40ad6127fc38f96410bf7c8f6e93b0397da}} 
K\+E\+Y\+\_\+\+N\+A\+ME&Flag for the key name \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+V\+A\+L\+UE@{K\+E\+Y\+\_\+\+V\+A\+L\+UE}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+V\+A\+L\+UE@{K\+E\+Y\+\_\+\+V\+A\+L\+UE}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}\label{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}} 
K\+E\+Y\+\_\+\+V\+A\+L\+UE&Flag for the key data \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+F\+L\+A\+GS@{K\+E\+Y\+\_\+\+F\+L\+A\+GS}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+F\+L\+A\+GS@{K\+E\+Y\+\_\+\+F\+L\+A\+GS}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a4b83f86a07a7a0d6e24ecafe43cfea1b}\label{group__key_gga91fb3178848bd682000958089abbaf40a4b83f86a07a7a0d6e24ecafe43cfea1b}} 
K\+E\+Y\+\_\+\+F\+L\+A\+GS&Allows to define multiple flags at once. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+O\+W\+N\+ER@{K\+E\+Y\+\_\+\+O\+W\+N\+ER}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+O\+W\+N\+ER@{K\+E\+Y\+\_\+\+O\+W\+N\+ER}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a77ca60362fa8daca8d5347db4385068b}\label{group__key_gga91fb3178848bd682000958089abbaf40a77ca60362fa8daca8d5347db4385068b}} 
K\+E\+Y\+\_\+\+O\+W\+N\+ER&Flag for the key user domain \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+C\+O\+M\+M\+E\+NT@{K\+E\+Y\+\_\+\+C\+O\+M\+M\+E\+NT}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+C\+O\+M\+M\+E\+NT@{K\+E\+Y\+\_\+\+C\+O\+M\+M\+E\+NT}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40ac29427bb47cc31689d02912e36161ee3}\label{group__key_gga91fb3178848bd682000958089abbaf40ac29427bb47cc31689d02912e36161ee3}} 
K\+E\+Y\+\_\+\+C\+O\+M\+M\+E\+NT&Flag for the key comment \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+B\+I\+N\+A\+RY@{K\+E\+Y\+\_\+\+B\+I\+N\+A\+RY}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+B\+I\+N\+A\+RY@{K\+E\+Y\+\_\+\+B\+I\+N\+A\+RY}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a1ca18d4e094ae7487d35ecedda2235ff}\label{group__key_gga91fb3178848bd682000958089abbaf40a1ca18d4e094ae7487d35ecedda2235ff}} 
K\+E\+Y\+\_\+\+B\+I\+N\+A\+RY&Flag if the key is binary \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+U\+ID@{K\+E\+Y\+\_\+\+U\+ID}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+U\+ID@{K\+E\+Y\+\_\+\+U\+ID}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a28f01a87d65f065172f734c9c9446c0e}\label{group__key_gga91fb3178848bd682000958089abbaf40a28f01a87d65f065172f734c9c9446c0e}} 
K\+E\+Y\+\_\+\+U\+ID&Flag for the key U\+ID\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000001}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+G\+ID@{K\+E\+Y\+\_\+\+G\+ID}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+G\+ID@{K\+E\+Y\+\_\+\+G\+ID}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40ac0628bbaba7c837ca73323681393d15f}\label{group__key_gga91fb3178848bd682000958089abbaf40ac0628bbaba7c837ca73323681393d15f}} 
K\+E\+Y\+\_\+\+G\+ID&Flag for the key G\+ID\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000002}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+M\+O\+DE@{K\+E\+Y\+\_\+\+M\+O\+DE}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+M\+O\+DE@{K\+E\+Y\+\_\+\+M\+O\+DE}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a1b0a91ff3a855d6993930ebf0abaa518}\label{group__key_gga91fb3178848bd682000958089abbaf40a1b0a91ff3a855d6993930ebf0abaa518}} 
K\+E\+Y\+\_\+\+M\+O\+DE&Flag for the key permissions\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000003}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+A\+T\+I\+ME@{K\+E\+Y\+\_\+\+A\+T\+I\+ME}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+A\+T\+I\+ME@{K\+E\+Y\+\_\+\+A\+T\+I\+ME}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40af303f9ebb4983d7500ba8e06ef3ec178}\label{group__key_gga91fb3178848bd682000958089abbaf40af303f9ebb4983d7500ba8e06ef3ec178}} 
K\+E\+Y\+\_\+\+A\+T\+I\+ME&Flag for the key access time\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000004}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+M\+T\+I\+ME@{K\+E\+Y\+\_\+\+M\+T\+I\+ME}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+M\+T\+I\+ME@{K\+E\+Y\+\_\+\+M\+T\+I\+ME}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40abfbab4bf55be6c53a7ffb2e43a82b355}\label{group__key_gga91fb3178848bd682000958089abbaf40abfbab4bf55be6c53a7ffb2e43a82b355}} 
K\+E\+Y\+\_\+\+M\+T\+I\+ME&Flag for the key change time\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000005}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+C\+T\+I\+ME@{K\+E\+Y\+\_\+\+C\+T\+I\+ME}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+C\+T\+I\+ME@{K\+E\+Y\+\_\+\+C\+T\+I\+ME}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40afbad53ecfc1512b1b49ca04b57a628b4}\label{group__key_gga91fb3178848bd682000958089abbaf40afbad53ecfc1512b1b49ca04b57a628b4}} 
K\+E\+Y\+\_\+\+C\+T\+I\+ME&Flag for the key status change time\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000006}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+S\+I\+ZE@{K\+E\+Y\+\_\+\+S\+I\+ZE}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+S\+I\+ZE@{K\+E\+Y\+\_\+\+S\+I\+ZE}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}\label{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}} 
K\+E\+Y\+\_\+\+S\+I\+ZE&Flag for maximum size to limit value \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+D\+IR@{K\+E\+Y\+\_\+\+D\+IR}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+D\+IR@{K\+E\+Y\+\_\+\+D\+IR}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a9e43e47c8a21478538e2d20e049981d5}\label{group__key_gga91fb3178848bd682000958089abbaf40a9e43e47c8a21478538e2d20e049981d5}} 
K\+E\+Y\+\_\+\+D\+IR&Flag for the key directories\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000007}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+M\+E\+TA@{K\+E\+Y\+\_\+\+M\+E\+TA}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+M\+E\+TA@{K\+E\+Y\+\_\+\+M\+E\+TA}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}\label{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}} 
K\+E\+Y\+\_\+\+M\+E\+TA&Flag for metadata \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+N\+U\+LL@{K\+E\+Y\+\_\+\+N\+U\+LL}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+N\+U\+LL@{K\+E\+Y\+\_\+\+N\+U\+LL}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40ab089c5e7977d6e58737eb586ee153b7f}\label{group__key_gga91fb3178848bd682000958089abbaf40ab089c5e7977d6e58737eb586ee153b7f}} 
K\+E\+Y\+\_\+\+N\+U\+LL&Is {\itshape not} a flag, only as return value\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000008}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+C\+A\+S\+C\+A\+D\+I\+N\+G\+\_\+\+N\+A\+ME@{K\+E\+Y\+\_\+\+C\+A\+S\+C\+A\+D\+I\+N\+G\+\_\+\+N\+A\+ME}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+C\+A\+S\+C\+A\+D\+I\+N\+G\+\_\+\+N\+A\+ME@{K\+E\+Y\+\_\+\+C\+A\+S\+C\+A\+D\+I\+N\+G\+\_\+\+N\+A\+ME}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40afc1567f74444ff9c219f7456b652b4ec}\label{group__key_gga91fb3178848bd682000958089abbaf40afc1567f74444ff9c219f7456b652b4ec}} 
K\+E\+Y\+\_\+\+C\+A\+S\+C\+A\+D\+I\+N\+G\+\_\+\+N\+A\+ME&Is default, no need to use it\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000009}{Deprecated}]do not use \end{DoxyRefDesc}
\\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+M\+E\+T\+A\+\_\+\+N\+A\+ME@{K\+E\+Y\+\_\+\+M\+E\+T\+A\+\_\+\+N\+A\+ME}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+M\+E\+T\+A\+\_\+\+N\+A\+ME@{K\+E\+Y\+\_\+\+M\+E\+T\+A\+\_\+\+N\+A\+ME}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40a5205cbd2831bc881da3589a95c08e054}\label{group__key_gga91fb3178848bd682000958089abbaf40a5205cbd2831bc881da3589a95c08e054}} 
K\+E\+Y\+\_\+\+M\+E\+T\+A\+\_\+\+N\+A\+ME&Allow any key names (not only with known namespaces+cascading \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{K\+E\+Y\+\_\+\+E\+ND@{K\+E\+Y\+\_\+\+E\+ND}!Key@{Key}}\index{Key@{Key}!K\+E\+Y\+\_\+\+E\+ND@{K\+E\+Y\+\_\+\+E\+ND}}}\mbox{\Hypertarget{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}\label{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}} 
K\+E\+Y\+\_\+\+E\+ND&Used as a parameter terminator to \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} \\
\hline

\end{DoxyEnumFields}


\subsection{Function Documentation}
\mbox{\Hypertarget{group__key_gab2242311a36bbc0520e0d36895107ec1}\label{group__key_gab2242311a36bbc0520e0d36895107ec1}} 
\index{Key@{Key}!key\+Clear@{key\+Clear}}
\index{key\+Clear@{key\+Clear}!Key@{Key}}
\subsubsection{\texorpdfstring{key\+Clear()}{keyClear()}}
{\footnotesize\ttfamily int key\+Clear (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



Key Object Cleaner. 

Will reset all internal data.

After this call you will receive a fresh key.

The reference counter will stay unmodified.

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

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



\begin{DoxyRetVals}{Return values}
{\em returns} & 0 on success \\
\hline
{\em -\/1} & on null pointer\\
\hline
\end{DoxyRetVals}

\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{group__key_ga6a12cbbe656a1ad9f41b8c681d7a2f92}\label{group__key_ga6a12cbbe656a1ad9f41b8c681d7a2f92}} 
\index{Key@{Key}!key\+Copy@{key\+Copy}}
\index{key\+Copy@{key\+Copy}!Key@{Key}}
\subsubsection{\texorpdfstring{key\+Copy()}{keyCopy()}}
{\footnotesize\ttfamily int key\+Copy (\begin{DoxyParamCaption}\item[{Key $\ast$}]{dest,  }\item[{const Key $\ast$}]{source }\end{DoxyParamCaption})}



Copy or Clear a key. 

Most often you may prefer \hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{key\+Dup()} which allocates a new key and returns a duplication of another key.

But 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}
\textcolor{keywordtype}{void} h (Key * k)
\{
        \textcolor{comment}{// receive key c}
        \hyperlink{group__key_ga6a12cbbe656a1ad9f41b8c681d7a2f92}{keyCopy} (k, c);
        \textcolor{comment}{// the caller will see the changed key k}
\}
\end{DoxyCodeInclude}
 The reference counter will not be changed for both keys. Affiliation to keysets are also not affected.

The metadata will be duplicated for the destination key. So it will not take much additional space, even with lots of metadata.

When you pass a N\+U\+L\+L-\/pointer as source the data of dest will be cleaned completely (except reference counter, see \hyperlink{group__key_gab2242311a36bbc0520e0d36895107ec1}{key\+Clear()}) and you get a fresh dest key\+:


\begin{DoxyCodeInclude}
\textcolor{keywordtype}{void} g (Key * k)
\{
        \hyperlink{group__key_ga6a12cbbe656a1ad9f41b8c681d7a2f92}{keyCopy} (k, 0);
        \textcolor{comment}{// k is now an empty and fresh key}
\}
\end{DoxyCodeInclude}
 If you want to copy everything, except e.\+g. the value you can use \hyperlink{group__key_ga6a12cbbe656a1ad9f41b8c681d7a2f92}{key\+Copy()} too\+:


\begin{DoxyCodeInclude}
\textcolor{keywordtype}{void} j (Key * k)
\{
        \textcolor{keywordtype}{size\_t} size = \hyperlink{group__keyvalue_gae326672fffb7474abfe9baf53b73217e}{keyGetValueSize} (k);
        \textcolor{keywordtype}{char} * value = malloc (size);
        \textcolor{keywordtype}{int} bstring = \hyperlink{group__keytest_gaea7670778abd07fee0fe8ac12a149190}{keyIsString} (k);

        \textcolor{comment}{// receive key c}
        memcpy (value, keyValue (k), size);
        \hyperlink{group__key_ga6a12cbbe656a1ad9f41b8c681d7a2f92}{keyCopy} (k, c);
        \textcolor{keywordflow}{if} (bstring)
                \hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{keySetString} (k, value);
        \textcolor{keywordflow}{else}
                \hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{keySetBinary} (k, value, size);
        free (value);
        \textcolor{comment}{// the caller will see the changed key k}
        \textcolor{comment}{// with the name and metadata from c (except}
        \textcolor{comment}{// metadata "binary", which stayed the same)}
\}
\end{DoxyCodeInclude}
 Restrain from coping everything yourself, because it will lead to wrong metadata and is not able to copy empty or cascading names\+:


\begin{DoxyCodeInclude}
\textcolor{keywordtype}{void} i (Key * k)
\{
        \hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{keySetName} (k, \hyperlink{group__keyname_ga8e805c726a60da921d3736cda7813513}{keyName} (c));
        \hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{keySetString} (k, \hyperlink{group__keyvalue_ga880936f2481d28e6e2acbe7486a21d05}{keyString} (c));
        \hyperlink{group__keymeta_ga8e63720a65610a29597494d0671f9401}{keyCopyAllMeta} (k, c);
        \textcolor{comment}{// k is not a copy of c even if everything was successfully,}
        \textcolor{comment}{// because it still contains metadata from k}
\}
\end{DoxyCodeInclude}



\begin{DoxyParams}{Parameters}
{\em dest} & the key which will be written to \\
\hline
{\em source} & the key which should be copied or N\+U\+LL to clean the destination key\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on failure when a N\+U\+LL pointer was passed for dest or a dynamic property could not be written. The content will be unmodified then. \\
\hline
{\em 0} & when dest was cleaned \\
\hline
{\em 1} & when source was successfully copied \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{key\+Dup()} to get a duplication of a \hyperlink{group__key}{Key} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__key_ga2c6433ca22109e4e141946057eccb283}\label{group__key_ga2c6433ca22109e4e141946057eccb283}} 
\index{Key@{Key}!key\+Dec\+Ref@{key\+Dec\+Ref}}
\index{key\+Dec\+Ref@{key\+Dec\+Ref}!Key@{Key}}
\subsubsection{\texorpdfstring{key\+Dec\+Ref()}{keyDecRef()}}
{\footnotesize\ttfamily ssize\+\_\+t key\+Dec\+Ref (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



Decrement the viability of a key object. 

The references will be decremented for \hyperlink{group__keyset_gae42530b04defb772059de0600159cf69}{ks\+Pop()} or successful calls of \hyperlink{group__keyset_gaa34fc43a081e6b01e4120daa6c112004}{ks\+Lookup()} with the option K\+D\+B\+\_\+\+O\+\_\+\+P\+OP. It will also be decremented with an following \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()} in the case that an old key is replaced with another key with the same name.

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

\begin{DoxyNote}{Note}
\hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{key\+Dup()} will reset the references for dupped key.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
the value of the new reference counter 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on null pointer \\
\hline
{\em 0} & when the key is ready to be freed \\
\hline
\end{DoxyRetVals}

\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()} for longer explanation, \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}, \hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}\label{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}} 
\index{Key@{Key}!key\+Del@{key\+Del}}
\index{key\+Del@{key\+Del}!Key@{Key}}
\subsubsection{\texorpdfstring{key\+Del()}{keyDel()}}
{\footnotesize\ttfamily int key\+Del (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



A destructor for Key objects. 

Every key created by \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} must be deleted with \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}.

It is save to delete keys which are in a keyset, the number of references will be returned then.

It is save to delete a nullpointer, -\/1 will be returned then.

It is also save to delete a multiple referenced key, nothing will happen then and the reference counter will be returned.


\begin{DoxyParams}{Parameters}
{\em key} & the key object to delete \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}, \hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()}, \hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()} 
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
the value of the reference counter if the key is within keyset(s) 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & when the key was freed \\
\hline
{\em -\/1} & on null pointers \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}\label{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}} 
\index{Key@{Key}!key\+Dup@{key\+Dup}}
\index{key\+Dup@{key\+Dup}!Key@{Key}}
\subsubsection{\texorpdfstring{key\+Dup()}{keyDup()}}
{\footnotesize\ttfamily Key$\ast$ key\+Dup (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{source }\end{DoxyParamCaption})}



Return a duplicate of a key. 

Memory will be allocated as needed for dynamic properties.

The new key will not be member of any Key\+Set and will start with a new reference counter at 0. A subsequent \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()} will delete the key.


\begin{DoxyCode}
\textcolor{keywordtype}{int} f (\textcolor{keyword}{const} Key * source)
\{
        Key * dup = \hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{keyDup} (source);
        \textcolor{comment}{// work with duplicate}
        \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel} (dup);
        \textcolor{comment}{// everything related to dup is freed}
        \textcolor{comment}{// and source is unchanged}
\}
\end{DoxyCode}


Like for a new key after \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} a subsequent \hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()} makes a Key\+Set to take care of the lifecycle of the key.


\begin{DoxyCode}
\textcolor{keywordtype}{int} g (\textcolor{keyword}{const} Key * source, KeySet * ks)
\{
        Key * dup = \hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{keyDup} (source);
        \textcolor{comment}{// work with duplicate}
        \hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ksAppendKey} (ks, dup);
        \textcolor{comment}{// ksDel(ks) will also free the duplicate}
        \textcolor{comment}{// source remains unchanged.}
\}
\end{DoxyCode}


Duplication of keys should be preferred to \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}, because data like owner can be filled with a copy of the key instead of asking the environment. It can also be optimized in the checks, because the keyname is known to be valid.


\begin{DoxyParams}{Parameters}
{\em source} & has to be an initialized source Key \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em 0} & failure or on N\+U\+LL pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxyReturn}{Returns}
a fully copy of source on success 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__keyset_ga21eb9c3a14a604ee3a8bdc779232e7b7}{ks\+Append()}, \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()}, \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__key_ga4aabc4272506dd63161db2bbb42de8ae}\label{group__key_ga4aabc4272506dd63161db2bbb42de8ae}} 
\index{Key@{Key}!key\+Get\+Ref@{key\+Get\+Ref}}
\index{key\+Get\+Ref@{key\+Get\+Ref}!Key@{Key}}
\subsubsection{\texorpdfstring{key\+Get\+Ref()}{keyGetRef()}}
{\footnotesize\ttfamily ssize\+\_\+t key\+Get\+Ref (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



Return how many references the 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 Key into a Key\+Set\+:


\begin{DoxyCodeInclude}
Key *k = \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/proper\_name"}, \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}); \textcolor{comment}{// ref counter = 0}
KeySet *ks = \hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew} (1, k, \hyperlink{kdbenum_8c_a7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END});
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}(k); \textcolor{comment}{// key will not be deleted, because its in the keyset}
\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}(ks); \textcolor{comment}{// now the key will be deleted}
\end{DoxyCodeInclude}
 You can even add the key to more Key\+Sets\+:


\begin{DoxyCodeInclude}
Key *k = \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/proper\_name"}, \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}); \textcolor{comment}{// ref counter 0}
KeySet *ks1 = \hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}(1, k, \hyperlink{kdbenum_8c_a7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}); \textcolor{comment}{// ref counter of k 1}
KeySet *ks2 = \hyperlink{group__keyset_ga671e1aaee3ae9dc13b4834a4ddbd2c3c}{ksNew}(1, k, \hyperlink{kdbenum_8c_a7a28fce3773b2c873c94ac80b8b4cd54}{KS\_END}); \textcolor{comment}{// ref counter of k 2}
\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}(ks1); \textcolor{comment}{// ref counter of k 1}
\hyperlink{group__keyset_ga27e5c16473b02a422238c8d970db7ac8}{ksDel}(ks2); \textcolor{comment}{// k is now deleted}
\end{DoxyCodeInclude}
 If you increment only by one with \hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()} the same as said above is valid\+:


\begin{DoxyCodeInclude}
Key *k = \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(0); \textcolor{comment}{// ref counter = 0}
\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{keyIncRef}(k); \textcolor{comment}{// ref counter = 1}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}(k); \textcolor{comment}{// key will not be deleted}
\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{keyDecRef}(k);
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel}(k);
\end{DoxyCodeInclude}
 or use \hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()} more than once\+:


\begin{DoxyCodeInclude}
Key *k = \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(0); \textcolor{comment}{// ref counter 0}
\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{keyIncRef}(k); \textcolor{comment}{// ref counter of key 1}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel} (k);   \textcolor{comment}{// has no effect}
\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{keyIncRef}(k); \textcolor{comment}{// ref counter of key 2}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel} (k);   \textcolor{comment}{// has no effect}
\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{keyDecRef}(k); \textcolor{comment}{// ref counter of key 1}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel} (k);   \textcolor{comment}{// has no effect}
\hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{keyDecRef}(k); \textcolor{comment}{// ref counter is now 0}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel} (k); \textcolor{comment}{// k is now deleted}
\end{DoxyCodeInclude}
 The key won\textquotesingle{}t be deleted by a \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()} as long refcounter is not 0.

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

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


\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the number of references 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on null pointer \\
\hline
\end{DoxyRetVals}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__key_ga6970a6f254d67af7e39f8e469bb162f1}{key\+Inc\+Ref()} and \hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{key\+Dec\+Ref()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__key_ga6970a6f254d67af7e39f8e469bb162f1}\label{group__key_ga6970a6f254d67af7e39f8e469bb162f1}} 
\index{Key@{Key}!key\+Inc\+Ref@{key\+Inc\+Ref}}
\index{key\+Inc\+Ref@{key\+Inc\+Ref}!Key@{Key}}
\subsubsection{\texorpdfstring{key\+Inc\+Ref()}{keyIncRef()}}
{\footnotesize\ttfamily ssize\+\_\+t key\+Inc\+Ref (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



Increment the viability of a key object. 

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

The reference counter can\textquotesingle{}t be incremented once it reached S\+S\+I\+Z\+E\+\_\+\+M\+AX. In that situation nothing will happen and S\+S\+I\+Z\+E\+\_\+\+M\+AX will be returned.

\begin{DoxyNote}{Note}
\hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{key\+Dup()} will reset the references for dupped key.
\end{DoxyNote}
\begin{DoxyReturn}{Returns}
the value of the new reference counter 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on null pointer \\
\hline
{\em S\+S\+I\+Z\+E\+\_\+\+M\+AX} & when maximum exceeded \\
\hline
\end{DoxyRetVals}

\begin{DoxyParams}{Parameters}
{\em key} & the key object to work with \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__key_ga4aabc4272506dd63161db2bbb42de8ae}{key\+Get\+Ref()} for longer explanation, \hyperlink{group__key_ga2c6433ca22109e4e141946057eccb283}{key\+Dec\+Ref()}, \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__key_gad23c65b44bf48d773759e1f9a4d43b89}\label{group__key_gad23c65b44bf48d773759e1f9a4d43b89}} 
\index{Key@{Key}!key\+New@{key\+New}}
\index{key\+New@{key\+New}!Key@{Key}}
\subsubsection{\texorpdfstring{key\+New()}{keyNew()}}
{\footnotesize\ttfamily Key$\ast$ key\+New (\begin{DoxyParamCaption}\item[{const char $\ast$}]{name,  }\item[{}]{... }\end{DoxyParamCaption})}



A practical way to fully create a Key object in one step. 

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


\begin{DoxyCodeInclude}
Key *k = \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(0);
\textcolor{comment}{// work with it}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel} (k);
\end{DoxyCodeInclude}
 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 \hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{key\+Dup()} the key.
\end{DoxyNote}
You can call it in many different ways depending on the attribute tags you pass as parameters. Tags are represented as \hyperlink{group__key_ga91fb3178848bd682000958089abbaf40}{keyswitch\+\_\+t} values, and tell \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} which Key attribute comes next.

We can also give an empty key name and a K\+E\+Y\+\_\+\+E\+ND tag with the same effect as before\+:


\begin{DoxyCodeInclude}
Key *k =\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{""}, \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END}); \textcolor{comment}{// Has the same effect as above}
\textcolor{comment}{// work with it}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel} (k);
\end{DoxyCodeInclude}
 But we can also give the key a proper name right from the start\+:


\begin{DoxyCodeInclude}
\textcolor{comment}{// Create and initialize a key with a name and nothing else}
Key *k=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/some/example"}, \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END});
\textcolor{comment}{// work with it}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{keyDel} (k);
\end{DoxyCodeInclude}
 So, \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} allocates memory for a key object and \hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()} cleans everything up.

\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()} processes the given argument list even further. The Key attribute tags are the following\+:
\begin{DoxyItemize}
\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{K\+E\+Y\+\_\+\+V\+A\+L\+UE} ~\newline
 Next parameter is a pointer to the value that will be used. If no \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1ca18d4e094ae7487d35ecedda2235ff}{K\+E\+Y\+\_\+\+B\+I\+N\+A\+RY} was used before, a string is assumed. 
\begin{DoxyCodeInclude}
\textcolor{comment}{// Create and initialize a key with a name and nothing else}
Key *k=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/tmp/ex0"},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}, \textcolor{stringliteral}{"some data"},    \textcolor{comment}{// set a string value}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END});                  \textcolor{comment}{// end of args}
\end{DoxyCodeInclude}

\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}{K\+E\+Y\+\_\+\+S\+I\+ZE} ~\newline
 Define a maximum length of the value. This is only used when setting a binary key. 
\begin{DoxyCodeInclude}
\textcolor{comment}{// Create and initialize a key with a name and nothing else}
Key *k=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/tmp/ex1"},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}, 4,               \textcolor{comment}{// has no effect on strings}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}, \textcolor{stringliteral}{"some data"},    \textcolor{comment}{// set a string value}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END});                  \textcolor{comment}{// end of args}
\end{DoxyCodeInclude}

\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{K\+E\+Y\+\_\+\+M\+E\+TA} ~\newline
 Next two parameter is a metaname and a metavalue. See \hyperlink{group__keymeta_gae1f15546b234ffb6007d8a31178652b9}{key\+Set\+Meta()}. 
\begin{DoxyCodeInclude}
Key *k=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/tmp/ex3"},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{KEY\_META}, \textcolor{stringliteral}{"comment"}, \textcolor{stringliteral}{"a comment"},  \textcolor{comment}{// with a comment}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{KEY\_META}, \textcolor{stringliteral}{"owner"}, \textcolor{stringliteral}{"root"},         \textcolor{comment}{// and an owner}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{KEY\_META}, \textcolor{stringliteral}{"special"}, \textcolor{stringliteral}{"yes"},        \textcolor{comment}{// and any other metadata}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END});                  \textcolor{comment}{// end of args}
\end{DoxyCodeInclude}

\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{K\+E\+Y\+\_\+\+E\+ND} ~\newline
 Must be the last parameter passed to \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}. It is always required, unless the {\ttfamily key\+Name} is 0.
\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a4b83f86a07a7a0d6e24ecafe43cfea1b}{K\+E\+Y\+\_\+\+F\+L\+A\+GS} ~\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}
Key *k=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/tmp/ex3"},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a4b83f86a07a7a0d6e24ecafe43cfea1b}{KEY\_FLAGS}, \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY} | \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40afc1567f74444ff9c219f7456b652b4ec}{KEY\_CASCADING\_NAME}, \textcolor{comment}{// flags}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}, 7,                    \textcolor{comment}{// assume binary length 7}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}, \textcolor{stringliteral}{"some data"},                \textcolor{comment}{// value that will be truncated in 7 bytes}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END});                        \textcolor{comment}{// end of args}
\end{DoxyCodeInclude}

\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1ca18d4e094ae7487d35ecedda2235ff}{K\+E\+Y\+\_\+\+B\+I\+N\+A\+RY} ~\newline
 Allows one to change the key to a binary key. Make sure that you also pass \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}{K\+E\+Y\+\_\+\+S\+I\+ZE} before you set the value. Otherwise it will be cut off with first \textbackslash{}0 in the string. So this flag toggle from \hyperlink{group__keyvalue_ga622bde1eb0e0c4994728331326340ef2}{key\+Set\+String()} to \hyperlink{group__keyvalue_gaa50a5358fd328d373a45f395fa1b99e7}{key\+Set\+Binary()}. If no value (nor size) is given, it will be a N\+U\+LL key. 
\begin{DoxyCodeInclude}
\textcolor{comment}{// Create and initialize a key with a name and nothing else}
Key *k=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/tmp/ex2"},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}, 4,               \textcolor{comment}{// now the size is important}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}, \textcolor{stringliteral}{"some data"},    \textcolor{comment}{// sets the binary value ("some")}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END});                  \textcolor{comment}{// end of args}
\end{DoxyCodeInclude}

\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40afc1567f74444ff9c219f7456b652b4ec}{K\+E\+Y\+\_\+\+C\+A\+S\+C\+A\+D\+I\+N\+G\+\_\+\+N\+A\+ME} allow the name to start with / useful for \hyperlink{group__keyset_gaa34fc43a081e6b01e4120daa6c112004}{ks\+Lookup()} and \hyperlink{group__kdb_ga28e385fd9cb7ccfe0b2f1ed2f62453a1}{kdb\+Get()} parent/lookup keys
\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a5205cbd2831bc881da3589a95c08e054}{K\+E\+Y\+\_\+\+M\+E\+T\+A\+\_\+\+N\+A\+ME} allow the name to start with arbitrary namespaces useful to compare with metakeys
\end{DoxyItemize}

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000010}{Deprecated}]The flags below are deprecated and \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a040582834bb2d90049947d7ef74e87e2}{K\+E\+Y\+\_\+\+M\+E\+TA} should be preferred. They remain some time, however, for compatibility\+:
\begin{DoxyItemize}
\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a9e43e47c8a21478538e2d20e049981d5}{K\+E\+Y\+\_\+\+D\+IR} ~\newline
 Define that the key is a directory rather than a ordinary key. This means its executable bits in its mode are set. But even without this option the key can have subkeys. See \hyperlink{group__meta_gaae575bd86a628a15ee45baa860522e75}{key\+Set\+Dir()}.
\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a77ca60362fa8daca8d5347db4385068b}{K\+E\+Y\+\_\+\+O\+W\+N\+ER} ~\newline
 Next parameter is the owner. See \hyperlink{owner_8c_a88d6ec200ba0707b7c1b4a88133d2be4}{key\+Set\+Owner()}.
\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a28f01a87d65f065172f734c9c9446c0e}{K\+E\+Y\+\_\+\+U\+ID}, \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac0628bbaba7c837ca73323681393d15f}{K\+E\+Y\+\_\+\+G\+ID} ~\newline
 Next parameter is taken as the U\+ID (uid\+\_\+t) or G\+ID (gid\+\_\+t) that will be defined on the key. See \hyperlink{group__meta_gab5f284f5ecd261e0a290095f50ba1af7}{key\+Set\+U\+I\+D()} and \hyperlink{group__meta_ga9e3d0fb3f7ba906e067727b9155d22e3}{key\+Set\+G\+I\+D()}.
\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1b0a91ff3a855d6993930ebf0abaa518}{K\+E\+Y\+\_\+\+M\+O\+DE} ~\newline
 Next parameter is taken as mode permissions (int) to the key. See \hyperlink{group__meta_ga8803037e35b9da1ce492323a88ff6bc3}{key\+Set\+Mode()}. 
\begin{DoxyCodeInclude}
Key *k=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/tmp/ex3"},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}, \textcolor{stringliteral}{"some data"},    \textcolor{comment}{// with a simple value}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1b0a91ff3a855d6993930ebf0abaa518}{KEY\_MODE}, 0777,            \textcolor{comment}{// permissions}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END});                  \textcolor{comment}{// end of args}
\end{DoxyCodeInclude}

\item \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac29427bb47cc31689d02912e36161ee3}{K\+E\+Y\+\_\+\+C\+O\+M\+M\+E\+NT} ~\newline
 Next parameter is a comment. See \hyperlink{group__meta_ga8863a877a84fa46e6017fe72e49b89c1}{key\+Set\+Comment()}. 
\begin{DoxyCodeInclude}
Key *k=\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{keyNew}(\textcolor{stringliteral}{"user/tmp/ex4"},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a1ca18d4e094ae7487d35ecedda2235ff}{KEY\_BINARY},                   \textcolor{comment}{// key type}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a6d531b5c41445d19d0452eebdccbfa01}{KEY\_SIZE}, 7,                    \textcolor{comment}{// assume binary length 7}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac66e4a49d09212b79f5754ca6db5bd2e}{KEY\_VALUE}, \textcolor{stringliteral}{"some data"},                \textcolor{comment}{// value that will be truncated in 7 bytes}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40ac29427bb47cc31689d02912e36161ee3}{KEY\_COMMENT}, \textcolor{stringliteral}{"value is truncated"},
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a77ca60362fa8daca8d5347db4385068b}{KEY\_OWNER}, \textcolor{stringliteral}{"root"},             \textcolor{comment}{// owner (not uid) is root}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40a28f01a87d65f065172f734c9c9446c0e}{KEY\_UID}, 0,                      \textcolor{comment}{// root uid}
        \hyperlink{group__key_gga91fb3178848bd682000958089abbaf40aa8adb6fcb92dec58fb19410eacfdd403}{KEY\_END});                        \textcolor{comment}{// end of args}
\end{DoxyCodeInclude}

\end{DoxyItemize}\end{DoxyRefDesc}



\begin{DoxyParams}{Parameters}
{\em name} & a valid name to the key, or N\+U\+LL to get a simple initialized, but really empty, object \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__key_ga3df95bbc2494e3e6703ece5639be5bb1}{key\+Del()} 
\end{DoxySeeAlso}
\begin{DoxyReturn}{Returns}
a pointer to a new allocated and initialized Key object. 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em N\+U\+LL} & on allocation error or if an invalid {\ttfamily name} was passed (see \hyperlink{group__keyname_ga7699091610e7f3f43d2949514a4b35d9}{key\+Set\+Name()}). \\
\hline
\end{DoxyRetVals}
