summaryrefslogtreecommitdiff
path: root/absl/flags/internal/registry.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/flags/internal/registry.h')
-rw-r--r--absl/flags/internal/registry.h57
1 files changed, 6 insertions, 51 deletions
diff --git a/absl/flags/internal/registry.h b/absl/flags/internal/registry.h
index d851d245..69ff889f 100644
--- a/absl/flags/internal/registry.h
+++ b/absl/flags/internal/registry.h
@@ -20,43 +20,18 @@
#include <map>
#include <string>
+#include "absl/base/config.h"
#include "absl/base/macros.h"
#include "absl/flags/internal/commandlineflag.h"
+#include "absl/strings/string_view.h"
// --------------------------------------------------------------------
// Global flags registry API.
namespace absl {
-inline namespace lts_2019_08_08 {
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
-// CommandLineFlagInfo holds all information for a flag.
-struct CommandLineFlagInfo {
- std::string name; // the name of the flag
- std::string type; // DO NOT use. Use flag->IsOfType<T>() instead.
- std::string description; // the "help text" associated with the flag
- std::string current_value; // the current value, as a std::string
- std::string default_value; // the default value, as a std::string
- std::string filename; // 'cleaned' version of filename holding the flag
- bool has_validator_fn; // true if RegisterFlagValidator called on this flag
-
- bool is_default; // true if the flag has the default value and
- // has not been set explicitly from the cmdline
- // or via SetCommandLineOption.
-
- // nullptr for ABSL_FLAG. A pointer to the flag's current value
- // otherwise. E.g., for DEFINE_int32(foo, ...), flag_ptr will be
- // &FLAGS_foo.
- const void* flag_ptr;
-};
-
-//-----------------------------------------------------------------------------
-
-void FillCommandLineFlagInfo(CommandLineFlag* flag,
- CommandLineFlagInfo* result);
-
-//-----------------------------------------------------------------------------
-
CommandLineFlag* FindCommandLineFlag(absl::string_view name);
CommandLineFlag* FindRetiredFlag(absl::string_view name);
@@ -69,11 +44,6 @@ void ForEachFlag(std::function<void(CommandLineFlag*)> visitor);
//-----------------------------------------------------------------------------
-// Store the list of all flags in *OUTPUT, sorted by file.
-void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT);
-
-//-----------------------------------------------------------------------------
-
bool RegisterCommandLineFlag(CommandLineFlag*);
//-----------------------------------------------------------------------------
@@ -107,29 +77,14 @@ bool RegisterCommandLineFlag(CommandLineFlag*);
// 4: Remove the old_lib 'retired' registration.
// 5: Eventually delete the graveyard registration entirely.
//
-// Returns bool to enable use in namespace-scope initializers.
-// For example:
-//
-// static const bool dummy = base::RetiredFlag<int32_t>("myflag");
-//
-// Or to declare several at once:
-//
-// static bool dummies[] = {
-// base::RetiredFlag<std::string>("some_string_flag"),
-// base::RetiredFlag<double>("some_double_flag"),
-// base::RetiredFlag<int32_t>("some_int32_flag")
-// };
// Retire flag with name "name" and type indicated by ops.
-bool Retire(FlagOpFn ops, FlagMarshallingOpFn marshalling_ops,
- const char* name);
+bool Retire(const char* name, FlagStaticTypeId type_id);
// Registered a retired flag with name 'flag_name' and type 'T'.
template <typename T>
inline bool RetiredFlag(const char* flag_name) {
- return flags_internal::Retire(flags_internal::FlagOps<T>,
- flags_internal::FlagMarshallingOps<T>,
- flag_name);
+ return flags_internal::Retire(flag_name, &FlagStaticTypeIdGen<T>);
}
// If the flag is retired, returns true and indicates in |*type_is_bool|
@@ -163,7 +118,7 @@ class FlagSaver {
};
} // namespace flags_internal
-} // inline namespace lts_2019_08_08
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_REGISTRY_H_