X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FMainpage.dox;h=b0440b0fedf834dd64322141d4764d30b0932170;hb=9d97626a51a793a3f882b31ebbeae6239602c612;hp=46f8a05420503d39f3254c18f1845ad8f0798fb2;hpb=7638cc0391abf8f10bc29eb87851dac5f4e765b2;p=senf.git diff --git a/Console/Mainpage.dox b/Console/Mainpage.dox index 46f8a05..b0440b0 100644 --- a/Console/Mainpage.dox +++ b/Console/Mainpage.dox @@ -29,6 +29,7 @@ \autotoc + \section console_intro Introduction There are three parts to the Config/console library: @@ -47,6 +48,7 @@ commands which set their respective parameter, however the library allows commands to do much more than just that. + \section console_example Example The following example shows a \e very short summary on how to integrate the config/console @@ -115,6 +117,7 @@ \see \ref console_testserver for a complete example application + \section intro_usage Access There are several ways to access the node tree: @@ -124,6 +127,7 @@ \see console_access + \section intro_nodes The node tree The basic idea is, that the console/config library manages a directory structure of parameters @@ -157,6 +161,7 @@ \autotoc + \section console_access_config Configuration support The configuration support of the Console/Config library revolves around the ConfigSource @@ -175,6 +180,7 @@ node used during parsing and it is also possible to restrict parsing to a command subset. See \ref console_access_partial. + \subsection console_access_file Configuration files @@ -203,6 +209,7 @@ and a user specific configuration file) see \ref console_access_multiple and add one (or more) senf::console::FileConfig() source to a senf::console::ConfigBundle. + \subsubsection console_access_file_syntax Configuration file syntax Configuration files are written in a simple configuration language. This language is almost @@ -223,6 +230,7 @@ \see \ref console_parser + \subsection console_access_options Command line options
@@ -258,6 +266,7 @@ See \ref senf::console::ProgramOptions for the source specific additional parameters. These apply to senf::console::ProgramOptions and to the senf::console::OptionsConfig() source. + \subsubsection console_access_options_syntax Options syntax Command line options are primarily parsed as long-options. Long options start with '--'. Further @@ -327,6 +336,7 @@ (Beware, that the second argument to \c alias() is \e not shell quoted). + \subsection console_access_root Changing the root node When used in it's default state, parsing will always interpret all commands relative to the @@ -347,6 +357,7 @@ selectively choose commands from the node tree which are to be made accessible for configuration. See \ref node_tree. + \subsection console_access_partial Partial / incremental configuration Another feature provided by senf::console::ConfigBundle and all helper classes is partial @@ -378,6 +389,7 @@ important: It allows a subsystem to parse it's configuration parameters irrespective of any links pointing to nodes of that subsystem. + \subsection console_access_multiple Multiple sources Most of the time, an application will utilize multiple configuration sources: A global @@ -421,6 +433,7 @@ order they are specified, so in this case, the command line options will override any options specified in one of the configuration files. + \section console_access_console The network console To make the network console accessible, it must be initialized when the program is started: @@ -460,6 +473,10 @@ \endhtmlonly + It is possible to start multiple server consoles by calling \c start() multiple times with + different ports/addresses. Each server can be configured separately (e.g. root node, mode ...).q + + \subsection console_serverclient Server and Client objects The senf::console::Server and senf::console::Client objects offer further API calls. To access @@ -505,6 +522,7 @@ a path component will be completed automatically and transparently to the corresponding full name. + \subsection console_noninteractive Non-interactive network console After a new connection is established, the console server waits a short time for data to arrive. @@ -543,6 +561,7 @@ \autotoc + \section console_cmdadd Adding commands and setting attributes Basically, all commands are added using senf::console::DirectoryNode::add(). What exactly @@ -657,6 +676,7 @@ To greatly simplify parsing complex commands, we turn to automatic argument parsing. + \subsection console_autoadd Adding Automatically parsed commands are registered by just adding a callback which has the correct @@ -723,6 +743,7 @@ \endhtmlonly + \subsection command_overload Overloading Automatically parsed commands can be overloaded: You can register multiple commands under the @@ -1099,6 +1120,7 @@ \see senf::console::VariableAttributor for the complete attribute interface + \subsection console_varchange Change notification A \e handler can be set to be called, whenever the variable is changed. It will be called with a @@ -1121,12 +1143,33 @@ After this setup, \c varChanged will be called, whenever the value has changed. - \section console_args Registering special argument types + \section console_args Special argument types By default, argument types which can be read and written using \c iostreams are automatically supported. Other types need to be registered explicitly + \subsection console_args_bool Boolean arguments and return values + + The console library by default formats boolean values using the strings \c true and \c false for + their representation. When parsing a boolean value, most sensible representations will be + accepted: + +
+ + + + + +
\c true \c false \ref senf::console::formatTrueFalse
\c on \c off \ref senf::console::formatOnOff
\c enabled \c disabled \ref senf::console::formatEnabledDisabled
\c yes \c no \ref senf::console::formatYesNo
non-zero integer\c 0\ref senf::console::formatOneZero
+ + The boolean parser will accept these values in any (mixed) case and accepts any unique initial + substring (e.g. \c Y / \c N). + + The last column lists explicit formatters which can be set to customize the return value + formatting of a registered overload accordingly. + + \subsection console_args_enum Registering enum types Enum types are a special case, since it is not possible, to find a string representation for the @@ -1195,7 +1238,7 @@ \endhtmlonly - \subsection console_args_custom Customizing argument and return value parsing/formatting + \subsection console_args_custom Extending the library to support additional types To support or customize parsing/formatting of other types, they need to be registered. In it's simplest case, this works, by just providing an appropriate overload for