iFun Engine API  1.0.0-b2821
Great Technology for Great Games
 All Classes Files Functions Variables Typedefs Macros
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,
OverrideHistory
Container
 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

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.
const Json& fun::ArgumentMap::FindArgument ( const string &  key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in json type.
const OverrideHistory& fun::ArgumentMap::FindArgumentOverrideHistory ( const string &  key) const
Parameters
keykey of the argument to retrieve.
Returns
argument override history.
const Json& fun::ArgumentMap::FindArrayArgument ( const string &  key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in json array type.
bool fun::ArgumentMap::FindBooleanArgument ( const string &  key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in boolean type.
double fun::ArgumentMap::FindDoubleArgument ( const string &  key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in double type.
int64_t fun::ArgumentMap::FindIntegerArgument ( const string &  key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in integer type.
const Json& fun::ArgumentMap::FindObjectArgument ( const string &  key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in json object type.
string fun::ArgumentMap::FindStringArgument ( const string &  key) const
Parameters
keykey of the argument to retrieve.
Returns
argument value in string type.
const Container& fun::ArgumentMap::GetArgumentsAll ( ) const
Returns
whole argument map.
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.
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.