FreeNOS
Argument.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIBSTD_ARGUMENT_H
19#define __LIBSTD_ARGUMENT_H
20
21#include <Types.h>
22#include <String.h>
23
36{
37 public:
38
44 Argument(const char *name);
45
51 Argument(const String & name);
52
58 char getIdentifier() const;
59
65 const String & getName() const;
66
72 const String & getDescription() const;
73
79 const String & getValue() const;
80
86 Size getCount() const;
87
93 void setIdentifier(char id);
94
100 void setName(const char *name);
101
107 void setDescription(const char *description);
108
114 void setValue(const char *value);
115
121 void setCount(Size count);
122
130 bool operator == (const Argument & arg) const;
131
139 bool operator != (const Argument & arg) const;
140
141 private:
142
144 char m_id;
145
148
151
154
157};
158
164#endif /* __LIBAPP_ARGUMENT_H */
Represents program command line argument.
Definition Argument.h:36
const String & getValue() const
Retrieve argument option value (if any)
Definition Argument.cpp:54
const String & getDescription() const
Retrieve single line argument description.
Definition Argument.cpp:49
void setCount(Size count)
Set argument maximum count.
Definition Argument.cpp:79
void setIdentifier(char id)
Set argument identifier.
Definition Argument.cpp:59
const String & getName() const
Retrieve argument name.
Definition Argument.cpp:44
void setName(const char *name)
Set argument name.
Definition Argument.cpp:64
bool operator!=(const Argument &arg) const
Non-equality operator.
Definition Argument.cpp:89
bool operator==(const Argument &arg) const
Equality operator.
Definition Argument.cpp:84
String m_value
Optional argument value.
Definition Argument.h:153
String m_name
Argument name.
Definition Argument.h:147
void setDescription(const char *description)
Set argument single line description.
Definition Argument.cpp:69
char getIdentifier() const
Get single character identifier.
Definition Argument.cpp:34
Size m_count
Maximum argument count.
Definition Argument.h:156
Size getCount() const
Retrieve maximum argument count (if set)
Definition Argument.cpp:39
String m_description
Argument description in a single line.
Definition Argument.h:150
char m_id
Argument identifier.
Definition Argument.h:144
void setValue(const char *value)
Set argument option value.
Definition Argument.cpp:74
Abstraction of strings.
Definition String.h:42
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128