Loading...
Searching...
No Matches
flag.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "frontend/common.hpp"
6
7namespace by {
8
9 struct cli;
10
11 typedef std::vector<std::string> strings;
12
58 class flag: public instance {
59 BY(ADT(flag, instance))
60
61 public:
62 enum res {
63 MATCH,
64 EXIT_PROGRAM,
65 NOT_MATCH
66 };
67
68 public:
69 virtual const nchar* getName() const = 0;
70 virtual const nchar* getDescription() const = 0;
71
75 virtual res take(interpreter& ip, starter& s, cli& c, flagArgs& a, errReport& rpt) const;
76
81 nbool canTake(const std::string& pattern) const;
82
83 protected:
88 virtual ncnt getArgCount() const;
89
98
99 virtual const strings& _getRegExpr() const = 0;
100 virtual res _onTake(const flagArgs& tray, cli& c, interpreter& ip, starter& s, errReport& rpt) const = 0;
101
102 private:
106 ncnt _parseOption(flagArgs& a, flagArgs& tray, errReport& rpt) const;
107 };
108
109 typedef std::vector<tstr<flag>> flags;
110} // namespace by
Error report collector.
Definition errReport.hpp:24
Base class for command-line flag handling.
Definition flag.hpp:58
nbool canTake(const std::string &pattern) const
virtual res take(interpreter &ip, starter &s, cli &c, flagArgs &a, errReport &rpt) const
virtual ncnt getArgCount() const
void _delArgs(flagArgs &a, ncnt deleteOptionCnt) const
Deletes arguments from the flagArgs list.
Base class for all managed instances in memlite system.
Definition instance.hpp:41
High-level interpreter for byeol language.
Definition interpreter.hpp:35
Program execution starter.
Definition starter.hpp:39
Definition tnarr.hpp:9
Command-line interface for frontend language system.
Definition cli.hpp:37
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34