File: zargs.h

package info (click to toggle)
czmq 4.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,912 kB
  • sloc: ansic: 30,811; cpp: 19,362; sh: 11,873; python: 11,814; pascal: 11,229; ruby: 8,818; java: 4,363; makefile: 299; perl: 151; javascript: 35
file content (129 lines) | stat: -rw-r--r-- 4,849 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*  =========================================================================
    zargs - Platform independent command line argument parsing helpers

There are two kind of elements provided by this class
foo --named-parameter --parameter with_value positional arguments -a gain-parameter

zargs keeps poision only for arguments, parameters are to be accessed like hash.

It DOES:
* provide easy to use CLASS compatible API for accessing argv
* is platform independent
* provide getopt_long style -- argument, which delimits parameters from arguments
* makes parameters positon independent
* hides several formats of command line to one (-Idir, --include=dir,
  --include dir are the same from API pov)

It does NOT
* change argv
* provide a "declarative" way to define command line interface

    Copyright (c) the Contributors as noted in the AUTHORS file.
    This file is part of CZMQ, the high-level C binding for 0MQ:
    http://czmq.zeromq.org.

    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
    file, You can obtain one at http://mozilla.org/MPL/2.0/.
    =========================================================================
*/

#ifndef ZARGS_H_INCLUDED
#define ZARGS_H_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

//  @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
//  @warning Please edit the model at "api/zargs.api" to make changes.
//  @interface
//  This is a draft class, and may change without notice. It is disabled in
//  stable builds by default. If you use this in applications, please ask
//  for it to be pushed to stable state. Use --enable-drafts to enable.
#ifdef CZMQ_BUILD_DRAFT_API
//  *** Draft method, for development use, may change without warning ***
//  Create a new zargs from command line arguments.
CZMQ_EXPORT zargs_t *
    zargs_new (int argc, char **argv);

//  *** Draft method, for development use, may change without warning ***
//  Destroy zargs instance.
CZMQ_EXPORT void
    zargs_destroy (zargs_t **self_p);

//  *** Draft method, for development use, may change without warning ***
//  Return program name (argv[0])
CZMQ_EXPORT const char *
    zargs_progname (zargs_t *self);

//  *** Draft method, for development use, may change without warning ***
//  Return number of positional arguments
CZMQ_EXPORT size_t
    zargs_arguments (zargs_t *self);

//  *** Draft method, for development use, may change without warning ***
//  Return first positional argument or NULL
CZMQ_EXPORT const char *
    zargs_first (zargs_t *self);

//  *** Draft method, for development use, may change without warning ***
//  Return next positional argument or NULL
CZMQ_EXPORT const char *
    zargs_next (zargs_t *self);

//  *** Draft method, for development use, may change without warning ***
//  Return first named parameter value, or NULL if there are no named
//  parameters, or value for which zargs_param_empty (arg) returns true.
CZMQ_EXPORT const char *
    zargs_param_first (zargs_t *self);

//  *** Draft method, for development use, may change without warning ***
//  Return next named parameter value, or NULL if there are no named
//  parameters, or value for which zargs_param_empty (arg) returns true.
CZMQ_EXPORT const char *
    zargs_param_next (zargs_t *self);

//  *** Draft method, for development use, may change without warning ***
//  Return current parameter name, or NULL if there are no named parameters.
CZMQ_EXPORT const char *
    zargs_param_name (zargs_t *self);

//  *** Draft method, for development use, may change without warning ***
//  Return value of named parameter or NULL is it has no value (or was not specified)
CZMQ_EXPORT const char *
    zargs_get (zargs_t *self, const char *name);

//  *** Draft method, for development use, may change without warning ***
//  Return value of one of parameter(s) or NULL is it has no value (or was not specified)
CZMQ_EXPORT const char *
    zargs_getx (zargs_t *self, const char *name, ...);

//  *** Draft method, for development use, may change without warning ***
//  Returns true if named parameter was specified on command line
CZMQ_EXPORT bool
    zargs_has (zargs_t *self, const char *name);

//  *** Draft method, for development use, may change without warning ***
//  Returns true if named parameter(s) was specified on command line
CZMQ_EXPORT bool
    zargs_hasx (zargs_t *self, const char *name, ...);

//  *** Draft method, for development use, may change without warning ***
//  Print an instance of zargs.
CZMQ_EXPORT void
    zargs_print (zargs_t *self);

//  *** Draft method, for development use, may change without warning ***
//  Self test of this class.
CZMQ_EXPORT void
    zargs_test (bool verbose);

#endif // CZMQ_BUILD_DRAFT_API
//  @end

#ifdef __cplusplus
}
#endif

#endif