DCL 4.0
Loading...
Searching...
No Matches
Arguments.h
Go to the documentation of this file.
1#ifndef __DCL_ARGUMENTS_H__
2#define __DCL_ARGUMENTS_H__ 20250128
3
4#ifndef __DCL_OBJECT_H__
5#include <dcl/Object.h>
6#endif
7#ifndef __DCL_ARRAY_H__
8#include <dcl/Array.h>
9#endif
10#ifndef __DCL_WRITER_H__
11#include <dcl/Writer.h>
12#endif
13
14__DCL_BEGIN_NAMESPACE
15
16class DCLCAPI Arguments : public Object
17{
18 DECLARE_CLASSINFO(Arguments)
19public:
20 struct Option
21 {
22 const wchar_t* name;
23 int key;
24 const wchar_t* arg;
25 int flags;
26 const wchar_t* doc;
27 };
28
29 Arguments(
30 Writer& _output, Writer& _errout,
31 const wchar_t* _program_version,
32 const wchar_t* _program_bug_address,
33 const wchar_t* _arg_doc,
34 const wchar_t* _doc,
35 const Option _options[]
36 );
37
38 bool parse(
39 int _argc, char* _argv[], bool _argv_required = true
40 );
41
42 Writer& output() const {
43 return __output;
44 }
45
46 Writer& errout() const {
47 return __errout;
48 }
49
50 const String& value0() const {
51 return __value0;
52 }
53
54 const StringArray& values() const {
55 return __values;
56 }
57
58protected:
59 virtual void onOption(int _key, const String& _arg)
61
62 virtual String onValidate();
63
64private:
65 Writer& __output;
66 Writer& __errout;
67
68 String __value0;
69 StringArray __values;
70
71 const wchar_t* __program_version;
72 const wchar_t* __program_bug_address;
73 const wchar_t* __arg_doc;
74 const wchar_t* __doc;
75 const Option* __options;
76
77public:
78 String help() const;
79 String shortUsage() const;
80 String tryUsage() const;
81 String argRequired(const String& _option) const;
82 String usage() const;
83 String version() const;
84};
85
86__DCL_END_NAMESPACE
87
88#endif // __DCL_ARGUMENTS_H__
#define DCLCAPI
Definition Config.h:100
#define __DCL_THROWS1(e)
Definition Config.h:167
#define DECLARE_CLASSINFO(class_name)
Definition Object.h:210
String usage() const
String argRequired(const String &_option) const
String version() const
virtual String onValidate()
Definition Arguments.cpp:49
String tryUsage() const
String shortUsage() const
String help() const
virtual void onOption(int _key, const String &_arg) __DCL_THROWS1(Exception *)
Definition Arguments.cpp:44
Object()
Definition Object.cpp:183