FreeNOS
ArgumentContainer.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 __LIBAPP_ARGUMENTCONTAINER_H
19#define __LIBAPP_ARGUMENTCONTAINER_H
20
21#include <Types.h>
22#include <Macros.h>
23#include <String.h>
24#include <HashTable.h>
25#include <HashIterator.h>
26#include <Vector.h>
27#include "Argument.h"
28
41{
42 public:
43
53
54 public:
55
60
64 virtual ~ArgumentContainer();
65
73 const char * get(const char *name) const;
74
80 const Vector<Argument *> & getPositionals() const;
81
88
97
105 Result addFlag(Argument *arg);
106
107 private:
108
111
114};
115
121#endif /* __LIBAPP_ARGUMENTCONTAINER_H */
Generic command-line argument parser.
const HashTable< String, Argument * > & getFlags() const
Get flag arguments.
virtual ~ArgumentContainer()
Destructor.
Result addPositional(Argument *arg)
Add positional argument.
HashTable< String, Argument * > m_flags
Contains all flag arguments.
Vector< Argument * > m_positionals
Contains all positional arguments.
const Vector< Argument * > & getPositionals() const
Get positional arguments.
ArgumentContainer()
Constructor.
const char * get(const char *name) const
Get argument by name.
Result addFlag(Argument *arg)
Add flag argument.
Represents program command line argument.
Definition Argument.h:36
Efficient key -> value lookups.
Definition HashTable.h:45
Vectors are dynamically resizeable Arrays.
Definition Vector.h:42