getopt.h
Go to the documentation of this file.
1 /* Copyright (C) 2013-2016, The Regents of The University of Michigan.
2 All rights reserved.
3 
4 This software was developed in the APRIL Robotics Lab under the
5 direction of Edwin Olson, ebolson@umich.edu. This software may be
6 available under alternative licensing terms; contact the address above.
7 
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 
11 1. Redistributions of source code must retain the above copyright notice, this
12  list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 The views and conclusions contained in the software and documentation are those
29 of the authors and should not be interpreted as representing official policies,
30 either expressed or implied, of the Regents of The University of Michigan.
31 */
32 
33 #ifndef _GETOPT_H
34 #define _GETOPT_H
35 
36 #include "zarray.h"
37 #include "string_util.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 typedef struct getopt getopt_t;
44 
46 void getopt_destroy(getopt_t *gopt);
47 
48 // Parse args. Returns 1 on success
49 int getopt_parse(getopt_t *gopt, int argc, char *argv[], int showErrors);
50 void getopt_do_usage(getopt_t *gopt);
51 
52 // Returns a string containing the usage. Must be freed by caller
53 char * getopt_get_usage(getopt_t *gopt);
54 
55 void getopt_add_spacer(getopt_t *gopt, const char *s);
56 void getopt_add_bool(getopt_t *gopt, char sopt, const char *lname, int def, const char *help);
57 void getopt_add_int(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help);
58 void getopt_add_string(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help);
59 void getopt_add_double(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help);
60 
61 const char *getopt_get_string(getopt_t *gopt, const char *lname);
62 int getopt_get_int(getopt_t *getopt, const char *lname);
63 int getopt_get_bool(getopt_t *getopt, const char *lname);
64 double getopt_get_double(getopt_t *getopt, const char *lname);
65 int getopt_was_specified(getopt_t *gopt, const char *lname);
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 
73 #endif
const zarray_t * getopt_get_extra_args(getopt_t *gopt)
Definition: getopt.c:487
getopt_t * getopt_create()
Definition: getopt.c:72
const char * getopt_get_string(getopt_t *gopt, const char *lname)
Definition: getopt.c:415
void getopt_add_int(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help)
Definition: getopt.c:365
int getopt_get_int(getopt_t *getopt, const char *lname)
Definition: getopt.c:425
char * getopt_get_usage(getopt_t *gopt)
Definition: getopt.c:499
Definition: zarray.h:49
int getopt_was_specified(getopt_t *gopt, const char *lname)
Definition: getopt.c:477
void getopt_do_usage(getopt_t *gopt)
Definition: getopt.c:492
double getopt_get_double(getopt_t *getopt, const char *lname)
Definition: getopt.c:455
void getopt_add_double(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help)
Definition: getopt.c:371
int getopt_parse(getopt_t *gopt, int argc, char *argv[], int showErrors)
Definition: getopt.c:147
void getopt_add_string(getopt_t *gopt, char sopt, const char *lname, const char *def, const char *help)
Definition: getopt.c:376
Definition: getopt.c:64
void getopt_add_bool(getopt_t *gopt, char sopt, const char *lname, int def, const char *help)
Definition: getopt.c:326
void getopt_add_spacer(getopt_t *gopt, const char *s)
Definition: getopt.c:318
int getopt_get_bool(getopt_t *getopt, const char *lname)
Definition: getopt.c:447
void getopt_destroy(getopt_t *gopt)
Definition: getopt.c:94


apriltags2
Author(s): Danylo Malyuta
autogenerated on Fri Oct 19 2018 04:02:32