summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCraig Silverstein <csilvers+gflags@google.com>2011-11-03 23:09:19 +0000
committerCraig Silverstein <csilvers+gflags@google.com>2011-11-03 23:09:19 +0000
commit10caa99e2d81bb63df4dbf42e5fc9deaee0b6370 (patch)
treef2b21b473d1d1d7ba14595da93f7a33a6b0dd470 /src
parent874aed5db7afc90509db9601135626ec509f48a2 (diff)
downloadgflags-10caa99e2d81bb63df4dbf42e5fc9deaee0b6370.tar.gz
gflags-10caa99e2d81bb63df4dbf42e5fc9deaee0b6370.tar.bz2
gflags-10caa99e2d81bb63df4dbf42e5fc9deaee0b6370.zip
Add back in a backwards-compatible constructor for
FlagRegisterer. Because this backwards-compatible API is intended to be short-lived, I did it in the simplest, least invasive way possible, which involved cutting-and-pasting. R=ncalvin,jkline DELTA=27 (27 added, 0 deleted, 0 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=3065 git-svn-id: https://gflags.googlecode.com/svn/trunk@62 6586e3c6-dcc4-952a-343f-ff74eb82781d
Diffstat (limited to 'src')
-rw-r--r--src/gflags.cc19
-rw-r--r--src/gflags/gflags.h.in5
-rw-r--r--src/windows/gflags/gflags.h5
3 files changed, 29 insertions, 0 deletions
diff --git a/src/gflags.cc b/src/gflags.cc
index 26955a8..c70d2a2 100644
--- a/src/gflags.cc
+++ b/src/gflags.cc
@@ -1421,6 +1421,25 @@ FlagRegisterer::FlagRegisterer(const char* name, const char* type,
FlagRegistry::GlobalRegistry()->RegisterFlag(flag); // default registry
}
+// TODO(csilvers): remove this by 1 Sept 2011.
+FlagRegisterer::FlagRegisterer(const char* name, const char* type,
+ const char* help, const char* filename,
+ void* current_storage, void* defvalue_storage) {
+ if (help == NULL)
+ help = "";
+ // FlagValue expects the type-name to not include any namespace
+ // components, so we get rid of those, if any.
+ if (strchr(type, ':'))
+ type = strrchr(type, ':') + 1;
+ FlagValue* current = new FlagValue(current_storage, type, false);
+ FlagValue* defvalue = new FlagValue(defvalue_storage, type, false);
+ // Importantly, flag_ will never be deleted, so storage is always good.
+ CommandLineFlag* flag = new CommandLineFlag(name, help, filename,
+ NULL, current, defvalue);
+ FlagRegistry::GlobalRegistry()->RegisterFlag(flag); // default registry
+}
+
+
// --------------------------------------------------------------------
// GetAllFlags()
// The main way the FlagRegistry class exposes its data. This
diff --git a/src/gflags/gflags.h.in b/src/gflags/gflags.h.in
index 2c495d4..fc069a9 100644
--- a/src/gflags/gflags.h.in
+++ b/src/gflags/gflags.h.in
@@ -432,6 +432,11 @@ class GFLAGS_DLL_DECL FlagRegisterer {
const char* help, const char* filename,
void* current_storage, void* defvalue_storage,
const fL::OptionalDefineArgs& optional_args);
+ // TODO(csilvers): remove this (and its impl in the .cc file),
+ // once all callers have been updated to the new form:
+ FlagRegisterer(const char* name, const char* type,
+ const char* help, const char* filename,
+ void* current_storage, void* defvalue_storage);
};
// If your application #defines STRIP_FLAG_HELP to a non-zero value
diff --git a/src/windows/gflags/gflags.h b/src/windows/gflags/gflags.h
index bfaab47..f33df2d 100644
--- a/src/windows/gflags/gflags.h
+++ b/src/windows/gflags/gflags.h
@@ -436,6 +436,11 @@ class GFLAGS_DLL_DECL FlagRegisterer {
const char* help, const char* filename,
void* current_storage, void* defvalue_storage,
const fL::OptionalDefineArgs& optional_args);
+ // TODO(csilvers): remove this (and its impl in the .cc file),
+ // once all callers have been updated to the new form:
+ FlagRegisterer(const char* name, const char* type,
+ const char* help, const char* filename,
+ void* current_storage, void* defvalue_storage);
};
// If your application #defines STRIP_FLAG_HELP to a non-zero value