args.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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_ArgsType_Char=0,
00063 GWEN_ArgsType_Int
00064 } GWEN_ARGS_TYPE;
00065
00066 typedef enum {
00067 GWEN_ArgsOutType_Txt=0,
00068 GWEN_ArgsOutType_Html
00069 } GWEN_ARGS_OUTTYPE;
00070
00071
00078 struct GWEN_ARGS {
00079 uint32_t flags;
00080 GWEN_ARGS_TYPE type;
00081 const char *name;
00082 unsigned int minNum;
00083 unsigned int maxNum;
00084 const char *shortOption;
00085 const char *longOption;
00086 const char *shortDescription;
00087 const char *longDescription;
00088 };
00089
00090
00097 GWENHYWFAR_API
00098 int GWEN_Args_Check(int argc, char **argv,
00099 int startAt,
00100 uint32_t mode,
00101 const GWEN_ARGS *args,
00102 GWEN_DB_NODE *db);
00103
00109 GWENHYWFAR_API
00110 int GWEN_Args_Usage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
00111 GWEN_ARGS_OUTTYPE ot);
00112
00114 GWENHYWFAR_API
00115 int GWEN_Args_ShortUsage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
00116 GWEN_ARGS_OUTTYPE ot);
00117
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121
00122
00123 #endif
00124
00125
00126