[libcamera-devel] [PATCH v2 1/8] cam: options: Move enum OptionArgument

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Feb 1 00:47:14 CET 2019


From: Niklas Söderlund <niklas.soderlund at ragnatech.se>

The enumeration of the different possibilities for arguments can be used
by other parser then OptionsParser. Move it outside the class to make it
ready to be used by other parsers.

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/cam/main.cpp  |  3 +--
 src/cam/options.h | 12 ++++++------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index cb98d302dcf3..bde47a8f1798 100644
--- a/src/cam/main.cpp
+++ b/src/cam/main.cpp
@@ -38,8 +38,7 @@ static int parseOptions(int argc, char *argv[])
 	OptionsParser parser;
 
 	parser.addOption(OptCamera, "Specify which camera to operate on",
-			 "camera", OptionsParser::ArgumentRequired,
-			 "camera");
+			 "camera", ArgumentRequired, "camera");
 	parser.addOption(OptHelp, "Display this help message", "help");
 	parser.addOption(OptList, "List all cameras", "list");
 
diff --git a/src/cam/options.h b/src/cam/options.h
index f99ea7300a71..491f6a316fff 100644
--- a/src/cam/options.h
+++ b/src/cam/options.h
@@ -11,15 +11,15 @@
 #include <map>
 #include <vector>
 
+enum OptionArgument {
+	ArgumentNone,
+	ArgumentRequired,
+	ArgumentOptional,
+};
+
 class OptionsParser
 {
 public:
-	enum OptionArgument {
-		ArgumentNone,
-		ArgumentRequired,
-		ArgumentOptional,
-	};
-
 	class Options {
 	public:
 		Options();
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list