gwenhywfar  5.11.1beta
args.h
Go to the documentation of this file.
1 /***************************************************************************
2  $RCSfile$
3  -------------------
4  cvs : $Id$
5  begin : Sat Apr 24 2004
6  copyright : (C) 2004 by Martin Preuss
7  email : martin@libchipcard.de
8 
9  ***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU Lesser General Public *
13  * License as published by the Free Software Foundation; either *
14  * version 2.1 of the License, or (at your option) any later version. *
15  * *
16  * This library is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
19  * Lesser General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU Lesser General Public *
22  * License along with this library; if not, write to the Free Software *
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
24  * MA 02111-1307 USA *
25  * *
26  ***************************************************************************/
27 
28 #ifndef GWENHYWFAR_ARGS_H
29 #define GWENHYWFAR_ARGS_H
30 
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 typedef struct GWEN_ARGS GWEN_ARGS;
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #include <gwenhywfar/types.h>
42 #include <gwenhywfar/buffer.h>
43 #include <gwenhywfar/db.h>
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 
50 #define GWEN_ARGS_FLAGS_HAS_ARGUMENT 0x00000001
51 #define GWEN_ARGS_FLAGS_LAST 0x00000002
52 #define GWEN_ARGS_FLAGS_HELP 0x00000004
53 
54 #define GWEN_ARGS_MODE_ALLOW_FREEPARAM 0x00000001
55 #define GWEN_ARGS_MODE_STOP_AT_FREEPARAM 0x00000002
56 
57 #define GWEN_ARGS_RESULT_ERROR (-1)
58 #define GWEN_ARGS_RESULT_HELP (-2)
59 
60 
61 typedef enum {
64 }
66 
67 typedef enum {
71 
72 
79 struct GWEN_ARGS {
80  uint32_t flags;
82  const char *name;
83  unsigned int minNum;
84  unsigned int maxNum;
85  const char *shortOption;
86  const char *longOption;
87  const char *shortDescription;
88  const char *longDescription;
89 };
90 
91 
99 int GWEN_Args_Check(int argc, char **argv,
100  int startAt,
101  uint32_t mode,
102  const GWEN_ARGS *args,
103  GWEN_DB_NODE *db);
104 
111 int GWEN_Args_Usage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
112  GWEN_ARGS_OUTTYPE ot);
113 
117  GWEN_ARGS_OUTTYPE ot);
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 
124 #endif /* GWENHYWFAR_ARGS_H */
125 
126 
127 
GWENHYWFAR_API int GWEN_Args_ShortUsage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf, GWEN_ARGS_OUTTYPE ot)
GWENHYWFAR_API int GWEN_Args_Usage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf, GWEN_ARGS_OUTTYPE ot)
GWENHYWFAR_API int GWEN_Args_Check(int argc, char **argv, int startAt, uint32_t mode, const GWEN_ARGS *args, GWEN_DB_NODE *db)
GWEN_ARGS_OUTTYPE
Definition: args.h:67
@ GWEN_ArgsOutType_Txt
Definition: args.h:68
@ GWEN_ArgsOutType_Html
Definition: args.h:69
GWEN_ARGS_TYPE
Definition: args.h:61
@ GWEN_ArgsType_Int
Definition: args.h:63
@ GWEN_ArgsType_Char
Definition: args.h:62
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:228
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:38
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:67
Definition: args.h:79
unsigned int minNum
Definition: args.h:83
const char * shortOption
Definition: args.h:85
uint32_t flags
Definition: args.h:80
const char * longOption
Definition: args.h:86
GWEN_ARGS_TYPE type
Definition: args.h:81
const char * longDescription
Definition: args.h:88
unsigned int maxNum
Definition: args.h:84
const char * name
Definition: args.h:82
const char * shortDescription
Definition: args.h:87