Open Lighting Architecture
0.9.2
Main Page
Modules
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
ola
base
Flags.h
Go to the documentation of this file.
1
/*
2
* This library is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU Lesser General Public
4
* License as published by the Free Software Foundation; either
5
* version 2.1 of the License, or (at your option) any later version.
6
*
7
* This library is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
* Lesser General Public License for more details.
11
*
12
* You should have received a copy of the GNU Lesser General Public
13
* License along with this library; if not, write to the Free Software
14
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
*
16
* Flags.h
17
* Command line flag (option) handling.
18
* Copyright (C) 2013 Simon Newton
19
*/
20
71
#ifndef INCLUDE_OLA_BASE_FLAGS_H_
72
#define INCLUDE_OLA_BASE_FLAGS_H_
73
74
#include <getopt.h>
75
#include <
ola/base/FlagsPrivate.h
>
76
#include <string>
77
78
namespace
ola {
79
86
void
SetHelpString(
const
std::string &first_line,
87
const
std::string &description);
88
92
void
DisplayUsage
();
93
97
void
DisplayUsageAndExit
();
98
102
void
DisplayVersion
();
103
112
void
ParseFlags
(
int
*argc,
char
**argv);
113
}
// namespace ola
114
115
// DECLARE_*
116
121
#define DECLARE_bool(name) \
122
DECLARE_flag(bool, name)
123
128
#define DECLARE_int8(name) \
129
DECLARE_flag(int8_t, name)
130
135
#define DECLARE_int16(name) \
136
DECLARE_flag(int16_t, name)
137
142
#define DECLARE_int32(name) \
143
DECLARE_flag(int32_t, name)
144
149
#define DECLARE_uint8(name) \
150
DECLARE_flag(uint8_t, name)
151
156
#define DECLARE_uint16(name) \
157
DECLARE_flag(uint16_t, name)
158
163
#define DECLARE_uint32(name) \
164
DECLARE_flag(uint32_t, name)
165
170
#define DECLARE_string(name) \
171
DECLARE_flag(std::string, name)
172
173
// DEFINE_*
174
189
#define DEFINE_bool(name, default_value, help_str) \
190
DEFINE_flag(bool, name, \0, default_value, help_str, true)
191
206
#define DEFINE_s_bool(name, short_opt, default_value, help_str) \
207
DEFINE_flag_with_short(bool, name, short_opt, default_value, help_str, true)
208
220
#define DEFINE_default_bool(name, default_value, help_str) \
221
DEFINE_flag(bool, name, \0, default_value, help_str, false)
222
236
#define DEFINE_s_default_bool(name, short_opt, default_value, help_str) \
237
DEFINE_flag_with_short(bool, name, short_opt, default_value, help_str, false)
238
246
#define DEFINE_int8(name, default_value, help_str) \
247
DEFINE_flag(int8_t, name, \0, default_value, help_str, true)
248
257
#define DEFINE_s_int8(name, short_opt, default_value, help_str) \
258
DEFINE_flag_with_short(int8_t, name, short_opt, default_value, help_str, \
259
true)
260
268
#define DEFINE_uint8(name, default_value, help_str) \
269
DEFINE_flag(uint8_t, name, \0, default_value, help_str, true)
270
279
#define DEFINE_s_uint8(name, short_opt, default_value, help_str) \
280
DEFINE_flag_with_short(uint8_t, name, short_opt, default_value, help_str, \
281
true)
282
290
#define DEFINE_int16(name, default_value, help_str) \
291
DEFINE_flag(int16_t, name, \0, default_value, help_str, true)
292
301
#define DEFINE_s_int16(name, short_opt, default_value, help_str) \
302
DEFINE_flag_with_short(int16_t, name, short_opt, default_value, help_str, \
303
true)
304
305
313
#define DEFINE_uint16(name, default_value, help_str) \
314
DEFINE_flag(uint16_t, name, \0, default_value, help_str, true)
315
324
#define DEFINE_s_uint16(name, short_opt, default_value, help_str) \
325
DEFINE_flag_with_short(uint16_t, name, short_opt, default_value, help_str, \
326
true)
327
335
#define DEFINE_int32(name, default_value, help_str) \
336
DEFINE_flag(int32_t, name, \0, default_value, help_str, true)
337
346
#define DEFINE_s_int32(name, short_opt, default_value, help_str) \
347
DEFINE_flag_with_short(int32_t, name, short_opt, default_value, help_str, \
348
true)
349
357
#define DEFINE_uint32(name, default_value, help_str) \
358
DEFINE_flag(uint32_t, name, \0, default_value, help_str, true)
359
368
#define DEFINE_s_uint32(name, short_opt, default_value, help_str) \
369
DEFINE_flag_with_short(uint32_t, name, short_opt, default_value, help_str, \
370
true)
371
379
#define DEFINE_string(name, default_value, help_str) \
380
DEFINE_flag(std::string, name, \0, default_value, help_str, true)
381
390
#define DEFINE_s_string(name, short_opt, default_value, help_str) \
391
DEFINE_flag_with_short(std::string, name, short_opt, default_value, \
392
help_str, true)
393
396
#endif // INCLUDE_OLA_BASE_FLAGS_H_
Generated on Thu Aug 21 2014 16:02:55 for Open Lighting Architecture by
1.8.1.2