aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-06-10 13:08:59 +0200
committerDan Engelbrecht <[email protected]>2025-06-10 13:08:59 +0200
commitf696e52d150ae284e26de5bdd78d1b1edf914314 (patch)
tree392920b1a1334d61900b871b851228cd7963a46c /src/zenutil/include
parentadd sentry configurations options for debug/environment (diff)
downloadzen-f696e52d150ae284e26de5bdd78d1b1edf914314.tar.xz
zen-f696e52d150ae284e26de5bdd78d1b1edf914314.zip
revert 61b4a88f and cadaad63
Diffstat (limited to 'src/zenutil/include')
-rw-r--r--src/zenutil/include/zenutil/environmentoptions.h92
1 files changed, 0 insertions, 92 deletions
diff --git a/src/zenutil/include/zenutil/environmentoptions.h b/src/zenutil/include/zenutil/environmentoptions.h
deleted file mode 100644
index 7418608e4..000000000
--- a/src/zenutil/include/zenutil/environmentoptions.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright Epic Games, Inc. All Rights Reserved.
-
-#pragma once
-
-#include <zencore/string.h>
-#include <zenutil/commandlineoptions.h>
-
-namespace zen {
-
-class EnvironmentOptions
-{
-public:
- class OptionValue
- {
- public:
- virtual void Parse(std::string_view Value) = 0;
-
- virtual ~OptionValue() {}
- };
-
- class StringOption : public OptionValue
- {
- public:
- explicit StringOption(std::string& Value);
- virtual void Parse(std::string_view Value) override;
- std::string& RefValue;
- };
-
- class FilePathOption : public OptionValue
- {
- public:
- explicit FilePathOption(std::filesystem::path& Value);
- virtual void Parse(std::string_view Value) override;
- std::filesystem::path& RefValue;
- };
-
- class BoolOption : public OptionValue
- {
- public:
- explicit BoolOption(bool& Value);
- virtual void Parse(std::string_view Value);
- bool& RefValue;
- };
-
- template<Integral T>
- class NumberOption : public OptionValue
- {
- public:
- explicit NumberOption(T& Value) : RefValue(Value) {}
- virtual void Parse(std::string_view Value) override
- {
- if (std::optional<T> OptionalValue = ParseInt<T>(Value); OptionalValue.has_value())
- {
- RefValue = OptionalValue.value();
- }
- }
- T& RefValue;
- };
-
- struct Option
- {
- std::string CommandLineOptionName;
- std::shared_ptr<OptionValue> Value;
- };
-
- std::shared_ptr<OptionValue> MakeOption(std::string& Value);
- std::shared_ptr<OptionValue> MakeOption(std::filesystem::path& Value);
-
- template<Integral T>
- std::shared_ptr<OptionValue> MakeOption(T& Value)
- {
- return std::make_shared<NumberOption<T>>(Value);
- };
-
- std::shared_ptr<OptionValue> MakeOption(bool& Value);
-
- template<typename T>
- void AddOption(std::string_view EnvName, T& Value, std::string_view CommandLineOptionName = "")
- {
- OptionMap.insert_or_assign(std::string(EnvName),
- Option{.CommandLineOptionName = std::string(CommandLineOptionName), .Value = MakeOption(Value)});
- };
-
- EnvironmentOptions();
-
- void Parse(const cxxopts::ParseResult& CmdLineResult);
-
-private:
- std::unordered_map<std::string, Option> OptionMap;
-};
-
-} // namespace zen