\hypertarget{elektra_2proposal_8c}{\section{proposal.\+c File Reference}
\label{elektra_2proposal_8c}\index{proposal.\+c@{proposal.\+c}}
}


Implementation of proposed A\+P\+I enhancements.  


{\ttfamily \#include $<$string.\+h$>$}\\*
{\ttfamily \#include $<$kdbprivate.\+h$>$}\\*
Include dependency graph for elektra/proposal.c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{elektra_2proposal_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
Key $\ast$ \hyperlink{elektra_2proposal_8c_a17a6c04aa1ff61c84a8cf9658c5ca5a2}{elektra\+Ks\+Prev} (Key\+Set $\ast$ks)
\begin{DoxyCompactList}\small\item\em Returns the previous Key in a Key\+Set. \end{DoxyCompactList}\item 
Key\+Set $\ast$ \hyperlink{elektra_2proposal_8c_ab436b020c8292d4c40ea2b27dc70305d}{elektra\+Rename\+Keys} (Key\+Set $\ast$config, const char $\ast$name)
\begin{DoxyCompactList}\small\item\em Takes the first key and cuts off this common part for all other keys, instead name will be prepended. \end{DoxyCompactList}\item 
int \hyperlink{elektra_2proposal_8c_aec09df442faca2e1e8cf233d22fefa63}{elektra\+Key\+Lock} (Key $\ast$key, enum \hyperlink{group__proposal_ga824e384e248ed1e05448294bff7271c0}{elektra\+Lock\+Options} what)
\begin{DoxyCompactList}\small\item\em Permanently locks a part of the key. \end{DoxyCompactList}\item 
Key $\ast$ \hyperlink{elektra_2proposal_8c_a97b55b0908f9c9434fc0753a0d7089b8}{elektra\+Ks\+Pop\+At\+Cursor} (Key\+Set $\ast$ks, cursor\+\_\+t pos)
\begin{DoxyCompactList}\small\item\em Pop key at given cursor position. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Implementation of proposed A\+P\+I enhancements. 

\begin{DoxyCopyright}{Copyright}
B\+S\+D License (see doc/\+C\+O\+P\+Y\+I\+N\+G or \href{http://www.libelektra.org}{\tt http\+://www.\+libelektra.\+org}) 
\end{DoxyCopyright}


\subsection{Function Documentation}
\hypertarget{elektra_2proposal_8c_aec09df442faca2e1e8cf233d22fefa63}{\index{elektra/proposal.\+c@{elektra/proposal.\+c}!elektra\+Key\+Lock@{elektra\+Key\+Lock}}
\index{elektra\+Key\+Lock@{elektra\+Key\+Lock}!elektra/proposal.\+c@{elektra/proposal.\+c}}
\subsubsection[{elektra\+Key\+Lock}]{\setlength{\rightskip}{0pt plus 5cm}int elektra\+Key\+Lock (
\begin{DoxyParamCaption}
\item[{Key $\ast$}]{key, }
\item[{enum {\bf elektra\+Lock\+Options}}]{what}
\end{DoxyParamCaption}
)}}\label{elektra_2proposal_8c_aec09df442faca2e1e8cf233d22fefa63}


Permanently locks a part of the key. 

This can be\+:
\begin{DoxyItemize}
\item K\+E\+Y\+\_\+\+F\+L\+A\+G\+\_\+\+L\+O\+C\+K\+\_\+\+N\+A\+M\+E to lock the name
\item K\+E\+Y\+\_\+\+F\+L\+A\+G\+\_\+\+L\+O\+C\+K\+\_\+\+V\+A\+L\+U\+E to lock the value
\item K\+E\+Y\+\_\+\+F\+L\+A\+G\+\_\+\+L\+O\+C\+K\+\_\+\+M\+E\+T\+A to lock the meta data
\end{DoxyItemize}

To unlock the key, duplicate it.

It is also possible to lock when the key is created with \hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}.

Some data structures need to lock the key (most likely its name), so that the ordering does not get confused.


\begin{DoxyParams}{Parameters}
{\em key} & which name should be locked\\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__key_gad23c65b44bf48d773759e1f9a4d43b89}{key\+New()}, \hyperlink{group__key_gae6ec6a60cc4b8c1463fa08623d056ce3}{key\+Dup()}, \hyperlink{group__keyset_gaa5a1d467a4d71041edce68ea7748ce45}{ks\+Append\+Key()} 
\end{DoxySeeAlso}

\begin{DoxyRetVals}{Return values}
{\em $>$0} & the bits that were successfully locked \\
\hline
{\em 0} & if everything was locked before \\
\hline
{\em -\/1} & if it could not be locked (nullpointer) \\
\hline
\end{DoxyRetVals}
\hypertarget{elektra_2proposal_8c_a97b55b0908f9c9434fc0753a0d7089b8}{\index{elektra/proposal.\+c@{elektra/proposal.\+c}!elektra\+Ks\+Pop\+At\+Cursor@{elektra\+Ks\+Pop\+At\+Cursor}}
\index{elektra\+Ks\+Pop\+At\+Cursor@{elektra\+Ks\+Pop\+At\+Cursor}!elektra/proposal.\+c@{elektra/proposal.\+c}}
\subsubsection[{elektra\+Ks\+Pop\+At\+Cursor}]{\setlength{\rightskip}{0pt plus 5cm}Key$\ast$ elektra\+Ks\+Pop\+At\+Cursor (
\begin{DoxyParamCaption}
\item[{Key\+Set $\ast$}]{ks, }
\item[{cursor\+\_\+t}]{pos}
\end{DoxyParamCaption}
)}}\label{elektra_2proposal_8c_a97b55b0908f9c9434fc0753a0d7089b8}


Pop key at given cursor position. 


\begin{DoxyParams}{Parameters}
{\em ks} & the keyset to pop key from \\
\hline
{\em c} & where to pop\\
\hline
\end{DoxyParams}
The internal cursor will be rewinded using \hyperlink{group__keyset_gabe793ff51f1728e3429c84a8a9086b70}{ks\+Rewind()}. You can use \hyperlink{group__keyset_gaffe507ab9281c322eb16c3e992075d29}{ks\+Get\+Cursor()} and \hyperlink{group__keyset_gad94c9ffaa3e8034564c0712fd407c345}{ks\+Set\+Cursor()} jump back to the previous position. e.\+g. to pop at current position within \hyperlink{group__keyset_ga317321c9065b5a4b3e33fe1c399bcec9}{ks\+Next()} loop\+: 
\begin{DoxyCode}
1 cursor\_t c = ksGetCursor(ks);
2 keyDel (ksPopAtCursor(ks, c));
3 ksSetCursor(ks, c);
4 ksPrev(ks); // to have correct key after next ksNext()
\end{DoxyCode}


\begin{DoxyWarning}{Warning}
do not use, will be superseded by external iterator A\+P\+I
\end{DoxyWarning}
\begin{DoxyReturn}{Returns}
the popped key 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em 0} & if ks is 0 \\
\hline
\end{DoxyRetVals}
\hypertarget{elektra_2proposal_8c_a17a6c04aa1ff61c84a8cf9658c5ca5a2}{\index{elektra/proposal.\+c@{elektra/proposal.\+c}!elektra\+Ks\+Prev@{elektra\+Ks\+Prev}}
\index{elektra\+Ks\+Prev@{elektra\+Ks\+Prev}!elektra/proposal.\+c@{elektra/proposal.\+c}}
\subsubsection[{elektra\+Ks\+Prev}]{\setlength{\rightskip}{0pt plus 5cm}Key$\ast$ elektra\+Ks\+Prev (
\begin{DoxyParamCaption}
\item[{Key\+Set $\ast$}]{ks}
\end{DoxyParamCaption}
)}}\label{elektra_2proposal_8c_a17a6c04aa1ff61c84a8cf9658c5ca5a2}


Returns the previous Key in a Key\+Set. 

Key\+Sets have an internal cursor that can be reset with \hyperlink{group__keyset_gabe793ff51f1728e3429c84a8a9086b70}{ks\+Rewind()}. Every time \hyperlink{group__api_gae7d268f13dd89a6e126b3718b117996f}{ks\+Prev()} is called the cursor is decremented and the new current Key is returned.

You'll get a N\+U\+L\+L pointer if the key before begin of the Key\+Set was reached.

Don't delete the key, use \hyperlink{group__keyset_gae42530b04defb772059de0600159cf69}{ks\+Pop()} if you want to delete it.

\begin{DoxyReturn}{Returns}
the new current Key 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__keyset_gabe793ff51f1728e3429c84a8a9086b70}{ks\+Rewind()}, \hyperlink{group__keyset_ga4287b9416912c5f2ab9c195cb74fb094}{ks\+Current()} 
\end{DoxySeeAlso}
\hypertarget{elektra_2proposal_8c_ab436b020c8292d4c40ea2b27dc70305d}{\index{elektra/proposal.\+c@{elektra/proposal.\+c}!elektra\+Rename\+Keys@{elektra\+Rename\+Keys}}
\index{elektra\+Rename\+Keys@{elektra\+Rename\+Keys}!elektra/proposal.\+c@{elektra/proposal.\+c}}
\subsubsection[{elektra\+Rename\+Keys}]{\setlength{\rightskip}{0pt plus 5cm}Key\+Set$\ast$ elektra\+Rename\+Keys (
\begin{DoxyParamCaption}
\item[{Key\+Set $\ast$}]{config, }
\item[{const char $\ast$}]{name}
\end{DoxyParamCaption}
)}}\label{elektra_2proposal_8c_ab436b020c8292d4c40ea2b27dc70305d}


Takes the first key and cuts off this common part for all other keys, instead name will be prepended. 

\begin{DoxyReturn}{Returns}
a new allocated keyset with keys in user namespace.
\end{DoxyReturn}
The first key is removed in the resulting keyset. 