Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

QgarArgs.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------+
00002  | Library QgarLib, graphics analysis and recognition                  |
00003  | Copyright (C) 2002  Qgar Project, LORIA                             |
00004  |                                                                     |
00005  | This library is free software; you can redistribute it and/or       |
00006  | modify it under the terms of the GNU Lesser General Public          |
00007  | License version 2.1, as published by the Free Software Foundation.  |
00008  |                                                                     |
00009  | This library is distributed in the hope that it will be useful,     |
00010  | but WITHOUT ANY WARRANTY; without even the implied warranty of      |
00011  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                |
00012  | See the GNU Lesser General Public License for more details.         |
00013  |                                                                     |
00014  | The GNU Lesser General Public License is included in the file       |
00015  | LICENSE.LGPL, in the root directory of the Qgar packaging. See      |
00016  | http://www.gnu.org/licenses/lgpl.html for the terms of the licence. |
00017  | To receive a paper copy, write to the Free Software Foundation,     |
00018  | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.       |
00019  |                                                                     |
00020  | Contact Project Qgar for any information:                           |
00021  |   LORIA - équipe Qgar                                               |
00022  |   B.P. 239, 54506 Vandoeuvre-lès-Nancy Cedex, France                |
00023  |   email: qgar-contact@loria.fr                                      |
00024  |   http://www.qgar.org/                                              |
00025  *---------------------------------------------------------------------*/
00026 
00027 
00028 #ifndef __QGARARGS_H_INCLUDED__
00029 #define __QGARARGS_H_INCLUDED__
00030 
00031 /**
00032  * @file    QgarArgs.H
00033  * @brief   Header file of class qgar::QgarArgs.
00034  *
00035  * @author  <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Philippe Dosch">Philippe Dosch</a>
00036  * @date    July 02, 2001  17:20
00037  * @since   Qgar 1.0
00038  */
00039 
00040 
00041 // For RCS/CVS use: Do not delete
00042 /* $Id: QgarArgs.H,v 1.19 2005/10/14 17:05:48 masini Exp $ */
00043 
00044 
00045 
00046 // STD
00047 #include <iostream>
00048 #include <list>
00049 #include <vector>
00050 
00051 
00052 
00053 namespace qgar
00054 {
00055 
00056 /** 
00057  * @class QgarArgs QgarArgs.H "qgarlib/QgarArgs.H"
00058  * @ingroup APP
00059  * @brief To handle the parameters given to an application. 
00060  * 
00061  * The class can be used alone, or coupled with class qgar::QgarApp which
00062  * allows an application to be interactively used. See class qgar::QgarApp
00063  * for further instructions.
00064  *
00065  * The class allows a quick and easy definition of the different
00066  * parameters accepted by an application.
00067  * <ul>
00068  * <li>
00069  * The application declares all the parameters it may receive.
00070  * </li>
00071  * <li>
00072  * The parameters effectively given to the application are transmitted
00073  * to an object of class qgar::QgarArgs, which updates its internal
00074  * structure and checks if all the required parameters are given.
00075  * </li>
00076  * <li>
00077  * The client can then send a query to the object to know if some parameter
00078  * is declared, to get the characteristics of some parameter, etc.
00079  * </li>
00080  * </ul>
00081  *
00082  * A user can get help about an application parameters by launching
00083  * the application with flag <b>-h</b>.
00084  *
00085  * Flag <b>-gui</b> allows the QgarGui QGar user interface to be provided
00086  * with the arguments of a given application.
00087  *
00088  * Here is a minimal and typical example of use of the class
00089  * for text-graphic separation:
00090 @code
00091 #include <qgarlib/QgarApp.H>
00092 #include <qgarlib/QgarArgs.H>
00093 
00094 using namespace std;
00095 using namespace qgar;
00096 
00097 int main(int argc, char* argv[])
00098 {
00099   QgarApp app;
00100 
00101   // INITIALIZATIONS
00102   // ===============
00103 
00104   // Description of the parameters
00105 
00106   app.addParameter("-in",
00107                    QgarArgs::REQPARAM,
00108                    QgarArgs::FILEIN,
00109                    "Source image:");
00110 
00111   app.addParameter("-t",
00112                    QgarArgs::REQPARAM,
00113                    QgarArgs::FILEOUTD,
00114                    "Text image:",
00115                    ".text.pbm");
00116 
00117   app.addParameter("-g",
00118                    QgarArgs::REQPARAM,
00119                    QgarArgs::FILEOUTD,
00120                    "Graphic image:",
00121                    ".graph.pbm");
00122 
00123   app.addParameter("-s",
00124                    QgarArgs::REQPARAM,
00125                    QgarArgs::INT,
00126                    "Dimension threshold:",
00127                    0,
00128                    "20");
00129 
00130   app.addParameter("-thr",
00131                    QgarArgs::OPTPARAM,
00132                    QgarArgs::INT,
00133                    "Threshold:",
00134                    0,
00135                    "3");
00136 
00137   app.addParameter("-d",
00138                    QgarArgs::REQPARAM,
00139                    QgarArgs::FLOAT,
00140                    "Black pixel density:",
00141                    0,
00142                    ".6");
00143 
00144   // Description of the application
00145   app.setDescription("Text-graphic separation", QgarArgs::PBM);
00146 
00147   // COMMAND LINE ANALYSIS
00148   // =====================
00149 
00150   app.analyzeLine(argc, argv);
00151 
00152   // Error while parsing parameters?
00153   if (app.isError())
00154     {
00155       return app._CODE_ERROR;
00156     }
00157 
00158   // Application invoked with flag '-gui'?
00159   if (app.isExit())
00160     {
00161       return app._CODE_GUI;
00162     }
00163 
00164   // Set progress bar on
00165   app.showProgressBar();
00166   app.setProgressBar(0);
00167 
00168   // GET ARGUMENTS
00169   // =============
00170 
00171   // Get the value of parameter introduced by flag '-in'
00172   // (it must be given, as this parameter is required)
00173   const char* name = app.getStringOption("-in");
00174 
00175   // Get the threshold value if defined by the command line
00176   int threshold = 3;
00177   if (app.isOptionSet("-thr"))
00178     {
00179       threshold = atoi(app.getStringOption("-thr"));
00180     }
00181 
00182   app.setProgressBar(5);
00183 
00184   // AND SO ON...
00185   // ============
00186 
00187   ...
00188 
00189   // NORMAL TERMINATION
00190   // ==================
00191 
00192   return app._CODE_END;
00193 
00194 } // END main()
00195 @endcode
00196  *
00197  * @author  <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Philippe Dosch">Philippe Dosch</a>
00198  * @date    July 02, 2001  17:20
00199  * @since   Qgar 1.0
00200  */
00201 
00202 class QgarArgs
00203 {
00204 // -------------------------------------------------------------------
00205 // T Y P E   D E F I N I T I O N S
00206 // -------------------------------------------------------------------
00207 public:
00208 
00209   /** @name Type definitions */
00210   //        ================
00211   //@{
00212 
00213   /**
00214    * @brief Parameter status.
00215    *
00216    * - <b>SINGLEFLAG</b>: single flag, associated with no value (<b>-f</b>)
00217    * - <b>REQPARAM</b>: required (i.e. non-optional) parameter,
00218    *                    introducing a value (<b>-f *val*</b>)
00219    * - <b>OPTPARAM</b>: optional parameter,
00220    *                    introducing a value (<b>-f *val*</b>)
00221    * - <b>REQMULTIPARAM</b>: required parameter, introducing
00222    *                         several values (<b>-f *val1* .. *valN*</b>)
00223    * - <b>OPTMULTIPARAM</b>: optional parameter, introducing
00224    *                         several values (<b>-f *val1* .. *valN*</b>)
00225    */
00226   enum QGEparamStatus
00227     {
00228       SINGLEFLAG,
00229       REQPARAM,
00230       OPTPARAM,
00231       REQMULTIPARAM,
00232       OPTMULTIPARAM
00233     };
00234              
00235   /**
00236    * @brief Types of the values associated to parameters.
00237    *
00238    * - <b>INT</b>: integer number
00239    * - <b>FLOAT</b>: floating number
00240    * - <b>STRING</b>: string
00241    * - <b>BOOL</b>: boolean
00242    * - <b>FILEIN</b>: name of an input data file
00243    * - <b>FILEOUT</b>: name of an output data file
00244    * - <b>FILEOUTD</b>: name of an output data file,
00245    *                    whose content is intended to be displayed
00246    * - <b>FILEOUTDS</b>: name of an output data file,
00247    *                     whose content is intended to be displayed in
00248    *                     superimposition mode
00249    * - <b>PATH</b>: path of a directory
00250    */
00251   enum QGEparamType
00252     {
00253       INT,
00254       FLOAT,
00255       STRING,
00256       BOOL,
00257       FILEIN,
00258       FILEOUT,
00259       FILEOUTD,
00260       FILEOUTDS,
00261       PATH
00262     };
00263 
00264  /**
00265    * @brief File formats.
00266    *
00267    * - <b>PPM</b>: color bitmap image
00268    * - <b>PGM</b>: grey-level bitmap image
00269    * - <b>PBM</b>: black and white bitmap image
00270    * - <b>DXF</b>: vectorial image
00271    */
00272   enum QGEfileType
00273     {
00274       PPM,
00275       PGM,
00276       PBM,
00277       DXF
00278     };
00279 
00280   //@}
00281 
00282 
00283 /*-------------------------------------------------------------------*
00284  |                                                                   |
00285  |                 I N N E R   C L A S S   QgarParam                 |
00286  |                                                                   |
00287  *-------------------------------------------------------------------*/
00288 public:
00289 
00290   /**
00291    * @ingroup APP
00292    *
00293    * @class QgarParam
00294    *
00295    * @brief Internal representation of an application parameter.
00296    * 
00297    * Inner class of class qgar::QgarArgs
00298    *
00299    * @todo Complete the documentation
00300    *
00301    * @author <a href="mailto:qgar-develop@loria.fr?subject=Qgar fwd Philippe Dosch">Philippe Dosch</a>
00302    * @date  July 02, 2001  17:20
00303    * @since Qgar 1.0
00304    */
00305   class QgarParam
00306   {
00307     // ---------------------------
00308     // P U B L I C   M E M B E R S
00309     // ---------------------------
00310   public:
00311 
00312     /** @name Constructors */
00313     //       ============
00314     //@{
00315 
00316     /**
00317      * @brief Construct from full data.
00318      *
00319      * @param aParamName    parameter name, first character is a minus (e.g. <b>-f</b>)
00320      * @param aParamStatus  parameter status (see enum type qgar::QgarArgs::ParamStatus)
00321      * @param aParamType    parameter type (see enum type qgar::QgarArgs::ParamType)
00322      * @param aDescription  short description of the parameter
00323      * @param anExtension   file extension, in case of an output file
00324      * @param aDefault      default value (given as a string) for a parameter
00325      *                      which is not a file
00326      */
00327     QgarParam(const char* aParamName,
00328               QGEparamStatus aParamStatus,
00329               QGEparamType aParamType,
00330               const char* aDescription,
00331               const char* anExtension = 0,
00332               const char* aDefault = 0);
00333 
00334     //@}
00335 
00336 
00337     /** @name Access */
00338     //       ======
00339     //@{
00340 
00341     /**
00342      * @brief Get the parameter status.
00343      */
00344     inline QGEparamStatus paramStatus() const;
00345 
00346     /**
00347      * @brief Get flag for use.
00348      */
00349     inline bool useFlag() const;
00350 
00351     /**
00352      * @brief Get parameter name.
00353      */
00354     inline const char* name() const;
00355 
00356     /**
00357      * @brief Get parameter value.
00358      *
00359      * @param aSpecial 
00360      */
00361     const char* value(bool aSpecial);
00362 
00363     /**
00364      * @brief Get parameter number.
00365      */
00366     inline int numbOptions() const;
00367 
00368     /**
00369      * @brief Get indexed argument.
00370      *
00371      * @param anIdx  argument index.
00372      */
00373     inline const char* argument(int anIdx);
00374 
00375     /**
00376      * @brief Get parameter description.
00377      */
00378     inline const char* description() const;
00379 
00380     /**
00381      * @brief Get new value.
00382      */
00383     inline bool newValue() const;
00384 
00385     //@}
00386 
00387 
00388     /** @name Transformation */
00389     //       ==============
00390     //@{
00391 
00392     /**
00393      * @brief Set flag for use (default <b>true</b>).
00394      *
00395      * @param aBool  new value of the flag
00396      */
00397     inline void setUseFlag(bool aBool = true);
00398 
00399     /**
00400      * @brief Set parameter value.
00401      *
00402      * @param aVal  new value of the parameter
00403      */
00404     inline void setValue(char* aVal);
00405 
00406     /**
00407      * @brief Set new value.
00408      *
00409      * @param aVal  value to assign
00410      */
00411     inline void setNewValue(char* aVal);
00412 
00413     /**
00414      * @brief Add an argument to the argument list.
00415      *
00416      * @param anArg  argument to be added
00417      */
00418     inline void addArgument(char* anArg);
00419 
00420     //@}
00421 
00422 
00423     /**@name Display */
00424     //       =======
00425     //@{
00426 
00427     /**
00428      * @brief Display information about the parameter on standard output.
00429      *
00430      * @param anEndl
00431      */
00432     void printGUI(bool anEndl) const;
00433 
00434     /**
00435      * @brief Display usage message on standard output.
00436      */
00437     void showUsage() const;
00438 
00439     //@}
00440 
00441     // ---------------------------------
00442     // P R O T E C T E D   M E M B E R S
00443     // ---------------------------------
00444   protected:
00445 
00446     /** @name Parameter features */
00447     //       ==================
00448     //@{
00449 
00450     /**
00451      * @brief Parameter name.
00452      */
00453     const char* _name;
00454 
00455     /**
00456      * @brief Parameter description.
00457      */
00458     const char* _description;
00459 
00460     /**
00461      * @brief Flag...
00462      */
00463     bool _useFlag;
00464 
00465     /**
00466      * @brief Parameter status.
00467      */
00468     QGEparamStatus _paramStatus;
00469 
00470     /**
00471      * @brief Parameter type.
00472      */
00473     QGEparamType _paramType;
00474 
00475     /**
00476      * @brief File extension.
00477      */
00478     const char* _extension;
00479 
00480     //@}
00481 
00482 
00483     /** @name Parameter values */
00484     //       ================
00485     //@{
00486 
00487     /**
00488      * @brief Parameter default value.
00489      */
00490     const char* _default;
00491 
00492     /**
00493      * @brief Parameter value.
00494      */
00495     char* _value;
00496     
00497     /**
00498      * @brief Parameter new value.
00499      */
00500     bool _newValue;
00501 
00502     /**
00503      * @brief Parameter arguments.
00504      */
00505     std::vector<char*> _args;
00506 
00507     //@}
00508 
00509   }; // inner class QgarParam
00510 
00511 /*-------------------------------------------------------------------*
00512  |                                                                   |
00513  |          E N D    O F   I N N E R   C L A S S   QgarParam         |
00514  |                                                                   |
00515  *-------------------------------------------------------------------*/
00516 
00517 
00518 
00519 
00520 // -------------------------------------------------------------------
00521 // P U B L I C   M E M B E R S
00522 // -------------------------------------------------------------------
00523 public:
00524 
00525 
00526   /**@name Constructors */
00527   //       ============
00528   //@{
00529 
00530   /**
00531    * @brief Default constructor.
00532    */
00533   QgarArgs();
00534 
00535   //@}
00536 
00537 
00538   /** @name Destructor */
00539   //       ==========
00540   //@{
00541 
00542   /**
00543    * @brief Non-virtual destructor
00544    */
00545   ~QgarArgs();
00546 
00547   //@}
00548 
00549 
00550   /** @name Command line */
00551   //       ============
00552   //@{
00553 
00554   /**
00555    * @brief Analyze the command line.
00556    */
00557   void analyzeLine(int argc, char* argv[]);
00558 
00559   //@}
00560 
00561 
00562   /** @name Predicates */
00563   //       ==========
00564   //@{
00565 
00566   /**
00567    * @brief Is given flag set?
00568    */
00569   bool isOptionSet(const char* aFlag) const;
00570 
00571   /**
00572    * @brief Does the client have to exit the application?
00573    *
00574    * The client has to exit if the application has been launched
00575    * with either a <b>-h</b> flag (help) or a <b>-gui</b> flag
00576    * (get application parameters).
00577    */
00578   inline bool isExit() const;
00579   
00580   /**
00581    * @brief Is there an error in the command line?
00582    */
00583   inline bool isError() const;
00584 
00585   /**
00586    * @brief Is the application in interactive mode?
00587    */
00588   inline bool isInteractive() const;
00589 
00590   //@}
00591 
00592 
00593   /** @name Access */
00594   //       ======
00595   //@{
00596 
00597   /**
00598    * @brief Get the string associated with a parameter.
00599    *
00600    * @param aFlag     flag introducing the parameter
00601    * @param aSpecial
00602    *
00603    * @warning If the parameter is optional, check first that
00604    * the parameter is set, using function qgar::QgarArgs::isOptionSet.
00605    */
00606   const char* getStringOption (const char* aFlag, bool aSpecial) const;
00607 
00608   /**
00609    * @brief Get the number of strings (representing values)
00610    * associated with a multi-valued parameter.
00611    *
00612    * @param aFlag  flag introducing the parameter
00613    */
00614   int getNumberOptions(const char* aFlag) const;
00615 
00616   /**
00617    * @brief Get string index associated with a multi-valued parameter.
00618    *
00619    * @param aFlag  flag introducing the parameter
00620    * @param anIdx  index
00621    */
00622   const char* getStringOptionMulti(const char* aFlag, int anIdx) const;
00623 
00624   /**
00625    * @brief Get the parameter description (null pointer if none).
00626    */
00627   QgarParam* findParam(const char* aParam) const;
00628 
00629   //@}
00630 
00631 
00632   /**@name Transformation */
00633   //       ==============
00634   //@{
00635 
00636   /**
00637    * @brief Declare global information about the parameter.
00638    */
00639   void setDescription(const char* aDescription, QGEfileType aFileType);
00640 
00641   /**
00642    * @brief Declare a parameter.
00643    * 
00644    * This method must be called for each supported parameter.
00645    *    
00646    * If the parameter is an output file, its name is the concatenation
00647    * of the name of the input file (without its extension) and of
00648    * argument <b>anExtension</b>.
00649    *
00650    * If the parameter is not an output file, its default value may be given
00651    * by argument <b>aDefault</b>.
00652    *
00653    * If the parameter status is qgar::QgarArgs::SINGLEFLAG, the corresponding
00654    * type must be qgar::QgarArgs::BOOL.
00655    *
00656    * @param aParamName    parameter name, first character is a minus (e.g. <b>-f</b>)
00657    * @param aParamStatus  parameter status (see enum type qgar::QgarArgs::ParamStatus)
00658    * @param aParamType    parameter type (see enum type qgar::QgarArgs::ParamType)
00659    * @param aDescription  short description of the parameter
00660    * @param anExtension   file extension, in case of an output file
00661    * @param aDefault      default value (given as a string) for a parameter
00662    *                      which is not a file
00663    */
00664   void addParameter(const char* aParamName,
00665                     QGEparamStatus aParamStatus,
00666                     QGEparamType aParamType,
00667                     const char* aDescription,
00668                     const char* anExtension = 0,
00669                     const char* aDefault = 0);
00670 
00671   /**
00672    * @brief Declare the number of messages which will be displayed
00673    * during the execution of the corresponding application.
00674    *
00675    * @warning This function must be called before displaying the first
00676    * message, to allow the progress bar to be correctly managed.
00677    */
00678   inline void setNumberOfMessages(int aCnt);
00679 
00680   /**
00681    * @brief Set the parameter value.
00682    *
00683    * @param aFlag  flag introducing the parameter
00684    * @param aVal   value to assign
00685    */
00686   void setParamValue(char* aFlag, char* aVal);
00687 
00688   //@}
00689 
00690 
00691 // -------------------------------------------------------------------
00692 // P R O T E C T E D    M E M B E R S
00693 // -------------------------------------------------------------------
00694 protected:
00695 
00696   /**@name Application features */
00697   //       ====================
00698   //@{
00699 
00700   /**
00701    * @brief Application parameters
00702    */
00703   std::list<QgarParam*> _args;
00704 
00705   /**
00706    * @brief File type.
00707    */
00708   QGEfileType _fileType;
00709 
00710   /**
00711    * @brief Application description.
00712    */
00713   char* _description;
00714 
00715   /**
00716    * @brief Exit/do not exit the application.
00717    */
00718   bool _exit;
00719 
00720   /**
00721    * @brief Error/no error in the command line.
00722    */
00723   bool _error;
00724 
00725   /**
00726    * @brief Interactive/non-interactive application.
00727    */
00728   bool _interactive;
00729 
00730   //@}
00731 
00732 
00733   /**@name Display */
00734   //       =======
00735   //@{
00736 
00737   /**
00738   * @brief Dispaly parameters.
00739   */
00740   void printGUI() const;
00741   
00742   /**
00743    * @brief Display usage message.
00744    * @param aCommand
00745    */
00746   void showUsage(const char* aCommand) const;
00747 
00748   //@}
00749 
00750 
00751 // -------------------------------------------------------------------
00752 }; // class QgarArgs
00753 
00754 
00755 
00756 
00757 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00758 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00759 // I N L I N E   F U N C T I O N S   I M P L E M E N T A T I O N
00760 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00761 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00762 
00763 
00764 
00765 /*-------------------------------------------------------------------*
00766  |                 I N N E R   C L A S S   QgarParam                 |
00767  *-------------------------------------------------------------------*/
00768 
00769 
00770 // ======
00771 // Access
00772 // ======
00773 
00774 
00775 // GET THE PARAMETER STATUS
00776 
00777 inline QgarArgs::QGEparamStatus
00778 QgarArgs::QgarParam::paramStatus() const
00779 {
00780   return _paramStatus;
00781 }
00782 
00783 
00784 // GET FLAG FOR USE
00785 
00786 inline bool
00787 QgarArgs::QgarParam::useFlag() const
00788 {
00789   return _useFlag;
00790 }
00791 
00792 
00793 // GET PARAMETER NAME
00794 
00795 inline const char*
00796 QgarArgs::QgarParam::name() const
00797 {
00798   return _name;
00799 }
00800 
00801 
00802 // GET PARAMETER NUMBER
00803 
00804 inline int
00805 QgarArgs::QgarParam::numbOptions() const
00806 {
00807   return _args.size();
00808 }
00809 
00810 
00811 // GET INDEXED ARGUMENT
00812 
00813 inline const char* 
00814 QgarArgs::QgarParam::argument(int anIdx)
00815 {
00816   return _args[anIdx];
00817 }
00818 
00819 
00820 // GET PARAMETER DESCRIPTION
00821 
00822 inline const char*
00823 QgarArgs::QgarParam::description() const
00824 {
00825   return _description;
00826 }
00827 
00828 
00829 // GET NEW VALUE
00830 
00831 inline bool 
00832 QgarArgs::QgarParam::newValue() const
00833 {
00834   return _newValue;
00835 }
00836 
00837 
00838 // ==============
00839 // TRANSFORMATION
00840 // ==============
00841 
00842 
00843 // SET FLAG FOR USE (DEFAULT 'true')
00844 
00845 inline void
00846 QgarArgs::QgarParam::setUseFlag(bool aBool)
00847 {
00848   _useFlag = aBool;
00849 }
00850 
00851 
00852 // SET PARAMETER VALUE
00853 
00854 inline void
00855 QgarArgs::QgarParam::setValue(char* aVal)
00856 {
00857   _value = aVal;
00858 }
00859 
00860 
00861 // SET NEW VALUE
00862 
00863 inline void
00864 QgarArgs::QgarParam::setNewValue(char* aVal)
00865 {
00866   _newValue = true;
00867   setValue(aVal);
00868 }
00869 
00870 
00871 // ADD AN ARGUMENT TO THE ARGUMENT LIST
00872 
00873 inline void
00874 QgarArgs::QgarParam::addArgument(char* anArg)
00875 {
00876   _args.push_back(anArg);
00877 }
00878 
00879 
00880 
00881 
00882 /*-------------------------------------------------------------------*
00883  |                        C L A S S   QgarArgs                       |
00884  *-------------------------------------------------------------------*/
00885 
00886 
00887 // ==========
00888 // PREDICATES
00889 // ==========
00890 
00891 
00892 // DOES THE CLIENT HAVE TO EXIT THE APPLICATION?
00893 
00894 inline bool
00895 QgarArgs::isExit() const
00896 {
00897   return _exit;
00898 }
00899   
00900 
00901 // IS THERE AN ERROR IN THE COMMAND LINE?
00902 
00903 inline bool
00904 QgarArgs::isError() const
00905 {
00906   return _error;
00907 }
00908 
00909 
00910 // IS THE APPLICATION IN INTERACTIVE MODE?
00911 
00912 inline bool
00913 QgarArgs::isInteractive() const
00914 {
00915   return _interactive;
00916 }
00917 
00918 
00919 // ==============
00920 // TRANSFORMATION
00921 // ==============
00922 
00923 
00924 // Set the number of messages
00925 
00926 inline void
00927 QgarArgs::setNumberOfMessages(int aCnt)
00928 {
00929   std::cout << aCnt << std::endl;
00930 }
00931 
00932 
00933 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00934 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
00935 
00936 } // namespace qgar
00937 
00938 
00939 #endif /* __QGARARGS_H_INCLUDED__ */