OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
OptionsParameterHandler.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <exception>
4
5#include "Options.h"
6#include "OptionSettings.h"
8{
9public:
11 {
12 _nextHandler = nextHandler;
13 return this;
14 }
15
16 void InterpreteOptionsParameter(const std::string& entry, ts::OptionSettings& options)
17 {
18 const bool suitableHandlerFound = IndividualInterpretation(entry, options);
19 if (!suitableHandlerFound)
20 {
21 if (_nextHandler == nullptr)
22 {
23 throw std::exception(std::string("Entry \"" + entry + " \" is not interpretable as content of a .snp options line.").c_str());
24 }
25 else
26 {
27 _nextHandler->InterpreteOptionsParameter(entry, options);
28 }
29 }
30 }
31protected:
38 virtual bool IndividualInterpretation(const std::string& entry, ts::OptionSettings& options) = 0;
39
40private:
41
42 OptionsParameterHandler* _nextHandler = nullptr;
43};
Definition OptionsParameterHandler.h:8
void InterpreteOptionsParameter(const std::string &entry, ts::OptionSettings &options)
Definition OptionsParameterHandler.h:16
virtual OptionsParameterHandler * SetNextHandler(OptionsParameterHandler *nextHandler)
Definition OptionsParameterHandler.h:10
virtual bool IndividualInterpretation(const std::string &entry, ts::OptionSettings &options)=0
Requires a string in lower cases.
Definition OptionSettings.h:7