50 std::map<std::string, std::string>
mapping;
70 std::string
operator[](
const std::string& key)
const;
76 inline bool has(
const std::string& key)
const {
return mapping.find(key) !=
mapping.cend(); }
85 inline T
get(
const std::string& key)
const;
94 inline T
get(
const std::string& key,
const T defaultValue)
const {
95 return has(key) ? get<T>(key) : defaultValue;
105 void set(
const std::string& key, T value);
114 std::map<std::string, std::vector<Block>>
chapters;
126 void printOut(std::ostream& stream);
139 const std::vector<Block>&
operator[](
const std::string& key)
const;
146 void emplace(
const std::string& key, Block&& block);
156 return std::atoi((*
this)[key].c_str());
161 return std::atof((*
this)[key].c_str());
166 return (*
this)[key] ==
"true";
T get(const std::string &key) const
Returns a value by key casted to a given type.
T get(const std::string &key, const T defaultValue) const
Returns a value by key casted to a given type.
void set(const std::string &key, T value)
Sets a value for a specific key.
std::map< std::string, std::string > mapping
void printOut(std::ostream &stream)
Prints out the block to an output stream.
int getLineNumber() const
Returns line number the block starts at.
Block(const std::map< std::string, std::string > &mapping)
std::string operator[](const std::string &key) const
Retrieves a value by key.
bool has(const std::string &key) const
Returns true if a value is defined for a specific key in the block.
Parser of simple YAML-like listings.
const std::vector< Block > & operator[](const std::string &key) const
Retrieves a chapter in the listing by its name.
bool has(const std::string &key) const
Returns true if a specific chapter is present in the listing.
void printOut(std::ostream &stream)
Prints out the listing to an output stream.
std::map< std::string, std::vector< Block > > chapters
void emplace(const std::string &key, Block &&block)
Adds a block to a chapter.
std::string to_string(Beatmup::NNets::ActivationFunction function)
Beatmup::AffineMapping & mapping