Products Support Documentation Download
rdmcmdlineapi.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * Raima Database Manager
3  *
4  * Copyright (c) 2014 Raima Inc., All rights reserved.
5  *
6  * Use of this software, whether in source code format, or in executable,
7  * binary object code form, is governed by the Raima LICENSE which
8  * is fully described in the LICENSE.TXT file, included within this
9  * distribution of files.
10  * ----------------------------------------------------------------------------
11  */
12 
17 #if !defined(RDMCMDLINEAPI_H_INCLUDED_)
18 #define RDMCMDLINEAPI_H_INCLUDED_
19 
20 #if defined(__cplusplus) && !defined(CPP_HEADER_INCLUDED)
21 #error rdmcmdlineapi.h is only for C applications. Do not include it directly in C applications. Use cpp-rdmcmdlineapi.h instead
22 #endif
23 
24 #include "psptypes.h"
25 #include "rdmretcodetypes.h"
26 
27 #if defined(_UNICODE) && !defined(RDM_NO_UNICODE)
28 #define RDM_CMDLINE_OPT RDM_CMDLINE_OPT_W
29 #define RDM_CMDLINE RDM_CMDLINE_W
30 #else
31 #if defined(RDM_DOXYGEN)
32 #define RDM_CMDLINE_OPT RDM_CMDLINE_OPT
33 #define RDM_CMDLINE RDM_CMDLINE
34 #else
35 #define RDM_CMDLINE_OPT RDM_CMDLINE_OPT_A
36 #define RDM_CMDLINE RDM_CMDLINE_A
37 #endif
38 #endif
39 
50 typedef struct {
51  const char *optShort;
56  const char *optLong;
60  const char *arg;
78  const char *desc;
81 
82 #if !defined(RDM_NO_UNICODE)
83 typedef struct {
84  const wchar_t *optShort;
85  const wchar_t *optLong;
86  const wchar_t *arg;
87  const wchar_t *desc;
88 } RDM_CMDLINE_OPT_W;
89 #endif
90 
91 #if defined(RDM_DOXYGEN)
92 
102 typedef struct { } RDM_CMDLINE;
103 #else
104 typedef struct _RDM_CMDLINE_DEFAULTS RDM_CMD_DEFAULTS;
105 
106 typedef struct
107 {
108  uint32_t ii;
109  uint32_t ii_next;
110  uint32_t kk;
111  uint32_t argument_ind_next;
112 
113  const RDM_CMDLINE_OPT_A *opts;
114  int32_t argc;
115  const char *const *argv;
116 
117  const char *banner;
118  const char *description;
119 
120  const RDM_CMD_DEFAULTS *defaults;
121 } RDM_CMDLINE_A;
122 
123 #if !defined(RDM_NO_UNICODE)
124 typedef struct
125 {
126  uint32_t ii;
127  uint32_t ii_next;
128  uint32_t kk;
129  uint32_t argument_ind_next;
130 
131  const RDM_CMDLINE_OPT_W *opts;
132  int32_t argc;
133  const wchar_t *const *argv;
134 
135  const wchar_t *banner;
136  const wchar_t *description;
137 
138  const RDM_CMD_DEFAULTS *defaults;
139 } RDM_CMDLINE_W;
140 #endif
141 #endif
142 
143 #if !defined(RDM_NO_UNICODE)
144 #define rdm_cmdlineInit RDM_T_FUNC(rdm_cmdlineInit)
145 #define rdm_cmdlineNextShortOption RDM_T_FUNC(rdm_cmdlineNextShortOption)
146 #define rdm_cmdlineNextLongOption RDM_T_FUNC(rdm_cmdlineNextLongOption)
147 #endif
148 
149 
176 RDM_EXPORT RDM_RETCODE EXTERNAL_FCN rdm_cmdlineInit(
177  RDM_CMDLINE *cmd,
178  int32_t argc,
179  const RDM_TCHAR_T *const argv[],
180  const RDM_TCHAR_T *description,
181  const RDM_CMDLINE_OPT *opts
182  );
183 
196 RDM_EXPORT const RDM_TCHAR_T *EXTERNAL_FCN rdm_cmdlineNextLongOption(
197  RDM_CMDLINE *cmd,
198  const RDM_TCHAR_T **arg
199  );
200 
216 RDM_EXPORT RDM_TCHAR_T EXTERNAL_FCN rdm_cmdlineNextShortOption(
217  RDM_CMDLINE *cmd,
218  const RDM_TCHAR_T **arg
219  );
220 
223 #endif /* RDMCMDLINEAPI_H_INCLUDED_ */
const char * optLong
Definition: rdmcmdlineapi.h:56
#define RDM_CMDLINE_OPT
Definition: rdmcmdlineapi.h:32
const char * arg
Definition: rdmcmdlineapi.h:60
const char * optShort
Definition: rdmcmdlineapi.h:51
Header for the Platform Support Package - Platform dependent types.
RDM Status and Error Return Codes.
The buffer used by the command line parser to hold state information.
RDM_RETCODE
RDM status and error return codes.
RDM_TCHAR_T rdm_cmdlineNextShortOption(RDM_CMDLINE *cmd, const RDM_TCHAR_T **arg)
Get next option or argument.
const char * desc
Definition: rdmcmdlineapi.h:78
Generic usage function option record.
Definition: rdmcmdlineapi.h:50
RDM_RETCODE rdm_cmdlineInit(RDM_CMDLINE *cmd, int32_t argc, const RDM_TCHAR_T *const argv[], const RDM_TCHAR_T *description, const RDM_CMDLINE_OPT *opts)
Initialize an RDM_CMDLINE buffer and validate the command line.
const RDM_TCHAR_T * rdm_cmdlineNextLongOption(RDM_CMDLINE *cmd, const RDM_TCHAR_T **arg)
Get next option or argument.
#define RDM_TCHAR_T
Definition: psptypes.h:134
#define RDM_CMDLINE
Definition: rdmcmdlineapi.h:33