Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

argument.hpp

Go to the documentation of this file.
00001 /*
00002 This is an abstract base class for command line arguments.
00003     
00004     Copyright (C) 2002 Ross A. Beyer
00005 
00006         Contact Author: Ross A. Beyer, rbeyer@rossbeyer.net
00007 
00008     CVS $Id: argument.hpp,v 1.3 2003/03/25 23:53:36 rbeyer Exp $
00009 
00010 
00011   License & Copyright Information
00012   -------------------------------
00013 
00014     This file is part of the commandl package, 
00015     $Name: commandl_Beta-1 $.
00016 
00017     The commandl packge is free software; you can redistribute it
00018     and/or modify it under the terms of the GNU General Public License
00019     as published by the Free Software Foundation; either version 2 of the 
00020     License, or (at your option) any later version.
00021 
00022     The commandl package is distributed in the hope that it will be useful,
00023     but WITHOUT ANY WARRANTY; without even the implied warranty of
00024     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00025     GNU General Public License for more details.
00026 
00027     You should have received a copy of the GNU General Public License
00028     along with this program; if not, write to the Free Software
00029     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00030 
00031 */
00032 
00033 #ifndef ARGUMENT_HEADER // Begin the Header Guard to prevent multiple
00034 #define ARGUMENT_HEADER //  inclusions.
00035 
00036 #include <string>
00037 #include <vector>
00038 
00039 namespace commandl
00040 {
00041 
00080 class argument
00081 {
00082 
00083 // ==================== Constructors & Destructor ===================== //
00084 public:
00085     argument
00086         (
00087         std::vector<std::string>,   // keys
00088         std::string,                // value description
00089         std::string,                // description
00090         bool,                       // argument required
00091         int,                        // number of values
00092         bool                        // values required?
00093         );
00094 
00095     argument
00096         (
00097         std::string,            // key
00098         std::string,            // value_description
00099         std::string,            // description
00100         bool,                   // argument required
00101         int,                    // number of values
00102         bool                    // values required?
00103         );
00104 
00105     virtual ~argument()
00106         {};
00107 
00108 // =========================== Accessors ============================== //
00109 public:
00110 
00111     virtual
00112     void operator()	(
00113                     const std::string&,                 //prefix
00114                     const std::string&,                 //key
00115                     const unsigned long                 //order
00116                     ) = 0;
00117     virtual
00118     void operator()	(
00119                     const std::string&,                 //value
00120                     const std::string&,                 //prefix
00121                     const std::string&,                 //key
00122                     const std::string&,                 //assign
00123                     const unsigned long                 //order
00124                     ) = 0;
00125     virtual
00126     void operator()	(
00127                     const std::vector<std::string>&,    //values
00128                     const std::string&,                 //prefix
00129                     const std::string&,                 //key
00130                     const std::string&,                 //assign
00131                     const unsigned long                 //order
00132                     ) = 0;
00133 
00134     virtual std::vector<std::string>    get_keys()              const;
00135     virtual bool                        required()              const;
00136     virtual int                         values_size()           const;
00137     virtual bool                        values_required()       const;
00138     virtual bool                        was_found()             const;
00139     virtual unsigned long               order()                 const;
00140     virtual std::string                 description()           const;
00141     virtual std::string                 value_description()     const;
00142 
00143 // =========================== Methods ================================ //
00144 public:
00145 
00146     virtual void    add_key(    const std::string&  );
00147     virtual void    found(      const unsigned long );
00148 
00149 
00150 // --------------------------- Protected Methods ---------------------- //
00151 protected:
00152 
00153     /*
00154     virtual int     number_of_values( int );
00155     virtual bool    is_required( bool );
00156     */
00157 
00158 
00159 // --------------------------- Private Methods ------------------------ //
00160 private:
00161     
00162 
00163 // =========================== Member Variables ======================= //
00164 protected:
00165 
00169     std::vector<std::string>    Keys;
00172     bool                        Argument_Required;
00175     int                         Number_Of_Values;
00179     bool                        Values_Required;
00184     unsigned long               Found;
00188     std::string                 Description;
00192     std::string                 Value_Description;
00193 
00194 
00195 };  // End of the class declaration
00196 
00197 }   // End of the namespace declaration
00198 
00199 #endif  // End the Header Guard
00200 

Generated on Sat Apr 5 21:17:27 2003 for commandl Library by doxygen1.2.15