# args.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: args.h,v $
    00003                              -------------------
    00004     cvs         : $Id: args.h,v 1.11 2004/09/24 11:38:32 aquamaniac Exp $
    00005     begin       : Sat Apr 24 2004
    00006     copyright   : (C) 2004 by Martin Preuss
    00007     email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    00025  *                                                                         *
    00026  ***************************************************************************/
    00027
    00028 #ifndef GWENHYWFAR_ARGS_H
    00029 #define GWENHYWFAR_ARGS_H
    00030
    00031 #include <gwenhywfar/gwenhywfarapi.h>
    00032
    00033 #ifdef __cplusplus
    00034 extern "C" {
    00035 #endif
    00036 typedef struct GWEN_ARGS GWEN_ARGS;
    00037 #ifdef __cplusplus
    00038 }
    00039 #endif
    00040
    00041 #include <gwenhywfar/types.h>
    00042 #include <gwenhywfar/buffer.h>
    00043 #include <gwenhywfar/db.h>
    00044
    00045 #ifdef __cplusplus
    00046 extern "C" {
    00047 #endif
    00048
    00049
    00050 #define GWEN_ARGS_FLAGS_HAS_ARGUMENT     0x00000001
    00051 #define GWEN_ARGS_FLAGS_LAST             0x00000002
    00052 #define GWEN_ARGS_FLAGS_HELP             0x00000004
    00053
    00054 #define GWEN_ARGS_MODE_ALLOW_FREEPARAM   0x00000001
    00055 #define GWEN_ARGS_MODE_STOP_AT_FREEPARAM 0x00000002
    00056
    00057 #define GWEN_ARGS_RESULT_ERROR (-1)
    00058 #define GWEN_ARGS_RESULT_HELP  (-2)
    00059
    00060
    00061 typedef enum {
    00062   GWEN_ArgsTypeChar=0,
    00063   GWEN_ArgsTypeInt
    00064 } GWEN_ARGS_TYPE;
    00065
    00066 typedef enum {
    00067   GWEN_ArgsOutTypeTXT=0,
    00068   GWEN_ArgsOutTypeHTML
    00069 } GWEN_ARGS_OUTTYPE;
    00070
    00071
    00078 GWENHYWFAR_API
    00079 struct GWEN_ARGS {
    00080   GWEN_TYPE_UINT32 flags;
    00081   GWEN_ARGS_TYPE type;
    00082   const char *name;
    00083   unsigned int minNum;
    00084   unsigned int maxNum;
    00085   const char *shortOption;
    00086   const char *longOption;
    00087   const char *shortDescription;
    00088   const char *longDescription;
    00089 };
    00090
    00091
    00098 GWENHYWFAR_API
    00099 int GWEN_Args_Check(int argc, char **argv,
    00100                     int startAt,
    00101                     GWEN_TYPE_UINT32 mode,
    00102                     const GWEN_ARGS *args,
    00103                     GWEN_DB_NODE *db);
    00104
    00105 GWENHYWFAR_API
    00106 int GWEN_Args_Usage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
    00107                     GWEN_ARGS_OUTTYPE ot);
    00108
    00109 GWENHYWFAR_API
    00110 int GWEN_Args_ShortUsage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
    00111                          GWEN_ARGS_OUTTYPE ot);
    00112
    00113 #ifdef __cplusplus
    00114 }
    00115 #endif
    00116
    00117
    00118 #endif /* GWENHYWFAR_ARGS_H */
    00119
    00120
    00121