supertux
Public Member Functions | Static Public Attributes | List of all members
ReaderMapping Class Referencefinal

Public Member Functions

 ReaderMapping (const ReaderDocument &doc, const sexp::Value &sx)
 
ReaderIterator get_iter () const
 
bool get (const char *key, bool &value, const std::optional< bool > &default_value=std::nullopt) const
 
bool get (const char *key, int &value, const std::optional< int > &default_value=std::nullopt) const
 
bool get (const char *key, uint32_t &value, const std::optional< uint32_t > &default_value=std::nullopt) const
 
bool get (const char *key, float &value, const std::optional< float > &default_value=std::nullopt) const
 
bool get (const char *key, std::string &value, const std::optional< const char *> &default_value=std::nullopt) const
 
bool get (const char *key, std::vector< bool > &value, const std::optional< std::vector< bool >> &default_value=std::nullopt) const
 
bool get (const char *key, std::vector< int > &value, const std::optional< std::vector< int >> &default_value=std::nullopt) const
 
bool get (const char *key, std::vector< float > &value, const std::optional< std::vector< float >> &default_value=std::nullopt) const
 
bool get (const char *key, std::vector< std::string > &value, const std::optional< std::vector< std::string >> &default_value=std::nullopt) const
 
bool get (const char *key, std::vector< unsigned int > &value, const std::optional< std::vector< unsigned int >> &default_value=std::nullopt) const
 
bool get (const char *key, std::optional< ReaderMapping > &) const
 
bool get (const char *key, std::optional< ReaderCollection > &) const
 
bool get (const char *key, sexp::Value &value) const
 
template<typename C , typename F >
bool get_custom (const char *key, C &value, F from_string, std::optional< decltype(C())> default_value=std::nullopt) const
 Read a custom data format, such an as enum. More...
 
const sexp::Value & get_sexp () const
 
const ReaderDocumentget_doc () const
 

Static Public Attributes

static bool s_translations_enabled = true
 

Member Function Documentation

◆ get_custom()

template<typename C , typename F >
bool ReaderMapping::get_custom ( const char *  key,
C &  value,
from_string,
std::optional< decltype(C())>  default_value = std::nullopt 
) const
inline

Read a custom data format, such an as enum.

The data is stored as string and converted to the custom type using the supplied from_string convert function. Example:

mapping.get_custom("style", value, Style_from_string, Style::DEFAULT);


The documentation for this class was generated from the following files: