*** empty log message ***
[h316.git] / pc-tools / ldc2 / src / configuration_manager.cpp
index 94a6adf20853a1ddc56bbe3a3da3d04f033e1da5..4ded4f77a5ee36dfdfe1ed85597a53c79b8e5ddd 100644 (file)
@@ -1,41 +1,39 @@
-#include "argument_reader.hh"
+#include "configuration_manager.hh"
 #include <stdio.h>
 
 /*!
  *\brief Constructor.
  *
- * This constructor makes a new argument_reader ready to use.
+ * This constructor makes a new configuration_manager ready to use.
  *\arg name Name of the application as mentioned in the
  *     "Use: <appname> ..." help message.
  */
-argument_reader::argument_reader(string  name){
+configuration_manager::configuration_manager(string  name){
   app_name=name;
 }
 
   
 /*!
- *\brief Add a new parameter to be searched for.
+ *\brief Add a new configuration value to be searched for.
  *\param shortname A character for the short form. 
- *                 For example the 'h' in -h
+ *                 For example the h in -h
  *\param longname  The double dash longname. For example 
- *                 "input_file=" in --input_file= or
- *                 "ignore_errors" in --ignore--errors
- *\param description A detailed parameter description.
+ *                 input_file in --input_file= or
+ *\param description A detailed description of the value.
  *\param status Pointer to an integer. Will be set to 1 if arg found.
- *\target Pointer to a value should be read. 
- *                If no value is needed, pass NULL.
+ *\target Pointer to to string to put the value in. 
  *\placeholder A placeholder for the documentation. 
- *             For example "<filename>" in -f<filename>
+ *             For example <filename> in -f<filename>
  */
-void argument_reader::add_param (string shortname, string longname,
+void configuration_manager::add_option_value (string shortname, string longname,
                                 string description, 
                                 bool    allow_cmdline,
                                 bool    allow_conffile,
                                 int * status, 
                                 string * target, string placeholder){
   
-  if(status!=NULL) opt_v.insert(opt_v.end(),
-                                   opt_t(shortname,longname, description,
+  if(status!=NULL) option_values.insert(opt_v.end(),
+                                   opt_value_t(shortname,longname, description,
                                              status,target,placeholder)
                                    );
 }
@@ -53,7 +51,7 @@ void argument_reader::add_param (string shortname, string longname,
  *      argument reader.
  *      There would be no other way to determine the order.
  */
-void argument_reader::add_argument(string placeholder, string description, int * status, string * target){
+void configuration_manager::add_argument(string placeholder, string description, int * status, string * target){
   if (target!=NULL) if(status!=NULL)
     arg_v.insert(arg_v.end(),arg_t(placeholder,description,status,target));
 }
@@ -63,7 +61,7 @@ void argument_reader::add_argument(string placeholder, string description, int *
  *\Read in the args passed to main().
  *\returns empty vector on success or the error messages to be output.
  */
-vector<string> argument_reader::read_args(int argc, char ** args){
+vector<string> configuration_manager::read_args(int argc, char ** args){
   vector<string> result;
   vector<string> argv;
   for (char ** akt=args; *akt ;akt++) argv.insert(argv.end(),string(*akt));
@@ -144,7 +142,7 @@ vector<string> argument_reader::read_args(int argc, char ** args){
  *\arg target Reference to a vector<string> to which lots of helpful
  *     strings are appended.
  */
-void argument_reader::get_help(vector<string> & target){
+void configuration_manager::get_help(vector<string> & target){
   target.insert(target.end(),"");
   string line="Usage: "+app_name;
   for (vector<opt_t>::iterator parm_p=opt_v.begin();parm_p<opt_v.end();parm_p++){
@@ -237,7 +235,7 @@ void argument_reader::get_help(vector<string> & target){
  *\brief Generate help.
  *\return A vector containing many helpful strings for the user.
  */
-vector<string> argument_reader::get_help(){
+vector<string> configuration_manager::get_help(){
   vector<string> result;
   get_help(result);
   return result;
@@ -246,7 +244,7 @@ vector<string> argument_reader::get_help(){
 
 /**************************************************/
 
-argument_reader::opt_t::opt_t(string n_shortname, string n_longname,string n_description, int * n_status, 
+configuration_manager::opt_t::opt_t(string n_shortname, string n_longname,string n_description, int * n_status, 
                                string * n_target, string n_placeholder){
   shortname=n_shortname;
   longname=n_longname;
@@ -257,7 +255,7 @@ argument_reader::opt_t::opt_t(string n_shortname, string n_longname,string n_des
   if (status) *status=0;
 }
 
-argument_reader::arg_t::arg_t( string n_placeholder, string n_description, 
+configuration_manager::arg_t::arg_t( string n_placeholder, string n_description, 
                                           int * n_status, string * n_target){
   description=n_description;
   status=n_status;