ofconapp.h

00001 /*
00002  *
00003  *  Copyright (C) 1997-2005, OFFIS
00004  *
00005  *  This software and supporting documentation were developed by
00006  *
00007  *    Kuratorium OFFIS e.V.
00008  *    Healthcare Information and Communication Systems
00009  *    Escherweg 2
00010  *    D-26121 Oldenburg, Germany
00011  *
00012  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
00013  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
00014  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
00015  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
00016  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
00017  *
00018  *  Module:  ofstd
00019  *
00020  *  Author:  Joerg Riesmeier
00021  *
00022  *  Purpose: Handle console applications (Header)
00023  *
00024  *  Last Update:      $Author: meichel $
00025  *  Update Date:      $Date: 2005/12/08 16:05:49 $
00026  *  CVS/RCS Revision: $Revision: 1.20 $
00027  *  Status:           $State: Exp $
00028  *
00029  *  CVS/RCS Log at end of file
00030  *
00031  */
00032 
00033 
00034 #ifndef OFCONAPP_H
00035 #define OFCONAPP_H
00036 
00037 #include "dcmtk/config/osconfig.h"
00038 
00039 #include "dcmtk/ofstd/oftypes.h"
00040 #include "dcmtk/ofstd/ofcmdln.h"
00041 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */
00042 
00043 
00044 /*---------------------*
00045  *  class declaration  *
00046  *---------------------*/
00047 
00053 class OFConsoleApplication
00054 {
00055 
00056  public:
00057 
00064     OFConsoleApplication(const char *app,
00065                          const char *desc = NULL,
00066                          const char *rcsid = NULL);
00067 
00070     ~OFConsoleApplication();
00071 
00085     OFBool parseCommandLine(OFCommandLine &cmd,
00086                             int argCount,
00087                             char *argValue[],
00088                             const int flags = 0,
00089                             const int startPos = 1);
00090 
00096     void printHeader(const OFBool hostInfo = OFFalse,
00097                      const OFBool stdError = OFFalse);
00098 
00103     void printUsage(const OFCommandLine *cmd = NULL);
00104 
00110     void printError(const char *str,
00111                     const int code = 1);
00112 
00118     void printWarning(const char *str,
00119                       const char *prefix = "warning");
00120 
00125     void printMessage(const char *str);
00126 
00131     OFBool quietMode() const;
00132 
00137     void setQuietMode(const OFBool mode = OFTrue);
00138 
00144     void checkValue(const OFCommandLine::E_ValueStatus status,
00145                     OFCommandLine *cmd = NULL);
00146 
00152     void checkParam(const OFCommandLine::E_ParamValueStatus status,
00153                     OFCommandLine *cmd = NULL);
00154 
00162     void checkDependence(const char *subOpt,
00163                          const char *baseOpt,
00164                          OFBool condition);
00165 
00173     void checkConflict(const char *firstOpt,
00174                        const char *secondOpt,
00175                        OFBool condition);
00176 
00177 
00178  private:
00179 
00181     OFString Name;
00183     OFString Description;
00185     OFString Identification;
00186 
00188     OFBool QuietMode;
00189 
00191     OFCommandLine *CmdLine;
00192 
00193 
00194  // --- declarations to avoid compiler warnings
00195 
00196     OFConsoleApplication(const OFConsoleApplication &);
00197     OFConsoleApplication &operator=(const OFConsoleApplication &);
00198 };
00199 
00200 
00201 #endif
00202 
00203 
00204 /*
00205  *
00206  * CVS/RCS Log:
00207  * $Log: ofconapp.h,v $
00208  * Revision 1.20  2005/12/08 16:05:49  meichel
00209  * Changed include path schema for all DCMTK header files
00210  *
00211  * Revision 1.19  2004/01/16 10:30:12  joergr
00212  * Removed acknowledgements with e-mail addresses from CVS log.
00213  *
00214  * Revision 1.18  2003/12/05 10:37:41  joergr
00215  * Removed leading underscore characters from preprocessor symbols (reserved
00216  * symbols). Updated copyright date where appropriate.
00217  *
00218  * Revision 1.17  2003/07/04 13:29:51  meichel
00219  * Replaced forward declarations for OFString with explicit includes,
00220  *   needed when compiling with HAVE_STD_STRING
00221  *
00222  * Revision 1.16  2003/06/12 13:17:51  joergr
00223  * Enhanced method printWarning(). Added method quietMode().
00224  *
00225  * Revision 1.15  2002/11/26 12:55:02  joergr
00226  * Changed syntax usage output for command line applications from stderr to
00227  * stdout.
00228  *
00229  * Revision 1.14  2002/09/23 14:56:55  joergr
00230  * Prepared code for future support of 'config.guess' host identifiers.
00231  *
00232  * Revision 1.13  2002/04/16 13:36:02  joergr
00233  * Added configurable support for C++ ANSI standard includes (e.g. streams).
00234  *
00235  * Revision 1.12  2001/06/01 15:51:33  meichel
00236  * Updated copyright header
00237  *
00238  * Revision 1.11  2000/10/10 12:01:20  meichel
00239  * Created/updated doc++ comments
00240  *
00241  * Revision 1.10  2000/04/14 15:17:12  meichel
00242  * Adapted all ofstd library classes to consistently use ofConsole for output.
00243  *
00244  * Revision 1.9  2000/03/08 16:36:01  meichel
00245  * Updated copyright header.
00246  *
00247  * Revision 1.8  2000/03/07 15:38:50  joergr
00248  * Changed behaviour of class OFConsoleApplication to support automatic
00249  * evaluation of "--help" option for command line application with no
00250  * mandatory parameter.
00251  *
00252  * Revision 1.7  1999/09/13 16:37:15  joergr
00253  * Added methods for output of warning and other messages.
00254  * Added method to switch on/off all output messages (quiet mode).
00255  *
00256  * Revision 1.6  1999/08/17 10:23:10  joergr
00257  * Corrected Doc++ comment.
00258  *
00259  * Revision 1.5  1999/04/27 16:24:53  joergr
00260  * Introduced list of valid parameters used for syntax output and error
00261  * checking.
00262  * Added method to check conflicts between two options (incl. error output).
00263  *
00264  * Revision 1.4  1999/04/26 16:34:34  joergr
00265  * Added support to check dependences between different options and report
00266  * error messages if necessary.
00267  *
00268  * Revision 1.3  1999/04/21 12:41:03  meichel
00269  * Added method OFConsoleApplication::checkParam()
00270  *
00271  * Revision 1.2  1999/03/22 09:00:49  joergr
00272  * Added/Changed comments.
00273  *
00274  * Revision 1.1  1999/02/08 12:00:41  joergr
00275  * Added class to handle console applications (with or w/o command line
00276  * arguments).
00277  *
00278  *
00279  */


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5