41 typedef std::multimap<std::string,
42 std::pair<std::string, std::size_t> >
KeyMap;
43 typedef std::pair<KeyMap::const_iterator,
45 typedef std::map<std::string,
55 std::string
operator[](std::string
const& keyword)
const;
63 std::string
const&
fileName =
"input.nn");
65 bool const exact =
false)
const override;
78 std::string
const& keyword,
79 bool exact =
false)
const;
87 std::string
keywordCheck(std::string
const& keyword)
const;
88 std::string
getValue(
Key const& key)
const override;
98 std::string
getValue(std::string
const& keyword)
const;
124 std::vector<std::string>
info()
const;
136 std::ofstream*
const& file,
137 std::map<std::size_t,
138 std::string>
const& replacements
145 std::vector<std::string>
log;
Reads and analyzes settings file and stores parameters.
std::vector< std::string > info() const
Get logged information about settings file.
std::string keywordCheck(std::string const &keyword) const
Check for keyword and alternatives, throw exception if not present.
static KeywordList knownKeywords
Map containing all known keywords and a description.
std::vector< std::string > lines
Vector of all lines in settings file.
std::multimap< std::string, std::pair< std::string, std::size_t > > KeyMap
std::string getValue(Key const &key) const override
void writeSettingsFile(std::ofstream *const &file, std::map< std::size_t, std::string > const &replacements={}) const
Write complete settings file.
std::pair< KeyMap::const_iterator, KeyMap::const_iterator > KeyRange
std::size_t loadFile(std::string const &fileName="input.nn")
Load a file with settings.
std::map< std::string, std::shared_ptr< Key > > const KeywordList
KeyRange getValues(std::string const &keyword) const
Get all keyword-value pairs for given keyword.
std::vector< std::string > log
Vector with log lines.
std::string fileName
Settings file name.
KeyMap contents
Map containing all keyword-value pairs.
std::vector< std::string > getSettingsLines() const
Get complete settings file.
bool keywordExists(Key const &key, bool const exact=false) const override
std::size_t parseLines()
Parse lines and create contents map.
void readFile()
Read file once and save all lines in lines vector.
std::pair< std::size_t, std::size_t > sanityCheck()
Check if all keywords are in known-keywords database and for duplicates.
std::string operator[](std::string const &keyword) const
Overload [] operator.