Set of key-value pairs.
More...
#include <listing.h>
|
| Block () |
|
| Block (const std::map< std::string, std::string > &mapping) |
|
void | printOut (std::ostream &stream) |
| Prints out the block to an output stream. More...
|
|
std::string | operator[] (const std::string &key) const |
| Retrieves a value by key. More...
|
|
bool | has (const std::string &key) const |
| Returns true if a value is defined for a specific key in the block. More...
|
|
template<typename T > |
T | get (const std::string &key) const |
| Returns a value by key casted to a given type. More...
|
|
template<typename T > |
T | get (const std::string &key, const T defaultValue) const |
| Returns a value by key casted to a given type. More...
|
|
template<typename T > |
void | set (const std::string &key, T value) |
| Sets a value for a specific key. More...
|
|
int | getLineNumber () const |
| Returns line number the block starts at. More...
|
|
template<> |
std::string | get (const std::string &key) const |
|
template<> |
void | set (const std::string &key, std::string value) |
|
template<> |
void | set (const std::string &key, float value) |
|
template<> |
void | set (const std::string &key, int value) |
|
Set of key-value pairs.
Definition at line 46 of file listing.h.
◆ Block() [1/3]
Beatmup::Listing::Block::Block |
( |
int |
lineNumber | ) |
|
|
inlineprotected |
◆ Block() [2/3]
Beatmup::Listing::Block::Block |
( |
| ) |
|
|
inline |
◆ Block() [3/3]
Beatmup::Listing::Block::Block |
( |
const std::map< std::string, std::string > & |
mapping | ) |
|
|
inline |
Definition at line 57 of file listing.h.
std::map< std::string, std::string > mapping
◆ printOut()
void Listing::Block::printOut |
( |
std::ostream & |
stream | ) |
|
Prints out the block to an output stream.
- Parameters
-
[in,out] | stream | The output stream |
Definition at line 152 of file listing.cpp.
155 str << (first ?
" - " :
" ") << it.first <<
": " << it.second << std::endl;
JNIEnv jobject jstring str
◆ operator[]()
std::string Listing::Block::operator[] |
( |
const std::string & |
key | ) |
const |
Retrieves a value by key.
If not found, an exception is thrown.
- Parameters
-
Definition at line 161 of file listing.cpp.
std::string to_string(Beatmup::NNets::ActivationFunction function)
◆ has()
bool Beatmup::Listing::Block::has |
( |
const std::string & |
key | ) |
const |
|
inline |
Returns true
if a value is defined for a specific key in the block.
- Parameters
-
Definition at line 76 of file listing.h.
◆ get() [1/3]
template<typename T >
T Beatmup::Listing::Block::get |
( |
const std::string & |
key | ) |
const |
|
inline |
Returns a value by key casted to a given type.
An exception is thrown if no value defined for the given key.
- Template Parameters
-
- Parameters
-
◆ get() [2/3]
template<typename T >
T Beatmup::Listing::Block::get |
( |
const std::string & |
key, |
|
|
const T |
defaultValue |
|
) |
| const |
|
inline |
Returns a value by key casted to a given type.
- Template Parameters
-
- Parameters
-
[in] | key | The key |
[in] | defaultValue | Default value returned if no value is defined for the key. |
Definition at line 94 of file listing.h.
95 return has(key) ? get<T>(key) : defaultValue;
bool has(const std::string &key) const
Returns true if a value is defined for a specific key in the block.
◆ set() [1/4]
template<typename T >
void Beatmup::Listing::Block::set |
( |
const std::string & |
key, |
|
|
T |
value |
|
) |
| |
Sets a value for a specific key.
- Template Parameters
-
- Parameters
-
[in] | key | The key |
[in] | value | The new value |
◆ getLineNumber()
int Beatmup::Listing::Block::getLineNumber |
( |
| ) |
const |
|
inline |
Returns line number the block starts at.
Definition at line 110 of file listing.h.
◆ get() [3/3]
bool Beatmup::Listing::Block::get |
( |
const std::string & |
key | ) |
const |
|
inline |
◆ set() [2/4]
template<>
void Beatmup::Listing::Block::set |
( |
const std::string & |
key, |
|
|
std::string |
value |
|
) |
| |
|
inline |
◆ set() [3/4]
template<>
void Beatmup::Listing::Block::set |
( |
const std::string & |
key, |
|
|
float |
value |
|
) |
| |
|
inline |
◆ set() [4/4]
template<>
void Beatmup::Listing::Block::set |
( |
const std::string & |
key, |
|
|
int |
value |
|
) |
| |
|
inline |
◆ Parser
◆ mapping
std::map<std::string, std::string> Beatmup::Listing::Block::mapping |
|
private |
◆ lineNumber
int Beatmup::Listing::Block::lineNumber |
|
private |
The documentation for this class was generated from the following files: