summaryrefslogtreecommitdiff
path: root/src/cam/options.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-06 02:35:37 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-07-22 17:13:11 +0300
commitaeb639041821feb2e8f34d671277b3996f033f56 (patch)
treeb0b0f03477c89f8ab2201aa5cec2e27d680edbcf /src/cam/options.h
parent12cb9293fa66ff64fcf9e1c970c0c07b3992d17a (diff)
cam: options: Move Option struct to options.cpp
The Option structure is an internal implementation detail and shouldn't be exposed in the API. Move it to options.cpp. This requires moving the inline constructors and destructors for the KeyValueParser and OptionsParser classes to options.cpp as well, as they need a full definition of the Option structure. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/cam/options.h')
-rw-r--r--src/cam/options.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/cam/options.h b/src/cam/options.h
index d0defb4b..688fe260 100644
--- a/src/cam/options.h
+++ b/src/cam/options.h
@@ -14,6 +14,7 @@
class KeyValueParser;
class OptionValue;
+struct Option;
enum OptionArgument {
ArgumentNone,
@@ -28,21 +29,6 @@ enum OptionType {
OptionKeyValue,
};
-struct Option {
- int opt;
- OptionType type;
- const char *name;
- OptionArgument argument;
- const char *argumentName;
- const char *help;
- KeyValueParser *keyValueParser;
- bool isArray;
-
- bool hasShortOption() const { return isalnum(opt); }
- bool hasLongOption() const { return name != nullptr; }
- const char *typeName() const;
-};
-
template<typename T>
class OptionsBase
{
@@ -73,7 +59,8 @@ public:
{
};
- virtual ~KeyValueParser() = default;
+ KeyValueParser();
+ virtual ~KeyValueParser();
bool addOption(const char *name, OptionType type, const char *help,
OptionArgument argument = ArgumentNone);
@@ -133,6 +120,9 @@ public:
{
};
+ OptionsParser();
+ ~OptionsParser();
+
bool addOption(int opt, OptionType type, const char *help,
const char *name = nullptr,
OptionArgument argument = ArgumentNone,