OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SK_COMMAND_LINE_FLAGS_H | 8 #ifndef SK_COMMAND_LINE_FLAGS_H |
9 #define SK_COMMAND_LINE_FLAGS_H | 9 #define SK_COMMAND_LINE_FLAGS_H |
10 | 10 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 #define DEFINE_string2(name, shortName, defaultValue, helpString)
\ | 211 #define DEFINE_string2(name, shortName, defaultValue, helpString)
\ |
212 SkCommandLineFlags::StringArray FLAGS_##name;
\ | 212 SkCommandLineFlags::StringArray FLAGS_##name;
\ |
213 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(nam
e), \ | 213 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(nam
e), \ |
214 TO_STRING(sho
rtName), \ | 214 TO_STRING(sho
rtName), \ |
215 &FLAGS_##name
, \ | 215 &FLAGS_##name
, \ |
216 defaultValue,
\ | 216 defaultValue,
\ |
217 helpString) | 217 helpString) |
218 | 218 |
219 #define DECLARE_string(name) extern SkCommandLineFlags::StringArray FLAGS_##name
; | 219 #define DECLARE_string(name) extern SkCommandLineFlags::StringArray FLAGS_##name
; |
220 | 220 |
| 221 |
| 222 |
| 223 |
221 #define DEFINE_int32(name, defaultValue, helpString) \ | 224 #define DEFINE_int32(name, defaultValue, helpString) \ |
222 int32_t FLAGS_##name; \ | 225 int32_t FLAGS_##name; \ |
223 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateIntFlag(TO_STRING(name),
\ | 226 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateIntFlag(TO_STRING(name),
\ |
224 &FLAGS_##name,
\ | 227 &FLAGS_##name,
\ |
225 defaultValue,
\ | 228 defaultValue,
\ |
226 helpString) | 229 helpString) |
227 | 230 |
| 231 #define DEFINE_int32_2(name, shortName, defaultValue, helpString)
\ |
| 232 int32_t FLAGS_##name;
\ |
| 233 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateIntFlag(TO_STRING(name),
\ |
| 234 TO_STRING(shortN
ame), \ |
| 235 &FLAGS_##name,
\ |
| 236 defaultValue,
\ |
| 237 helpString) |
| 238 |
228 #define DECLARE_int32(name) extern int32_t FLAGS_##name; | 239 #define DECLARE_int32(name) extern int32_t FLAGS_##name; |
229 | 240 |
230 #define DEFINE_double(name, defaultValue, helpString) \ | 241 #define DEFINE_double(name, defaultValue, helpString) \ |
231 double FLAGS_##name; \ | 242 double FLAGS_##name; \ |
232 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateDoubleFlag(TO_STRING(nam
e), \ | 243 SK_UNUSED static bool unused_##name = SkFlagInfo::CreateDoubleFlag(TO_STRING(nam
e), \ |
233 &FLAGS_##name
, \ | 244 &FLAGS_##name
, \ |
234 defaultValue,
\ | 245 defaultValue,
\ |
235 helpString) | 246 helpString) |
236 | 247 |
237 #define DECLARE_double(name) extern double FLAGS_##name; | 248 #define DECLARE_double(name) extern double FLAGS_##name; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 * See comments for CreateBoolFlag. | 293 * See comments for CreateBoolFlag. |
283 */ | 294 */ |
284 static bool CreateIntFlag(const char* name, int32_t* pInt, | 295 static bool CreateIntFlag(const char* name, int32_t* pInt, |
285 int32_t defaultValue, const char* helpString) { | 296 int32_t defaultValue, const char* helpString) { |
286 SkFlagInfo* info = new SkFlagInfo(name, nullptr, kInt_FlagType, helpStri
ng); | 297 SkFlagInfo* info = new SkFlagInfo(name, nullptr, kInt_FlagType, helpStri
ng); |
287 info->fIntValue = pInt; | 298 info->fIntValue = pInt; |
288 *info->fIntValue = info->fDefaultInt = defaultValue; | 299 *info->fIntValue = info->fDefaultInt = defaultValue; |
289 return true; | 300 return true; |
290 } | 301 } |
291 | 302 |
| 303 static bool CreateIntFlag(const char* name, const char* shortName, int32_t*
pInt, |
| 304 int32_t defaultValue, const char* helpString) { |
| 305 SkFlagInfo* info = new SkFlagInfo(name, shortName, kInt_FlagType, helpSt
ring); |
| 306 info->fIntValue = pInt; |
| 307 *info->fIntValue = info->fDefaultInt = defaultValue; |
| 308 return true; |
| 309 } |
| 310 |
292 /** | 311 /** |
293 * See comments for CreateBoolFlag. | 312 * See comments for CreateBoolFlag. |
294 */ | 313 */ |
295 static bool CreateDoubleFlag(const char* name, double* pDouble, | 314 static bool CreateDoubleFlag(const char* name, double* pDouble, |
296 double defaultValue, const char* helpString) { | 315 double defaultValue, const char* helpString) { |
297 SkFlagInfo* info = new SkFlagInfo(name, nullptr, kDouble_FlagType, helpS
tring); | 316 SkFlagInfo* info = new SkFlagInfo(name, nullptr, kDouble_FlagType, helpS
tring); |
298 info->fDoubleValue = pDouble; | 317 info->fDoubleValue = pDouble; |
299 *info->fDoubleValue = info->fDefaultDouble = defaultValue; | 318 *info->fDoubleValue = info->fDefaultDouble = defaultValue; |
300 return true; | 319 return true; |
301 } | 320 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 double* fDoubleValue; | 460 double* fDoubleValue; |
442 double fDefaultDouble; | 461 double fDefaultDouble; |
443 SkCommandLineFlags::StringArray* fStrings; | 462 SkCommandLineFlags::StringArray* fStrings; |
444 // Both for the help string and in case fStrings is empty. | 463 // Both for the help string and in case fStrings is empty. |
445 SkString fDefaultString; | 464 SkString fDefaultString; |
446 | 465 |
447 // In order to keep a linked list. | 466 // In order to keep a linked list. |
448 SkFlagInfo* fNext; | 467 SkFlagInfo* fNext; |
449 }; | 468 }; |
450 #endif // SK_COMMAND_LINE_FLAGS_H | 469 #endif // SK_COMMAND_LINE_FLAGS_H |
OLD | NEW |