ADTF  3.18.2
commandline.h
Go to the documentation of this file.
1 
7 #ifndef _COMMAND_LINE_CLASS_HEADER_
8 #define _COMMAND_LINE_CLASS_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
53 class DOEXPORT cCommandLine
54 {
56 
57  protected:
66 
68  mutable std::list<cString> m_lstArgv;
70  mutable const tChar** m_pArgv;
72  mutable tInt m_nArgc;
73 
74  public:
79 
84  cCommandLine(const cString& strCommandLine);
85 
90  cCommandLine(const cCommandLine& oCommandLine);
91 
96  cCommandLine& operator=(const cCommandLine& oCommandLine);
97 
103  cCommandLine(int argc, const char** argv);
104 
108  virtual ~cCommandLine();
109 
115  tResult Set(const cString& strCommandLine);
116 
122  tResult Set(const cCommandLine& oCommandLine);
123 
130  tResult Set(int argc, const char** argv);
131 
137 
144  cString GetProperty(const cString& strName, const cString& strDefault=cString::Empty) const;
145 
152  tBool GetFlag(const cString& strName) const;
153 
160  cString GetValue(tInt nIdx, const cString& strDefault=cString::Empty) const;
161 
168  cString GetArg(tInt nIdx, const cString& strDefault = cString::Empty) const;
169 
170  public:
176  const cString& GetBuffer() const;
182  const cStringList& GetFlags() const;
183 
189  const cStringList& GetValues() const;
190 
196  const cStringMap& GetProperties() const;
197 
202  const tChar** GetArgv() const;
203 
208  tInt GetArgc() const;
209 
210  protected:
216 
222 
228 
229 };
230 
231 } // namespace A_UTILS_NS
232 
233 #endif // _COMMAND_LINE_CLASS_HEADER_
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
Command line processing.
Definition: commandline.h:54
cCommandLine(const cString &strCommandLine)
Constructor that parses a given command line string.
const cStringList & GetValues() const
Returns a list of all specified values.
cCommandLine & operator=(const cCommandLine &oCommandLine)
Assignment operator.
virtual ~cCommandLine()
Destructor.
tResult Set(const cCommandLine &oCommandLine)
Copy data from another command line objects.
tResult Set(int argc, const char **argv)
Set data using standard commandline parameters.
const tChar ** m_pArgv
Argument pointer.
Definition: commandline.h:70
cString GetValue(tInt nIdx, const cString &strDefault=cString::Empty) const
Returns a command line parameter that is no flag or property.
cCommandLine()
Default constructor.
cStringList m_lstValues
List of values.
Definition: commandline.h:63
const cString & GetBuffer() const
Returns a reference to the internal commandline buffer.
const cStringMap & GetProperties() const
Returns a map of all specified properties.
cCommandLine(const cCommandLine &oCommandLine)
Copy constructor.
tBool GetFlag(const cString &strName) const
Returns whether a flag (-flagname) was specified or not.
cString GetString() const
Builds a command line string by concatenating all parameters.
const cStringList & GetFlags() const
Returns a list of all specified flags.
tInt GetArgc() const
Returns the size of the array retreived by GetArgv().
tResult FreeArgs()
Frees the argument list.
cString GetArg(tInt nIdx, const cString &strDefault=cString::Empty) const
Returns a command line argument.
cString m_strBuffer
Internal buffer.
Definition: commandline.h:59
tInt m_nArgc
Argument count.
Definition: commandline.h:72
const tChar ** GetArgv() const
Returns a pointer to a standard style command line parameter array.
tResult Parse()
Parses the internal buffer.
cStringMap m_mapProperties
Property map of the commandline.
Definition: commandline.h:65
tResult Initialize()
Initializes internal parameters.
std::list< cString > m_lstArgv
Argument list.
Definition: commandline.h:68
cCommandLine(int argc, const char **argv)
Constructor for standard commandline parameters.
cStringList m_lstFlags
List of flags.
Definition: commandline.h:61
tResult Set(const cString &strCommandLine)
Parses a given command line string.
cString GetProperty(const cString &strName, const cString &strDefault=cString::Empty) const
Returns a property (-propertyname=value).
String map class.
Definition: stringmap.h:20
static const _myType Empty
Internally used empty string.
Definition: string.h:54
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition: d_ptr.h:270
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11