From: hachti <hachti>
Date: Mon, 11 Dec 2006 01:35:45 +0000 (+0000)
Subject: *** empty log message ***
X-Git-Url: http://gitweb.hachti.de/?a=commitdiff_plain;h=ca5fce3a3fc44f8ad44c2c89abd6a322717ca428;p=h316.git

*** empty log message ***
---

diff --git a/pc-tools/ldc2/doc/Makefile b/pc-tools/ldc2/doc/Makefile
index 00999b2..3e77010 100644
--- a/pc-tools/ldc2/doc/Makefile
+++ b/pc-tools/ldc2/doc/Makefile
@@ -16,4 +16,4 @@ main.dvi: *.tex *.bib
 	cat ps.gnu $< | gnuplot > $@ 
 
 clean:
-	@rm -f *.dvi *.ps *.pdf *.toc *~ *.log *.aux *.bbl *.blg *.lof *.lot
+	@rm -f *.dvi *.ps ldc2.pdf *.toc *~ *.log *.aux *.bbl *.blg *.lof *.lot
diff --git a/pc-tools/ldc2/src/configuration_manager.cpp b/pc-tools/ldc2/src/configuration_manager.cpp
index 94a6adf..4ded4f7 100644
--- a/pc-tools/ldc2/src/configuration_manager.cpp
+++ b/pc-tools/ldc2/src/configuration_manager.cpp
@@ -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;
diff --git a/pc-tools/ldc2/src/configuration_manager.hh b/pc-tools/ldc2/src/configuration_manager.hh
index 7849edf..ffd7721 100644
--- a/pc-tools/ldc2/src/configuration_manager.hh
+++ b/pc-tools/ldc2/src/configuration_manager.hh
@@ -23,36 +23,49 @@ using namespace std;
  *     (You want!!!)
  * Sould be easy to use..... Enjoy.
  */
-class argument_reader{
+class configuration_manager{
   
 public:
-  argument_reader(string name);
+  configuration_manager(string name);
 
-  void add_param (string  shortname,
-		  string  longname, 
-		  string  description, 
-		  int    *status, 
-		  bool    allow_commandline=true,
-		  bool    allow_config_file=true,
-		  string *target=NULL, 
-		  string  placeholder=string("<string>")
-		  );
+  void add_option_switch (string  shortname,
+		   string  longname, 
+		   string  description, 
+		   int    *status, 
+		   bool    allow_commandline=true,
+		   bool    allow_config_file=true
+		   );
+
+  void add_option_value (string  shortname,
+		   string  longname, 
+		   string  description, 
+		   int    *status, 
+		   bool    allow_commandline=true,
+		   bool    allow_config_file=true,
+		   string *target=NULL, 
+		   string  placeholder=string("<string>")
+		   );
   
+  void add_argument (string  longname, 
+		     string  description, 
+		     int    *status, 
+     		     string *target=NULL, 
+		     string  placeholder=string("<string>")
+		     );
+
   vector<string> read_args(int argc, char ** args);
   vector<string> read_file(string filename);
  
   void get_help (vector<string> & target);
   vector<string> get_help();
 
-  void add_argument(string placeholder, string description, int * status, string * target);
-
 private:
   /*!
-   *\brief Container for one command line option.
+   *\brief Container for an option switch
    */
-  class opt_t{
+   class opt_switch_t{
   public:
-    opt_t (string shortname, string longname,string description, int * status, 
+    opt_switch_t (string shortname, string longname,string description, int * status 
 	       string * target=NULL, string placeholder=string("<string>"));
     string shortname;
     string longname;
@@ -61,11 +74,27 @@ private:
     string description;
     string placeholder;
   };
+  /*!
+   *\brief Container for an option value
+   */
+class opt_value_t{
+  public:
+  switch_t (string shortname, string longname,string description, int * status 
+	    string * target=NULL, string placeholder=string("<string>"));
+  string shortname;
+  string longname;
+  int * status;
+  string * target;    
+  string description;
+  string placeholder;
+  bool allow_conffile;
+  bool allow_cmdline;
+};
 
   /*!
-   *\brief Container for one command line argument.
+   *\brief Container for a commandline argument
    */
-  class arg_t{
+  class cmd_arg_t{
   public:
     arg_t (string placeholder,string description,
 		    int * status, string * target);
@@ -74,11 +103,13 @@ private:
     string description;
     string placeholder;
   };
-  vector<opt_t>opt_v;
-  vector<arg_t>arg_v;
+  
+  vector<opt_switch_t>option_switches;
+  vector<opt_value_t>option_values;
+  vector<cmd_arg_t>cmd_args;
   string app_name;
 
-}; // class argument_reader
+}; // class configuration_manager
 
 
 #endif