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 
35 class Argument
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 */
Argument::getDescription
const String & getDescription() const
Retrieve single line argument description.
Definition: Argument.cpp:49
Argument::m_description
String m_description
Argument description in a single line.
Definition: Argument.h:150
Types.h
Argument::getIdentifier
char getIdentifier() const
Get single character identifier.
Definition: Argument.cpp:34
String
Abstraction of strings.
Definition: String.h:41
Argument::operator!=
bool operator!=(const Argument &arg) const
Non-equality operator.
Definition: Argument.cpp:89
Argument::operator==
bool operator==(const Argument &arg) const
Equality operator.
Definition: Argument.cpp:84
Argument::setCount
void setCount(Size count)
Set argument maximum count.
Definition: Argument.cpp:79
Argument
Represents program command line argument.
Definition: Argument.h:35
Argument::m_value
String m_value
Optional argument value.
Definition: Argument.h:153
Argument::getCount
Size getCount() const
Retrieve maximum argument count (if set)
Definition: Argument.cpp:39
Argument::setName
void setName(const char *name)
Set argument name.
Definition: Argument.cpp:64
Argument::setValue
void setValue(const char *value)
Set argument option value.
Definition: Argument.cpp:74
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
Argument::m_name
String m_name
Argument name.
Definition: Argument.h:147
Argument::setDescription
void setDescription(const char *description)
Set argument single line description.
Definition: Argument.cpp:69
Argument::m_id
char m_id
Argument identifier.
Definition: Argument.h:144
Argument::Argument
Argument(const char *name)
Class constructor.
Definition: Argument.cpp:20
String.h
Argument::setIdentifier
void setIdentifier(char id)
Set argument identifier.
Definition: Argument.cpp:59
Argument::getValue
const String & getValue() const
Retrieve argument option value (if any)
Definition: Argument.cpp:54
Argument::getName
const String & getName() const
Retrieve argument name.
Definition: Argument.cpp:44
Argument::m_count
Size m_count
Maximum argument count.
Definition: Argument.h:156