aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-21 19:43:15 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-21 19:43:15 +0000
commitd9ba9a05d6f5766fdb1378b6ed84c0659009a8da (patch)
tree3add5282273525de50f0b77ad7ff276cf91ddd46
parentcc9aad5787b52216f46b9d6d95a781240e3e6b6b (diff)
Change the name of SkFlags to SkCommandLineFlags.
This name is more specific to what it actually does. Also move the code into tools/flags, to (slightly) better organize the massive tools folder. Update the programs that use it to use the new names. No functionality changes. BUG=https://code.google.com/p/skia/issues/detail?id=1173 Review URL: https://codereview.chromium.org/12440067 git-svn-id: http://skia.googlecode.com/svn/trunk@8304 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gm/gmmain.cpp6
-rw-r--r--gyp/flags.gyp6
-rw-r--r--gyp/tools.gyp2
-rw-r--r--tools/PictureRenderingFlags.cpp2
-rw-r--r--tools/PictureRenderingFlags.h4
-rw-r--r--tools/bench_pictures_main.cpp6
-rw-r--r--tools/flags/SkCommandLineFlags.cpp (renamed from tools/SkFlags.cpp)14
-rw-r--r--tools/flags/SkCommandLineFlags.h (renamed from tools/SkFlags.h)26
-rw-r--r--tools/render_pictures_main.cpp6
-rw-r--r--tools/skhello.cpp6
10 files changed, 40 insertions, 38 deletions
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 9774d9ee41..42c7889976 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -19,11 +19,11 @@
#include "SkBitmap.h"
#include "SkBitmapChecksummer.h"
#include "SkColorPriv.h"
+#include "SkCommandLineFlags.h"
#include "SkData.h"
#include "SkDeferredCanvas.h"
#include "SkDevice.h"
#include "SkDrawFilter.h"
-#include "SkFlags.h"
#include "SkGPipe.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
@@ -1405,8 +1405,8 @@ int tool_main(int argc, char** argv) {
SkString usage;
usage.printf("Run the golden master tests.\n");
- SkFlags::SetUsage(usage.c_str());
- SkFlags::ParseCommandLine(argc, argv);
+ SkCommandLineFlags::SetUsage(usage.c_str());
+ SkCommandLineFlags::Parse(argc, argv);
gmmain.fUseFileHierarchy = FLAGS_hierarchy;
if (FLAGS_mismatchPath.count() == 1) {
diff --git a/gyp/flags.gyp b/gyp/flags.gyp
index 712a04b998..aa83ea9e01 100644
--- a/gyp/flags.gyp
+++ b/gyp/flags.gyp
@@ -6,8 +6,8 @@
'target_name': 'flags',
'type': 'static_library',
'sources': [
- '../tools/SkFlags.h',
- '../tools/SkFlags.cpp',
+ '../tools/flags/SkCommandLineFlags.h',
+ '../tools/flags/SkCommandLineFlags.cpp',
],
'dependencies': [
'skia_base_libs.gyp:skia_base_libs',
@@ -15,7 +15,7 @@
],
'direct_dependent_settings': {
'include_dirs': [
- '../tools/',
+ '../tools/flags',
],
}
},
diff --git a/gyp/tools.gyp b/gyp/tools.gyp
index 9ed7d68082..70591afcc3 100644
--- a/gyp/tools.gyp
+++ b/gyp/tools.gyp
@@ -98,6 +98,7 @@
'tools.gyp:picture_renderer',
'tools.gyp:picture_utils',
'ports.gyp:ports',
+ 'flags.gyp:flags',
],
},
{
@@ -122,6 +123,7 @@
'tools.gyp:picture_renderer',
'bench.gyp:bench_timer',
'ports.gyp:ports',
+ 'flags.gyp:flags',
],
},
{
diff --git a/tools/PictureRenderingFlags.cpp b/tools/PictureRenderingFlags.cpp
index 29046aec71..dd2aeecb5a 100644
--- a/tools/PictureRenderingFlags.cpp
+++ b/tools/PictureRenderingFlags.cpp
@@ -12,8 +12,8 @@
#include "picture_utils.h"
#include "SkBitmapFactory.h"
+#include "SkCommandLineFlags.h"
#include "SkData.h"
-#include "SkFlags.h"
#include "SkImage.h"
#include "SkImageDecoder.h"
#include "SkLruImageCache.h"
diff --git a/tools/PictureRenderingFlags.h b/tools/PictureRenderingFlags.h
index e8909f9f4c..29215ac7e1 100644
--- a/tools/PictureRenderingFlags.h
+++ b/tools/PictureRenderingFlags.h
@@ -20,8 +20,8 @@ enum PictureTool {
};
/**
- * Uses SkFlags to parse the command line, and returns a PictureRenderer
- * reflecting the flags used. Assumes that SkFlags::ParseCommandLine has
+ * Uses SkCommandLineFlags to parse the command line, and returns a PictureRenderer
+ * reflecting the flags used. Assumes that SkCommandLineFlags::Parse has
* been called.
* @param error If there is an error or warning, it will be stored in error.
* @param tool Which tool is being used.
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index 31ef48449a..1013145a90 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -10,7 +10,7 @@
#include "PictureBenchmark.h"
#include "PictureRenderingFlags.h"
#include "SkBenchLogger.h"
-#include "SkFlags.h"
+#include "SkCommandLineFlags.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#if LAZY_CACHE_STATS
@@ -390,8 +390,8 @@ int tool_main(int argc, char** argv) {
usage.printf("Time drawing .skp files.\n"
"\tPossible arguments for --filter: [%s]\n\t\t[%s]",
filterTypesUsage().c_str(), filterFlagsUsage().c_str());
- SkFlags::SetUsage(usage.c_str());
- SkFlags::ParseCommandLine(argc, argv);
+ SkCommandLineFlags::SetUsage(usage.c_str());
+ SkCommandLineFlags::Parse(argc, argv);
if (FLAGS_repeat < 1) {
SkString error;
diff --git a/tools/SkFlags.cpp b/tools/flags/SkCommandLineFlags.cpp
index 9635b82c00..95811b906a 100644
--- a/tools/SkFlags.cpp
+++ b/tools/flags/SkCommandLineFlags.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "SkFlags.h"
+#include "SkCommandLineFlags.h"
static bool string_is_in(const char* target, const char* set[], size_t len) {
for (size_t i = 0; i < len; i++) {
@@ -79,10 +79,10 @@ bool SkFlagInfo::match(const char* string) {
return false;
}
-SkFlagInfo* SkFlags::gHead;
-SkString SkFlags::gUsage;
+SkFlagInfo* SkCommandLineFlags::gHead;
+SkString SkCommandLineFlags::gUsage;
-void SkFlags::SetUsage(const char* usage) {
+void SkCommandLineFlags::SetUsage(const char* usage) {
gUsage.set(usage);
}
@@ -139,11 +139,11 @@ static void print_help_for_flag(const SkFlagInfo* flag) {
SkDebugf("\n");
}
-void SkFlags::ParseCommandLine(int argc, char** argv) {
+void SkCommandLineFlags::Parse(int argc, char** argv) {
// Only allow calling this function once.
static bool gOnce;
if (gOnce) {
- SkDebugf("ParseCommandLine should only be called once at the beginning"
+ SkDebugf("Parse should only be called once at the beginning"
" of main!\n");
SkASSERT(false);
return;
@@ -168,7 +168,7 @@ void SkFlags::ParseCommandLine(int argc, char** argv) {
SkDebugf("%s\n%s\n", argv[0], gUsage.c_str());
}
SkDebugf("Flags:\n");
- SkFlagInfo* flag = SkFlags::gHead;
+ SkFlagInfo* flag = SkCommandLineFlags::gHead;
while (flag != NULL) {
// If no flags followed --help, print them all
bool printFlag = 0 == helpFlags.count();
diff --git a/tools/SkFlags.h b/tools/flags/SkCommandLineFlags.h
index c510707f83..1d4f409fbf 100644
--- a/tools/SkFlags.h
+++ b/tools/flags/SkCommandLineFlags.h
@@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
-#ifndef SK_FLAGS_H
-#define SK_FLAGS_H
+#ifndef SK_COMMAND_LINE_FLAGS_H
+#define SK_COMMAND_LINE_FLAGS_H
#include "SkString.h"
#include "SkTDArray.h"
/**
- * Including this file (and compiling SkFlags.cpp) provides command line
+ * Including this file (and compiling SkCommandLineFlags.cpp) provides command line
* parsing. In order to use it, use the following macros in global
* namespace:
*
@@ -21,8 +21,8 @@
* DEFINE_int32(name, defaultValue, helpString);
* DEFINE_double(name, defaultValue, helpString);
*
- * Then, in main, call SkFlags::SetUsage() to describe usage and call
- * SkFlags::ParseCommandLine() to parse the flags. Henceforth, each flag can
+ * Then, in main, call SkCommandLineFlags::SetUsage() to describe usage and call
+ * SkCommandLineFlags::Parse() to parse the flags. Henceforth, each flag can
* be referenced using
*
* FLAGS_name
@@ -85,8 +85,8 @@
*
* Inspired by gflags (https://code.google.com/p/gflags/). Is not quite as
* robust as gflags, but suits our purposes. For example, allows creating
- * a flag -h or -help which will never be used, since SkFlags handles it.
- * SkFlags will also allow creating --flag and --noflag. Uses the same input
+ * a flag -h or -help which will never be used, since SkCommandLineFlags handles it.
+ * SkCommandLineFlags will also allow creating --flag and --noflag. Uses the same input
* format as gflags and creates similarly named variables (i.e. FLAGS_name).
* Strings are handled differently (resulting variable will be an array of
* strings) so that a flag can be followed by multiple parameters.
@@ -95,12 +95,12 @@
class SkFlagInfo;
-class SkFlags {
+class SkCommandLineFlags {
public:
/**
* Call to set the help message to be displayed. Should be called before
- * ParseCommandLine.
+ * Parse.
*/
static void SetUsage(const char* usage);
@@ -108,7 +108,7 @@ public:
* Call at the beginning of main to parse flags created by DEFINE_x, above.
* Must only be called once.
*/
- static void ParseCommandLine(int argc, char** argv);
+ static void Parse(int argc, char** argv);
private:
static SkFlagInfo* gHead;
@@ -344,8 +344,8 @@ private:
, fDoubleValue(NULL)
, fDefaultDouble(0)
, fStrings(NULL) {
- fNext = SkFlags::gHead;
- SkFlags::gHead = this;
+ fNext = SkCommandLineFlags::gHead;
+ SkCommandLineFlags::gHead = this;
}
// Name of the flag, without initial dashes
SkString fName;
@@ -365,4 +365,4 @@ private:
// In order to keep a linked list.
SkFlagInfo* fNext;
};
-#endif // SK_FLAGS_H
+#endif // SK_COMMAND_LINE_FLAGS_H
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 5e0ac99945..81fb96c05a 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -8,7 +8,7 @@
#include "CopyTilesRenderer.h"
#include "SkBitmap.h"
#include "SkDevice.h"
-#include "SkFlags.h"
+#include "SkCommandLineFlags.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#include "SkImageEncoder.h"
@@ -274,8 +274,8 @@ static int process_input(const char* input, const SkString* outputDir,
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
- SkFlags::SetUsage("Render .skp files.");
- SkFlags::ParseCommandLine(argc, argv);
+ SkCommandLineFlags::SetUsage("Render .skp files.");
+ SkCommandLineFlags::Parse(argc, argv);
if (FLAGS_r.isEmpty()) {
SkDebugf(".skp files or directories are required.\n");
diff --git a/tools/skhello.cpp b/tools/skhello.cpp
index 8cea1d1640..271041589f 100644
--- a/tools/skhello.cpp
+++ b/tools/skhello.cpp
@@ -6,7 +6,7 @@
*/
#include "SkCanvas.h"
-#include "SkFlags.h"
+#include "SkCommandLineFlags.h"
#include "SkGraphics.h"
#include "SkImageEncoder.h"
#include "SkString.h"
@@ -16,8 +16,8 @@ DEFINE_string(t, "Hello", "The string to write.");
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
- SkFlags::SetUsage("");
- SkFlags::ParseCommandLine(argc, argv);
+ SkCommandLineFlags::SetUsage("");
+ SkCommandLineFlags::Parse(argc, argv);
SkAutoGraphics ag;
SkString path("skhello.png");