wavelength 1.0.0
Loading...
Searching...
No Matches
optionprocessor.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <memory>
5
6#include "os/option.h"
7#include "os/string.h"
8
15public:
17 OptionProcessor() = default;
18
26
36 void AddBool(const char *pszName, int *pnTarget, int nValue);
37
46 void AddString(const char *pszName, String *pTarget);
47
59 void Process(int argc, char **argv);
60
62 const std::list<std::unique_ptr<Option>> &GetOptions() const {
63 return mOptions;
64 }
65
67 int GetIndex() const {
68 return mIndex;
69 }
70
71private:
72 std::list<std::unique_ptr<Option>> mOptions;
73 int mIndex;
74 char **mArgv;
75 int mArgc;
76};
int GetIndex() const
Definition optionprocessor.h:67
void Process(int argc, char **argv)
Apply the options of a command line.
const std::list< std::unique_ptr< Option > > & GetOptions() const
Definition optionprocessor.h:62
~OptionProcessor()
Delete every option.
void AddString(const char *pszName, String *pTarget)
Add an option that reads the argument after it into a string.
void AddBool(const char *pszName, int *pnTarget, int nValue)
Add an option that stores a value when it is present.
OptionProcessor()=default
Construct a processor without options.
Growable text buffer that is also a PrnStream.
Definition string.h:19