\hypertarget{array_8c}{}\section{array.\+c File Reference}
\label{array_8c}\index{array.c@{array.c}}


Array methods.  


{\ttfamily \#include $<$kdb.\+h$>$}\newline
{\ttfamily \#include $<$kdbease.\+h$>$}\newline
{\ttfamily \#include $<$kdbhelper.\+h$>$}\newline
{\ttfamily \#include $<$kdbtypes.\+h$>$}\newline
{\ttfamily \#include $<$ctype.\+h$>$}\newline
{\ttfamily \#include $<$errno.\+h$>$}\newline
{\ttfamily \#include $<$limits.\+h$>$}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
Include dependency graph for array.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{array_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \mbox{\hyperlink{array_8c_ac97baa33fb7b7e83192e156827ba2eb5}{elektra\+Array\+Validate\+Name}} (const Key $\ast$key)
\begin{DoxyCompactList}\small\item\em validate array syntax \end{DoxyCompactList}\item 
int \mbox{\hyperlink{array_8c_ab2eb25a64ded91feb47e58af8e62314a}{elektra\+Array\+Validate\+Base\+Name\+String}} (const char $\ast$base\+Name)
\begin{DoxyCompactList}\small\item\em validate array syntax \end{DoxyCompactList}\item 
int \mbox{\hyperlink{array_8c_afc46476b8d722d89e07a966e023df317}{elektra\+Array\+Inc\+Name}} (Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Increment the name of the key by one. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{array_8c_a4376537e9d6545dd26afe0c6c62dd9ed}{elektra\+Array\+Dec\+Name}} (Key $\ast$key)
\begin{DoxyCompactList}\small\item\em Decrement the name of an array key by one. \end{DoxyCompactList}\item 
Key\+Set $\ast$ \mbox{\hyperlink{array_8c_aee59442d3b1dea04454c7b93cd00c7ad}{elektra\+Array\+Get}} (const Key $\ast$array\+Parent, Key\+Set $\ast$keys)
\begin{DoxyCompactList}\small\item\em Return all the array keys below the given array parent. \end{DoxyCompactList}\item 
Key $\ast$ \mbox{\hyperlink{array_8c_aff4f7cbfc779e917ee41284d834231c6}{elektra\+Array\+Get\+Next\+Key}} (Key\+Set $\ast$array\+Keys)
\begin{DoxyCompactList}\small\item\em Return the next key in the given array. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Array methods. 

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


\subsection{Function Documentation}
\mbox{\Hypertarget{array_8c_a4376537e9d6545dd26afe0c6c62dd9ed}\label{array_8c_a4376537e9d6545dd26afe0c6c62dd9ed}} 
\index{array.c@{array.c}!elektraArrayDecName@{elektraArrayDecName}}
\index{elektraArrayDecName@{elektraArrayDecName}!array.c@{array.c}}
\subsubsection{\texorpdfstring{elektraArrayDecName()}{elektraArrayDecName()}}
{\footnotesize\ttfamily int elektra\+Array\+Dec\+Name (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



Decrement the name of an array key by one. 

The alphabetical order will remain intact. For example, {\ttfamily user/abc/\textbackslash{}\#\+\_\+10} will be changed to {\ttfamily user/abc/\textbackslash{}\#9}.


\begin{DoxyParams}{Parameters}
{\em This} & parameter determines the key name this function decrements.\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on error (e.\+g. new array index too small, non-\/valid array) \\
\hline
{\em 0} & on success \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{array_8c_aee59442d3b1dea04454c7b93cd00c7ad}\label{array_8c_aee59442d3b1dea04454c7b93cd00c7ad}} 
\index{array.c@{array.c}!elektraArrayGet@{elektraArrayGet}}
\index{elektraArrayGet@{elektraArrayGet}!array.c@{array.c}}
\subsubsection{\texorpdfstring{elektraArrayGet()}{elektraArrayGet()}}
{\footnotesize\ttfamily Key\+Set$\ast$ elektra\+Array\+Get (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{array\+Parent,  }\item[{Key\+Set $\ast$}]{keys }\end{DoxyParamCaption})}



Return all the array keys below the given array parent. 

The array parent itself is not returned. For example, if {\ttfamily user/config/\#} is an array, {\ttfamily user/config} is the array parent. Only the direct array keys will be returned. This means that for example {\ttfamily user/config/\#1/key} will not be included, but only {\ttfamily user/config/\#1}.

A new keyset will be allocated for the resulting keys. This means that the caller must {\ttfamily ks\+Del} the resulting keyset.


\begin{DoxyParams}{Parameters}
{\em array\+Parent} & the parent of the array to be returned \\
\hline
{\em keys} & the keyset containing the array keys\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a keyset containing the array keys (if any) 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em N\+U\+LL} & on {\ttfamily N\+U\+LL} pointers \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{array_8c_aff4f7cbfc779e917ee41284d834231c6}\label{array_8c_aff4f7cbfc779e917ee41284d834231c6}} 
\index{array.c@{array.c}!elektraArrayGetNextKey@{elektraArrayGetNextKey}}
\index{elektraArrayGetNextKey@{elektraArrayGetNextKey}!array.c@{array.c}}
\subsubsection{\texorpdfstring{elektraArrayGetNextKey()}{elektraArrayGetNextKey()}}
{\footnotesize\ttfamily Key$\ast$ elektra\+Array\+Get\+Next\+Key (\begin{DoxyParamCaption}\item[{Key\+Set $\ast$}]{array\+Keys }\end{DoxyParamCaption})}



Return the next key in the given array. 

The function will automatically allocate memory for a new key and name it accordingly.

\begin{DoxyPrecond}{Precondition}
The supplied keyset must contain only valid array keys.
\end{DoxyPrecond}
The caller has to key\+Del the resulting key.


\begin{DoxyParams}{Parameters}
{\em array\+Keys} & the array where the new key will belong to\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the new array key on success 
\end{DoxyReturn}

\begin{DoxyRetVals}{Return values}
{\em N\+U\+LL} & if the passed array is empty \\
\hline
{\em N\+U\+LL} & on N\+U\+LL pointers or if an error occurs \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{array_8c_afc46476b8d722d89e07a966e023df317}\label{array_8c_afc46476b8d722d89e07a966e023df317}} 
\index{array.c@{array.c}!elektraArrayIncName@{elektraArrayIncName}}
\index{elektraArrayIncName@{elektraArrayIncName}!array.c@{array.c}}
\subsubsection{\texorpdfstring{elektraArrayIncName()}{elektraArrayIncName()}}
{\footnotesize\ttfamily int elektra\+Array\+Inc\+Name (\begin{DoxyParamCaption}\item[{Key $\ast$}]{key }\end{DoxyParamCaption})}



Increment the name of the key by one. 

Alphabetical order will remain

e.\+g. user/abc/\#9 will be changed to user/abc/\#\+\_\+10

For the start\+: user/abc/\# will be changed to user/abc/\#0


\begin{DoxyParams}{Parameters}
{\em key} & which base name will be incremented\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & on error (e.\+g. array too large, non-\/valid array) \\
\hline
{\em 0} & on success \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{array_8c_ab2eb25a64ded91feb47e58af8e62314a}\label{array_8c_ab2eb25a64ded91feb47e58af8e62314a}} 
\index{array.c@{array.c}!elektraArrayValidateBaseNameString@{elektraArrayValidateBaseNameString}}
\index{elektraArrayValidateBaseNameString@{elektraArrayValidateBaseNameString}!array.c@{array.c}}
\subsubsection{\texorpdfstring{elektraArrayValidateBaseNameString()}{elektraArrayValidateBaseNameString()}}
{\footnotesize\ttfamily int elektra\+Array\+Validate\+Base\+Name\+String (\begin{DoxyParamCaption}\item[{const char $\ast$}]{base\+Name }\end{DoxyParamCaption})}



validate array syntax 


\begin{DoxyParams}{Parameters}
{\em base\+Name} & the supposed array element basename\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & if no array element/syntax error/no key \\
\hline
{\em 0} & if start \\
\hline
{\em offset\+Index} & otherwise, where {\ttfamily offset\+Index} stores the offset to the first digit of the array index of {\ttfamily base\+Name} \\
\hline
\end{DoxyRetVals}
\mbox{\Hypertarget{array_8c_ac97baa33fb7b7e83192e156827ba2eb5}\label{array_8c_ac97baa33fb7b7e83192e156827ba2eb5}} 
\index{array.c@{array.c}!elektraArrayValidateName@{elektraArrayValidateName}}
\index{elektraArrayValidateName@{elektraArrayValidateName}!array.c@{array.c}}
\subsubsection{\texorpdfstring{elektraArrayValidateName()}{elektraArrayValidateName()}}
{\footnotesize\ttfamily int elektra\+Array\+Validate\+Name (\begin{DoxyParamCaption}\item[{const Key $\ast$}]{key }\end{DoxyParamCaption})}



validate array syntax 


\begin{DoxyParams}{Parameters}
{\em key} & an element of an array\\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{Return values}
{\em -\/1} & if no array element/syntax error/no key \\
\hline
{\em 0} & if start \\
\hline
{\em 1} & if array element \\
\hline
\end{DoxyRetVals}
