aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-19 17:38:50 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-19 17:38:50 +0000
commit0b735631b7d22316693629a4110c7e95b2a7633e (patch)
tree79627a69234e8df7883dfbc9243c7120aba2952e /tools
parent7d519305bb52eadf6b8265c6720642193791a364 (diff)
Revert "Make gm use SkFlags."
Fix the build. This reverts commit 6f1fe2aee39308fc56854b062be244a904c209e7. Review URL: https://codereview.chromium.org/12709005 git-svn-id: http://skia.googlecode.com/svn/trunk@8236 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r--tools/SkFlags.cpp8
-rw-r--r--tools/SkFlags.h51
2 files changed, 14 insertions, 45 deletions
diff --git a/tools/SkFlags.cpp b/tools/SkFlags.cpp
index e386b429fe..b4337d1273 100644
--- a/tools/SkFlags.cpp
+++ b/tools/SkFlags.cpp
@@ -38,12 +38,8 @@ void SkFlags::ParseCommandLine(int argc, char** argv) {
SkDebugf("Flags:\n");
SkFlagInfo* flag = SkFlags::gHead;
while (flag != NULL) {
- SkDebugf("\t--%s:\ttype: %s", flag->name().c_str(),
- flag->typeAsString().c_str());
- if (flag->defaultValue().size() > 0) {
- SkDebugf("\tdefault: %s", flag->defaultValue().c_str());
- }
- SkDebugf("\n");
+ SkDebugf("\t--%s:\ttype: %s\tdefault: %s\n", flag->name().c_str(),
+ flag->typeAsString().c_str(), flag->defaultValue().c_str());
const SkString& help = flag->help();
size_t length = help.size();
const char* currLine = help.c_str();
diff --git a/tools/SkFlags.h b/tools/SkFlags.h
index 79cc8788a3..d40cdd06f3 100644
--- a/tools/SkFlags.h
+++ b/tools/SkFlags.h
@@ -119,17 +119,6 @@ private:
#define DEFINE_bool(name, defaultValue, helpString) \
bool FLAGS_##name; \
static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name), \
- NULL, \
- &FLAGS_##name, \
- defaultValue, \
- helpString)
-
-// bool 2 allows specifying a short name. No check is done to ensure that shortName
-// is actually shorter than name.
-#define DEFINE_bool2(name, shortName, defaultValue, helpString) \
-bool FLAGS_##name; \
-static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name), \
- TO_STRING(shortName),\
&FLAGS_##name, \
defaultValue, \
helpString)
@@ -139,21 +128,10 @@ static bool unused_##name = SkFlagInfo::CreateBoolFlag(TO_STRING(name), \
#define DEFINE_string(name, defaultValue, helpString) \
SkTDArray<const char*> FLAGS_##name; \
static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(name), \
- NULL, \
&FLAGS_##name, \
defaultValue, \
helpString)
-// string2 allows specifying a short name. No check is done to ensure that shortName
-// is actually shorter than name.
-#define DEFINE_string2(name, shortName, defaultValue, helpString) \
-SkTDArray<const char*> FLAGS_##name; \
-static bool unused_##name = SkFlagInfo::CreateStringFlag(TO_STRING(name), \
- TO_STRING(shortName), \
- &FLAGS_##name, \
- defaultValue, \
- helpString)
-
#define DECLARE_string(name) extern SkTDArray<const char*> FLAGS_##name;
#define DEFINE_int32(name, defaultValue, helpString) \
@@ -185,20 +163,17 @@ public:
};
// Create flags of the desired type, and append to the list.
- static bool CreateBoolFlag(const char* name, const char* shortName, bool* pBool,
+ static bool CreateBoolFlag(const char* name, bool* pBool,
bool defaultValue, const char* helpString) {
SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, kBool_FlagType, helpString));
- info->fShortName.set(shortName);
info->fBoolValue = pBool;
*info->fBoolValue = info->fDefaultBool = defaultValue;
return true;
}
- static bool CreateStringFlag(const char* name, const char* shortName,
- SkTDArray<const char*>* pStrings,
+ static bool CreateStringFlag(const char* name, SkTDArray<const char*>* pStrings,
const char* defaultValue, const char* helpString) {
SkFlagInfo* info = SkNEW_ARGS(SkFlagInfo, (name, kString_FlagType, helpString));
- info->fShortName.set(shortName);
info->fDefaultString.set(defaultValue);
info->fStrings = pStrings;
@@ -231,28 +206,27 @@ public:
* value, since a bool is specified as true or false by --name or --noname.
*/
bool match(const char* string) {
- if (SkStrStartsWith(string, '-') && strlen(string) > 1) {
+ if (SkStrStartsWith(string, '-')) {
string++;
// Allow one or two dashes
- if (SkStrStartsWith(string, '-') && strlen(string) > 1) {
+ if (SkStrStartsWith(string, '-')) {
string++;
}
if (kBool_FlagType == fFlagType) {
// In this case, go ahead and set the value.
- if (fName.equals(string) || fShortName.equals(string)) {
+ if (fName.equals(string)) {
*fBoolValue = true;
return true;
}
- if (SkStrStartsWith(string, "no") && strlen(string) > 2) {
- string += 2;
- if (fName.equals(string) || fShortName.equals(string)) {
- *fBoolValue = false;
- return true;
- }
- return false;
+ SkString noname(fName);
+ noname.prepend("no");
+ if (noname.equals(string)) {
+ *fBoolValue = false;
+ return true;
}
+ return false;
}
- return fName.equals(string) || fShortName.equals(string);
+ return fName.equals(string);
} else {
// Has no dash
return false;
@@ -353,7 +327,6 @@ private:
}
// Name of the flag, without initial dashes
SkString fName;
- SkString fShortName;
FlagTypes fFlagType;
SkString fHelpString;
bool* fBoolValue;