Open Lighting Architecture
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
80
using
std::string;
81
89
void
SetHelpString
(
const
string
&first_line,
const
string
&description);
90
94
void
DisplayUsage
();
95
104
void
ParseFlags
(
int
*argc,
char
**argv);
105
}
// namespace ola
106
107
// DECLARE_*
108
113
#define DECLARE_bool(name) \
114
DECLARE_flag(bool, name)
115
120
#define DECLARE_int8(name) \
121
DECLARE_flag(int8_t, name)
122
127
#define DECLARE_int16(name) \
128
DECLARE_flag(int16_t, name)
129
134
#define DECLARE_int32(name) \
135
DECLARE_flag(int32_t, name)
136
141
#define DECLARE_uint8(name) \
142
DECLARE_flag(uint8_t, name)
143
148
#define DECLARE_uint16(name) \
149
DECLARE_flag(uint16_t, name)
150
155
#define DECLARE_uint32(name) \
156
DECLARE_flag(uint32_t, name)
157
162
#define DECLARE_string(name) \
163
DECLARE_flag(std::string, name)
164
165
// DEFINE_*
166
175
#define DEFINE_bool(name, default_value, help_str) \
176
DEFINE_flag(bool, name, \0, default_value, help_str)
177
187
#define DEFINE_s_bool(name, short_opt, default_value, help_str) \
188
DEFINE_flag_with_short(bool, name, short_opt, default_value, help_str)
189
197
#define DEFINE_int8(name, default_value, help_str) \
198
DEFINE_flag(int8_t, name, \0, default_value, help_str)
199
208
#define DEFINE_s_int8(name, short_opt, default_value, help_str) \
209
DEFINE_flag_with_short(int8_t, name, short_opt, default_value, help_str)
210
218
#define DEFINE_uint8(name, default_value, help_str) \
219
DEFINE_flag(uint8_t, name, \0, default_value, help_str)
220
229
#define DEFINE_s_uint8(name, short_opt, default_value, help_str) \
230
DEFINE_flag_with_short(uint8_t, name, short_opt, default_value, help_str)
231
239
#define DEFINE_int16(name, default_value, help_str) \
240
DEFINE_flag(int16_t, name, \0, default_value, help_str)
241
250
#define DEFINE_s_int16(name, short_opt, default_value, help_str) \
251
DEFINE_flag_with_short(int16_t, name, short_opt, default_value, help_str)
252
253
261
#define DEFINE_uint16(name, default_value, help_str) \
262
DEFINE_flag(uint16_t, name, \0, default_value, help_str)
263
272
#define DEFINE_s_uint16(name, short_opt, default_value, help_str) \
273
DEFINE_flag_with_short(uint16_t, name, short_opt, default_value, help_str)
274
282
#define DEFINE_int32(name, default_value, help_str) \
283
DEFINE_flag(int32_t, name, \0, default_value, help_str)
284
293
#define DEFINE_s_int32(name, short_opt, default_value, help_str) \
294
DEFINE_flag_with_short(int32_t, name, short_opt, default_value, help_str)
295
303
#define DEFINE_uint32(name, default_value, help_str) \
304
DEFINE_flag(uint32_t, name, \0, default_value, help_str)
305
314
#define DEFINE_s_uint32(name, short_opt, default_value, help_str) \
315
DEFINE_flag_with_short(uint32_t, name, short_opt, default_value, help_str)
316
324
#define DEFINE_string(name, default_value, help_str) \
325
DEFINE_flag(std::string, name, \0, default_value, help_str)
326
335
#define DEFINE_s_string(name, short_opt, default_value, help_str) \
336
DEFINE_flag_with_short(std::string, name, short_opt, default_value, help_str)
337
340
#endif // INCLUDE_OLA_BASE_FLAGS_H_
Generated on Fri Apr 4 2014 11:54:22 for Open Lighting Architecture by
1.8.1.2