args.h
Go to the documentation of this file.
/***************************************************************************
$RCSfile$
-------------------
cvs : $Id$
begin : Sat Apr 24 2004
copyright : (C) 2004 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
* MA 02111-1307 USA *
* *
***************************************************************************/
#ifndef GWENHYWFAR_ARGS_H
#define GWENHYWFAR_ARGS_H
#include <gwenhywfar/gwenhywfarapi.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GWEN_ARGS GWEN_ARGS;
#ifdef __cplusplus
}
#endif
#include <gwenhywfar/types.h>
#include <gwenhywfar/buffer.h>
#include <gwenhywfar/db.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GWEN_ARGS_FLAGS_HAS_ARGUMENT 0x00000001
#define GWEN_ARGS_FLAGS_LAST 0x00000002
#define GWEN_ARGS_FLAGS_HELP 0x00000004
#define GWEN_ARGS_MODE_ALLOW_FREEPARAM 0x00000001
#define GWEN_ARGS_MODE_STOP_AT_FREEPARAM 0x00000002
#define GWEN_ARGS_RESULT_ERROR (-1)
#define GWEN_ARGS_RESULT_HELP (-2)
typedef enum {
GWEN_ArgsType_Char=0,
GWEN_ArgsType_Int
}
GWEN_ARGS_TYPE;
typedef enum {
GWEN_ArgsOutType_Txt=0,
GWEN_ArgsOutType_Html
} GWEN_ARGS_OUTTYPE;
struct GWEN_ARGS {
uint32_t flags;
GWEN_ARGS_TYPE type;
const char *name;
unsigned int minNum;
unsigned int maxNum;
const char *shortOption;
const char *longOption;
const char *shortDescription;
const char *longDescription;
};
GWENHYWFAR_API
int GWEN_Args_Check(int argc, char **argv,
int startAt,
uint32_t mode,
const GWEN_ARGS *args,
GWEN_DB_NODE *db);
GWENHYWFAR_API
int GWEN_Args_Usage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
GWEN_ARGS_OUTTYPE ot);
GWENHYWFAR_API
int GWEN_Args_ShortUsage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf,
GWEN_ARGS_OUTTYPE ot);
#ifdef __cplusplus
}
#endif
#endif /* GWENHYWFAR_ARGS_H */
GWEN_Args_ShortUsage
GWENHYWFAR_API int GWEN_Args_ShortUsage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf, GWEN_ARGS_OUTTYPE ot)
GWEN_Args_Usage
GWENHYWFAR_API int GWEN_Args_Usage(const GWEN_ARGS *args, GWEN_BUFFER *ubuf, GWEN_ARGS_OUTTYPE ot)
GWEN_Args_Check
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
GWEN_ARGS_OUTTYPE
Definition args.h:67
GWEN_ArgsOutType_Txt
@ GWEN_ArgsOutType_Txt
Definition args.h:68
GWEN_ArgsOutType_Html
@ GWEN_ArgsOutType_Html
Definition args.h:69
GWEN_ARGS_TYPE
GWEN_ARGS_TYPE
Definition args.h:61
GWEN_ArgsType_Int
@ GWEN_ArgsType_Int
Definition args.h:63
GWEN_ArgsType_Char
@ GWEN_ArgsType_Char
Definition args.h:62
buffer.h
db.h
GWEN_DB_NODE
struct GWEN_DB_NODE GWEN_DB_NODE
Definition db.h:228
GWEN_BUFFER
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
gwenhywfarapi.h
GWENHYWFAR_API
#define GWENHYWFAR_API
Definition gwenhywfarapi.h:67
GWEN_ARGS
Definition args.h:79
GWEN_ARGS::minNum
unsigned int minNum
Definition args.h:83
GWEN_ARGS::shortOption
const char * shortOption
Definition args.h:85
GWEN_ARGS::flags
uint32_t flags
Definition args.h:80
GWEN_ARGS::longOption
const char * longOption
Definition args.h:86
GWEN_ARGS::type
GWEN_ARGS_TYPE type
Definition args.h:81
GWEN_ARGS::longDescription
const char * longDescription
Definition args.h:88
GWEN_ARGS::maxNum
unsigned int maxNum
Definition args.h:84
GWEN_ARGS::name
const char * name
Definition args.h:82
GWEN_ARGS::shortDescription
const char * shortDescription
Definition args.h:87
types.h