iFun Engine API  1.0.0-b6053
Great Technology for Great Games
Public Types | Public Member Functions | Static Public Member Functions | List of all members
fun::ArgumentMap Class Reference

ArgumentMap class manages application-specific run-time arguments. More...

#include <argument_map.h>

Public Types

typedef std::map< string, OverrideHistoryContainer
 Internal implementation of ArgumentMap class.
 
typedef std::vector< JsonOverrideHistory
 Internal implementation of argument's override history.
 

Public Member Functions

bool AddArgument (const string &key, const Json &value)
 Adds an argument. More...
 
const JsonFindArgument (const string &key) const
 Retrieves an argument value in json type for the given argument key. More...
 
const OverrideHistoryFindArgumentOverrideHistory (const string &key) const
 Retrieves an argument override history for the given argument key. More...
 
const JsonFindArrayArgument (const string &key) const
 Retrieves an argument value in json array type for the given argument key. More...
 
bool FindBooleanArgument (const string &key) const
 Retrieves an argument value in boolean type for the given argument key. More...
 
double FindDoubleArgument (const string &key) const
 Retrieves an argument value in double type for the given argument key. More...
 
int64_t FindIntegerArgument (const string &key) const
 Retrieves an argument value in integer type for the given argument key. More...
 
const JsonFindObjectArgument (const string &key) const
 Retrieves an argument value in json object type for the given argument key. More...
 
string FindStringArgument (const string &key) const
 Retrieves an argument value in string type for the given argument key. More...
 
const ContainerGetArgumentsAll () const
 Retrieves whole argument map. More...
 
bool OverrideArgument (const string &key, const Json &value)
 Overrides argument with the given value if the argument exists, inserts argument otherwise. More...
 

Static Public Member Functions

static bool IsValidArgumentType (const Json::Type &value_type)
 

Detailed Description

Argument is composed of a string key and a string value.

Member Function Documentation

◆ AddArgument()

bool fun::ArgumentMap::AddArgument ( const string key,
const Json value 
)
Parameters
keyname of the target argument.
valuevalue of the target argument in json format. the value type should be one of string, integer or boolean type.
Returns
true if the target argument is added successfully, otherwise false.

◆ FindArgument()

const Json& fun::ArgumentMap::FindArgument ( const string key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in json type.

◆ FindArgumentOverrideHistory()

const OverrideHistory& fun::ArgumentMap::FindArgumentOverrideHistory ( const string key) const
Parameters
keykey of the argument to retrieve.
Returns
argument override history.

◆ FindArrayArgument()

const Json& fun::ArgumentMap::FindArrayArgument ( const string key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in json array type.

◆ FindBooleanArgument()

bool fun::ArgumentMap::FindBooleanArgument ( const string key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in boolean type.

◆ FindDoubleArgument()

double fun::ArgumentMap::FindDoubleArgument ( const string key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in double type.

◆ FindIntegerArgument()

int64_t fun::ArgumentMap::FindIntegerArgument ( const string key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in integer type.

◆ FindObjectArgument()

const Json& fun::ArgumentMap::FindObjectArgument ( const string key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in json object type.

◆ FindStringArgument()

string fun::ArgumentMap::FindStringArgument ( const string key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in string type.

◆ GetArgumentsAll()

const Container& fun::ArgumentMap::GetArgumentsAll ( ) const
Returns
whole argument map.

◆ IsValidArgumentType()

static bool fun::ArgumentMap::IsValidArgumentType ( const Json::Type &  value_type)
static
Returns
true if the given type is valid for arguments in manifest files, false otherwise.

◆ OverrideArgument()

bool fun::ArgumentMap::OverrideArgument ( const string key,
const Json value 
)
Parameters
keyname of the target argument.
valuevalue of the target argument in json format. the value type should be one of string, integer or boolean type.
Returns
true if the target argument is overridden successfully, otherwise false.