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

Side by Side Diff: tools/SkFlags.cpp

Issue 12961003: Allow more options for setting boolean flag values in SkFlags. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« tools/SkFlags.h ('K') | « tools/SkFlags.h ('k') | no next file » | 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 #include "SkFlags.h" 8 #include "SkFlags.h"
9 9
10 SkFlagInfo* SkFlags::gHead; 10 SkFlagInfo* SkFlags::gHead;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 helpPrinted = true; 86 helpPrinted = true;
87 } 87 }
88 if (!helpPrinted) { 88 if (!helpPrinted) {
89 bool flagMatched = false; 89 bool flagMatched = false;
90 SkFlagInfo* flag = gHead; 90 SkFlagInfo* flag = gHead;
91 while (flag != NULL) { 91 while (flag != NULL) {
92 if (flag->match(argv[i])) { 92 if (flag->match(argv[i])) {
93 flagMatched = true; 93 flagMatched = true;
94 switch (flag->getFlagType()) { 94 switch (flag->getFlagType()) {
95 case SkFlagInfo::kBool_FlagType: 95 case SkFlagInfo::kBool_FlagType:
96 // Handled by match, above 96 // Can be handled by match, above, but can also be s et by the next
97 // string.
98 if (i+1 < argc && !SkStrStartsWith(argv[i+1], '-')) {
99 i++;
100 bool value;
101 if (SkFlagInfo::ParseBoolArg(argv[i], &value)) {
102 flag->setBool(value);
103 }
104 }
97 break; 105 break;
98 case SkFlagInfo::kString_FlagType: 106 case SkFlagInfo::kString_FlagType:
99 flag->resetStrings(); 107 flag->resetStrings();
100 // Add all arguments until another flag is reached. 108 // Add all arguments until another flag is reached.
101 while (i+1 < argc && !SkStrStartsWith(argv[i+1], '-' )) { 109 while (i+1 < argc && !SkStrStartsWith(argv[i+1], '-' )) {
102 i++; 110 i++;
103 flag->append(argv[i]); 111 flag->append(argv[i]);
104 } 112 }
105 break; 113 break;
106 case SkFlagInfo::kInt_FlagType: 114 case SkFlagInfo::kInt_FlagType:
(...skipping 22 matching lines...) Expand all
129 gHead = NULL; 137 gHead = NULL;
130 while (flag != NULL) { 138 while (flag != NULL) {
131 SkFlagInfo* next = flag->next(); 139 SkFlagInfo* next = flag->next();
132 SkDELETE(flag); 140 SkDELETE(flag);
133 flag = next; 141 flag = next;
134 } 142 }
135 if (helpPrinted) { 143 if (helpPrinted) {
136 exit(0); 144 exit(0);
137 } 145 }
138 } 146 }
OLDNEW
« tools/SkFlags.h ('K') | « tools/SkFlags.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698