My Project
|
replacing some known variables in string path. More...
#include <FilePath.h>
Public Member Functions | |
void | DecodePath (std::string &output, const std::string &input) |
replace variables in input path and return the result path. More... | |
void | EncodePath (std::string &output, const std::string &input) |
this does reverse of DecodePath. More... | |
void | EncodePath (std::string &output, const std::string &input, const std::string &varNames) |
same as EncodePath, except that it will only replace variables who name appears in varNames. More... | |
bool | AddVariable (const CPathVariable &variable, bool bCheckCanEdit=true) |
add a new variable to the replaceable pool More... | |
CPathVariable * | GetVariable (const char *sVarName) |
get an variable object by its name if it exist. More... | |
bool | RemoveVariable (const char *sVarName, bool bCheckCanEdit) |
return a variable by its name. More... | |
bool | Clear () |
clear all variables. More... | |
Static Public Member Functions | |
static CPathReplaceables & | GetSingleton () |
replacing some known variables in string path.
This is usually used as a singleton. e.g. ROOT% maps to game engine root dir, and W% maps to the current world directory, USERID% maps to user id. for security reasons, most replaceables are not editable or overridable via scripting interface.
bool CPathReplaceables::AddVariable | ( | const CPathVariable & | variable, |
bool | bCheckCanEdit = true |
||
) |
add a new variable to the replaceable pool
variable | the variable to add. |
bCheckCanEdit | default to true. if true, the function will fail if the pool already contain a variable with the same name but it not editable |
bool CPathReplaceables::Clear | ( | void | ) |
clear all variables.
void CPathReplaceables::DecodePath | ( | std::string & | output, |
const std::string & | input | ||
) |
replace variables in input path and return the result path.
output | the output string, can be same as input string. |
input | a path with or without replaceable. make sure you have called ToCanonicalFilePath() to canonicalize the input before calling this function |
void ParaEngine::CPathReplaceables::EncodePath | ( | std::string & | output, |
const std::string & | input | ||
) |
this does reverse of DecodePath.
output | the output string, can be same as input string. |
input | a path with or without replaceable. make sure you have called ToCanonicalFilePath() to canonicalize the input before calling this function |
void ParaEngine::CPathReplaceables::EncodePath | ( | std::string & | output, |
const std::string & | input, | ||
const std::string & | varNames | ||
) |
same as EncodePath, except that it will only replace variables who name appears in varNames.
varNames is a comma separated list of variable names.
output | the output string, can be same as input string. |
varNames | a comma separated list of variable names. like "WORLD,USERID", etc. |
CPathVariable * CPathReplaceables::GetVariable | ( | const char * | sVarName | ) |
get an variable object by its name if it exist.
it will return NULL if not exist
bool CPathReplaceables::RemoveVariable | ( | const char * | sVarName, |
bool | bCheckCanEdit | ||
) |
return a variable by its name.
sVarName | variable name to remove. |
bCheckCanEdit | default to true. if true, the function will fail if the pool already contain a variable with the same name but it not editable |