
\begin{DoxyItemize}
\item infos = Information about the kconfig plugin is in keys below
\item infos/author = Dardan Haxhimustafa \href{mailto:mail@dardan.im}{\texttt{ mail@dardan.\+im}}
\item infos/licence = BSD
\item infos/needs =
\item infos/provides = storage/kconfig
\item infos/recommends =
\item infos/placements = getstorage setstorage
\item infos/status = recommended maintained compatible specific unittest nodep experimental unfinished concept
\item infos/metadata =
\item infos/description = Reads and writes the KConfig INI format
\end{DoxyItemize}\hypertarget{md_src_plugins_kconfig_README_src_plugins_kconfig_README_md}{}\doxysection{Introduction}\label{md_src_plugins_kconfig_README_src_plugins_kconfig_README_md}
This plugin can be used to parse and serialize a \href{https://cgit.kde.org/kconfig.git}{\texttt{ KConfig}} INI file.

Information about the syntax\+:


\begin{DoxyItemize}
\item Files are expected to be encoded in {\ttfamily UTF-\/8}.
\item Empty lines are ignored.
\item Lines that start with a {\ttfamily \#} character are considered comments. Comments are ignored too.
\item Configurations consist of groups and keys. Only keys can have values.
\item Key names can\textquotesingle{}t start with a {\ttfamily \mbox{[}} character
\item Keys can contain spaces and any special characters except {\ttfamily =}.
\item If a key has a value, then it will be followed with an {\ttfamily =} symbol and then the value will be read until the end of the line. The white space characters around the {\ttfamily =} symbol are ignored.
\item In values, the following escape sequences can be used\+:
\begin{DoxyItemize}
\item {\ttfamily \textbackslash{}n} and {\ttfamily \textbackslash{}r} are mapped to newline
\item {\ttfamily \textbackslash{}t} is mapped to tab
\item {\ttfamily \textbackslash{}\textbackslash{}} is mapped to {\ttfamily \textbackslash{}}
\end{DoxyItemize}
\item Values can contain any character from the {\ttfamily UTF-\/8} set except for newline and {\ttfamily \textbackslash{}} followed by an invalid escape sequence.
\item Keys can be localized. The locale is surrounded with {\ttfamily \mbox{[}} and {\ttfamily \mbox{]}} and cannot start with {\ttfamily \$}.
\item Same key names can be used multiple times if it has different locales. The following example is valid\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{greeting[en] = Hello}
\DoxyCodeLine{greeting[de] = Hallo}

\end{DoxyCode}

\item Keys can have metadata. Those are one byte long, start with {\ttfamily \$} and are surrounded with {\ttfamily \mbox{[}} and {\ttfamily \mbox{]}}.
\item The same key name can\textquotesingle{}t be used multiple times with different metadata (different to locales). The following example is invalid\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{key.name[\$a] = Something}
\DoxyCodeLine{key.name[\$i] = Something else}

\end{DoxyCode}

\item Group names begin have a {\ttfamily \mbox{[}} symbol at the beginning of a line and every key that follows them is part of this group (until the next group is declared)
\end{DoxyItemize}

An example of how a valid config file might look like\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{[group][subgroup]}
\DoxyCodeLine{key.name[en][\$i][\$e]=Key Value}
\DoxyCodeLine{key.name[de]=Key Wert}

\end{DoxyCode}


And how it will be represented in kdb\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{keyNew (PREFIX "{}group/subgroup/key.name[en]"{}, KEY\_VALUE, "{}Key Value"{}, KEY\_META, "{}kconfig"{}, "{}ie"{}, KEY\_END)}
\DoxyCodeLine{keyNew (PREFIX "{}group/subgroup/key.name[de]"{}, KEY\_VALUE, "{}Key Wert"{}, KEY\_END)}

\end{DoxyCode}
\hypertarget{md_src_plugins_kconfig_README_autotoc_md308}{}\doxysection{Usage}\label{md_src_plugins_kconfig_README_autotoc_md308}
The following example shows you how you can read data using this plugin.


\begin{DoxyCode}{0}
\DoxyCodeLine{\# Mount the plugin to the cascading namespace `/tests/kconfig`}
\DoxyCodeLine{sudo kdb mount configrc /tests/kconfig kconfig}
\DoxyCodeLine{}
\DoxyCodeLine{\# Manually add a key-\/value pair to the database}
\DoxyCodeLine{mkdir -\/p "{}\$(dirname "{}\$(kdb file user:/tests/kconfig)"{})"{}}
\DoxyCodeLine{echo 'key=Value' > "{}\$(kdb file user:/tests/kconfig)"{}}
\DoxyCodeLine{}
\DoxyCodeLine{\# Retrieve the new value}
\DoxyCodeLine{kdb get /tests/kconfig/key}
\DoxyCodeLine{\#> Value}
\DoxyCodeLine{}
\DoxyCodeLine{\# Set the value to Example}
\DoxyCodeLine{kdb set /tests/kconfig/key Example}
\DoxyCodeLine{}
\DoxyCodeLine{\# Verify that the value has changed in the file too}
\DoxyCodeLine{cat `kdb file user:/tests/kconfig`}
\DoxyCodeLine{\#> key=Example}
\DoxyCodeLine{}
\DoxyCodeLine{\# Manually add a gorup to the database}
\DoxyCodeLine{echo '[group][subgroup]' >> "{}\$(kdb file user:/tests/kconfig)"{}}
\DoxyCodeLine{}
\DoxyCodeLine{\# Manually add a key that contains metas to that group}
\DoxyCodeLine{echo 'key.name[\$a][\$i]=New Value' >> "{}\$(kdb file user:/tests/kconfig)"{}}
\DoxyCodeLine{}
\DoxyCodeLine{\# Retrieve the new value}
\DoxyCodeLine{kdb get /tests/kconfig/group/subgroup/key.name}
\DoxyCodeLine{\#> New Value}
\DoxyCodeLine{}
\DoxyCodeLine{\# Retrieve the meta values}
\DoxyCodeLine{kdb meta-\/get /tests/kconfig/group/subgroup/key.name kconfig}
\DoxyCodeLine{\#> ai}
\DoxyCodeLine{}
\DoxyCodeLine{\# Manually add a group and a localized key}
\DoxyCodeLine{echo '[localized keys]' >> `kdb file user:/tests/kconfig`}
\DoxyCodeLine{echo 'greeting[en]=Hello' >> `kdb file user:/tests/kconfig`}
\DoxyCodeLine{echo 'greeting[de]=Hallo' >> `kdb file user:/tests/kconfig`}
\DoxyCodeLine{}
\DoxyCodeLine{\# Retrieve the english greeting}
\DoxyCodeLine{kdb get '/tests/kconfig/localized keys/greeting[en]'}
\DoxyCodeLine{\#> Hello}
\DoxyCodeLine{}
\DoxyCodeLine{\# Retrieve the german greeting}
\DoxyCodeLine{kdb get '/tests/kconfig/localized keys/greeting[de]'}
\DoxyCodeLine{\#> Hallo}
\DoxyCodeLine{}
\DoxyCodeLine{\# Undo modifications to the database}
\DoxyCodeLine{sudo kdb umount /tests/kconfig}

\end{DoxyCode}
\hypertarget{md_src_plugins_kconfig_README_autotoc_md309}{}\doxysection{Limitations}\label{md_src_plugins_kconfig_README_autotoc_md309}

\begin{DoxyItemize}
\item Comments from the file are discarded on save (same as the default KConfig functionality)
\item No validation for meta values or locale codes 
\end{DoxyItemize}