Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
Field< T > Class Template Reference

The Field Object for the Config. More...

#include <config.h>

Public Member Functions

 Field (const char *section, const char *key, T def)
 Construct a new Field object.
 
 ~Field ()
 Destroy the Field object.
 
void load (const rapidjson::Document &document)
 Loads the value from the config.
 
void save (rapidjson::Document &document)
 Saves value to the config.
 
const TgetValue ()
 Get the Value of the field.
 
void setValue (T v)
 Set the Value of the field.
 
void registerLuaProperty (lua_State *state)
 Register this property in Lua.
 

Public Attributes

std::string section
 Section of the field.
 
std::string key
 Key of the field.
 

Detailed Description

template<typename T>
class Field< T >

The Field Object for the Config.

The field object should only be used internally, as it is only used in Config for parsing / writing values to the config file.

Template Parameters
Tthe value type of the field

Constructor & Destructor Documentation

◆ Field()

template<typename T >
Field< T >::Field ( const char * section,
const char * key,
T def )

Construct a new Field object.

Should only be used internally, constructs a new object that will be used in the Config for parsing / writing values to the config file.

Parameters
sectionThe section of the field
keyThe key / name of the field
defIts default value

Member Function Documentation

◆ getValue()

template<typename T >
const T & Field< T >::getValue ( )
inline

Get the Value of the field.

Returns
const T& the type of the field

◆ load()

template<typename T >
void Field< T >::load ( const rapidjson::Document & document)

Loads the value from the config.

Loads from the json document the value, parsing it.

Parameters
documentThe Json document

◆ registerLuaProperty()

template<typename T >
void Field< T >::registerLuaProperty ( lua_State * state)

Register this property in Lua.

Parameters
statethe lua state

◆ save()

template<typename T >
void Field< T >::save ( rapidjson::Document & document)

Saves value to the config.

Saves value to the json document.

Parameters
documentThe Json document

◆ setValue()

template<typename T >
void Field< T >::setValue ( T v)
inline

Set the Value of the field.

Parameters
vthe new value

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