POption.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 
18 PAPILLON_BEGIN_NAMESPACE
19 
20 class PGuid;
21 class PImage;
22 class PInputVideoStream;
23 class POutputVideoStream;
24 class PRectanglei;
25 class PSizef;
26 class PSizei;
27 class PStringList;
28 
56 class PAPILLON_API_CORE POption : public PObject
57 {
58 public:
62  POption();
63 
67  POption(const PString& commandLine);
68 
72  POption(int argc, char** argv);
73 
77  POption(const POption& other);
78 
82  virtual ~POption();
83 
87  POption& operator=(const POption& other);
88 
98  static PStringList Parse(const PString& commandLine);
99 
103  bool IsEmpty() const;
104 
112  void AddStandardOptions();
113 
120  bool Option(const PString& optionName, const PString& description);
121 
126  bool Bool(const PString& optionName, bool defaultValue, const PString& description, bool isRequired = false);
127 
132  papillon::int32 Int(const PString& optionName, papillon::int32 defaultValue, const PString& description, bool isRequired = false);
133 
138  float Float(const PString& optionName, float defaultValue, const PString& description, bool isRequired = false);
139 
144  double Double(const PString& optionName, double defaultValue, const PString& description, bool isRequired = false);
145 
150  PString String(const PString& optionName, const PString& defaultValue, const PString& description, bool isRequired = false);
151 
157  PStringList StringList(const PString& optionName, const PStringList& defaultValue, const PString& description, bool isRequired = false);
158 
163  PGuid Guid(const PString& optionName, const PGuid& defaultValue, const PString& description, bool isRequired = false);
164 
169  PSizei Sizei(const PString& optionName, const PSizei& defaultValue, const PString& description, bool isRequired = false);
170 
175  PSizef Sizef(const PString& optionName, const PSizef& defaultValue, const PString& description, bool isRequired = false);
176 
181  PRectanglei Rectanglei(const PString& optionName, const PRectanglei& defaultValue, const PString& description, bool isRequired = false);
182 
187  PImage Image(const PString& optionName, const PImage& defaultValue, const PString& description, bool isRequired = false);
188 
193  PInputVideoStream InputVideoStream(const PString& optionName, const PInputVideoStream& defaultValue, const PString& description, bool isRequired = false);
194 
199  POutputVideoStream OutputVideoStream(const PString& optionName, const POutputVideoStream& defaultValue, const PString& description, bool isRequired = false);
200 
205  PResult Check() const;
206 
210  PString GetCmdLine() const;
211 
216  bool Has(const PString& optionName) const;
217 
222  PResult Set(const PString& optionName, const PString& value);
223 
227  PString ExportCommandLine() const;
228 
234  PString ToStringHelp(papillon::int32 lengthDescription = 50) const;
235 };
236 
238 
239 PAPILLON_END_NAMESPACE
The PString class provides an Unicode character strings.
Definition: PString.h:37
The PSizei class represents the size of an image or a rectangle: width (int) and height (int); PSizei...
Definition: PSizei.h:27
The PImage class represents a 2D-image; several pixel format and number of channels are supported (BG...
Definition: PImage.h:57
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
The PRectanglei class represents an axis-aligned rectangle with 32-bit int coordinates; PRectanglei i...
Definition: PRectanglei.h:33
The PInputVideoStream class represents an input video streams like a video file, a webcam or a RTSP s...
The POutputVideoStream class represents an output video streams like a video file, a network socket or simply a screen display.
The PStringList class represents a list of PString; NOT thread-safe.
Definition: PStringList.h:26
The PGuid class represents a Globally Unique Identifier (GUID); PGuid instances are immutable (thread...
Definition: PGuid.h:28
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45
The PSizef class represents the size of an image or a rectangle: width (float) and height (float); PS...
Definition: PSizef.h:28
The POption class represents a command line parser.
Definition: POption.h:56