Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: tools/flags/SkCommandLineFlags.h

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/bench_pictures_main.cpp ('k') | tools/flags/SkCommandLineFlags.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 * be referenced on the command line as "--name" to set the value of th is flag. 255 * be referenced on the command line as "--name" to set the value of th is flag.
256 * @param shortName Short version (one character) of the name of the flag. This name can 256 * @param shortName Short version (one character) of the name of the flag. This name can
257 * be referenced on the command line as "-shortName" to set the value o f this flag. 257 * be referenced on the command line as "-shortName" to set the value o f this flag.
258 * @param p<Type> Pointer to a global variable which holds the value set by SkCommandLineFlags. 258 * @param p<Type> Pointer to a global variable which holds the value set by SkCommandLineFlags.
259 * @param defaultValue The default value of this flag. The variable pointed to by p<Type> will 259 * @param defaultValue The default value of this flag. The variable pointed to by p<Type> will
260 * be set to this value initially. This is also displayed as part of th e help output. 260 * be set to this value initially. This is also displayed as part of th e help output.
261 * @param helpString Explanation of what this flag changes in the program. 261 * @param helpString Explanation of what this flag changes in the program.
262 */ 262 */
263 static bool CreateBoolFlag(const char* name, const char* shortName, bool* pB ool, 263 static bool CreateBoolFlag(const char* name, const char* shortName, bool* pB ool,
264 bool defaultValue, const char* helpString) { 264 bool defaultValue, const char* helpString) {
265 SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, shortName, kBool_FlagTy pe, helpString)); 265 SkFlagInfo* info = new SkFlagInfo(name, shortName, kBool_FlagType, helpS tring);
266 info->fBoolValue = pBool; 266 info->fBoolValue = pBool;
267 *info->fBoolValue = info->fDefaultBool = defaultValue; 267 *info->fBoolValue = info->fDefaultBool = defaultValue;
268 return true; 268 return true;
269 } 269 }
270 270
271 /** 271 /**
272 * See comments for CreateBoolFlag. 272 * See comments for CreateBoolFlag.
273 * @param pStrings Unlike the others, this is a pointer to an array of valu es. 273 * @param pStrings Unlike the others, this is a pointer to an array of valu es.
274 * @param defaultValue Thise default will be parsed so that strings separat ed by spaces 274 * @param defaultValue Thise default will be parsed so that strings separat ed by spaces
275 * will be added to pStrings. 275 * will be added to pStrings.
276 */ 276 */
277 static bool CreateStringFlag(const char* name, const char* shortName, 277 static bool CreateStringFlag(const char* name, const char* shortName,
278 SkCommandLineFlags::StringArray* pStrings, 278 SkCommandLineFlags::StringArray* pStrings,
279 const char* defaultValue, const char* helpStrin g); 279 const char* defaultValue, const char* helpStrin g);
280 280
281 /** 281 /**
282 * See comments for CreateBoolFlag. 282 * See comments for CreateBoolFlag.
283 */ 283 */
284 static bool CreateIntFlag(const char* name, int32_t* pInt, 284 static bool CreateIntFlag(const char* name, int32_t* pInt,
285 int32_t defaultValue, const char* helpString) { 285 int32_t defaultValue, const char* helpString) {
286 SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, NULL, kInt_FlagType, he lpString)); 286 SkFlagInfo* info = new SkFlagInfo(name, NULL, kInt_FlagType, helpString) ;
287 info->fIntValue = pInt; 287 info->fIntValue = pInt;
288 *info->fIntValue = info->fDefaultInt = defaultValue; 288 *info->fIntValue = info->fDefaultInt = defaultValue;
289 return true; 289 return true;
290 } 290 }
291 291
292 /** 292 /**
293 * See comments for CreateBoolFlag. 293 * See comments for CreateBoolFlag.
294 */ 294 */
295 static bool CreateDoubleFlag(const char* name, double* pDouble, 295 static bool CreateDoubleFlag(const char* name, double* pDouble,
296 double defaultValue, const char* helpString) { 296 double defaultValue, const char* helpString) {
297 SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, NULL, kDouble_FlagType, helpString)); 297 SkFlagInfo* info = new SkFlagInfo(name, NULL, kDouble_FlagType, helpStri ng);
298 info->fDoubleValue = pDouble; 298 info->fDoubleValue = pDouble;
299 *info->fDoubleValue = info->fDefaultDouble = defaultValue; 299 *info->fDoubleValue = info->fDefaultDouble = defaultValue;
300 return true; 300 return true;
301 } 301 }
302 302
303 /** 303 /**
304 * Returns true if the string matches this flag. 304 * Returns true if the string matches this flag.
305 * For a boolean flag, also sets the value, since a boolean flag can be set in a number of ways 305 * For a boolean flag, also sets the value, since a boolean flag can be set in a number of ways
306 * without looking at the following string: 306 * without looking at the following string:
307 * --name 307 * --name
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 double* fDoubleValue; 441 double* fDoubleValue;
442 double fDefaultDouble; 442 double fDefaultDouble;
443 SkCommandLineFlags::StringArray* fStrings; 443 SkCommandLineFlags::StringArray* fStrings;
444 // Both for the help string and in case fStrings is empty. 444 // Both for the help string and in case fStrings is empty.
445 SkString fDefaultString; 445 SkString fDefaultString;
446 446
447 // In order to keep a linked list. 447 // In order to keep a linked list.
448 SkFlagInfo* fNext; 448 SkFlagInfo* fNext;
449 }; 449 };
450 #endif // SK_COMMAND_LINE_FLAGS_H 450 #endif // SK_COMMAND_LINE_FLAGS_H
OLDNEW
« no previous file with comments | « tools/bench_pictures_main.cpp ('k') | tools/flags/SkCommandLineFlags.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698