Classes | |
| class | MultiValue |
| class | InlineVector |
Typedefs | |
| typedef InlineVector < std::string > | Strings |
| typedef InlineVector < MultiValue > | Args |
Functions | |
| std::string _NaviExport | getCurrentWorkingDirectory () |
| std::string _NaviExport | htmlToDataURI (std::string htmlString) |
| std::string _NaviExport | resourceToDataURI (const std::string &resFileName, const std::string &resourceGroupName=Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) |
| void _NaviExport | translateLocalProtocols (std::string &strToTranslate) |
| void _NaviExport | translateResourceProtocols (std::string &strToTranslate) |
| std::string _NaviExport | encodeURIComponent (std::wstring strToEncode) |
| std::wstring _NaviExport | decodeURIComponent (std::string strToDecode) |
| std::string _NaviExport | lowerString (std::string strToLower) |
| bool _NaviExport | isPrefixed (const std::string &sourceString, const std::string &prefix, bool ignoreCase=true) |
| bool _NaviExport | isNumeric (const std::string &numberString) |
| template<class NumberType> | |
| std::string _NaviExport | numberToString (const NumberType &number) |
| template<class NumberType> | |
| NumberType _NaviExport | toNumber (const std::string &numberString) |
| std::wstring _NaviExport | toWide (const std::string &stringToConvert) |
| std::string _NaviExport | toMultibyte (const std::wstring &wstringToConvert) |
| void _NaviExport | setLocale (const std::string &localeLanguage="") |
| int _NaviExport | replaceAll (std::string &sourceStr, const std::string &replaceWhat, const std::string &replaceWith) |
| std::vector < std::string > _NaviExport | split (const std::string &sourceStr, const std::string &delimiter, bool ignoreEmpty=true) |
| std::map < std::string, std::string > _NaviExport | splitToMap (const std::string &sourceStr, const std::string &pairDelimiter, const std::string &keyValueDelimiter, bool ignoreEmpty=true) |
| std::string _NaviExport | join (const std::vector< std::string > &sourceVector, const std::string &delimiter, bool ignoreEmpty=true) |
| std::string _NaviExport | joinFromMap (const std::map< std::string, std::string > &sourceMap, const std::string &pairDelimiter, const std::string &keyValueDelimiter, bool ignoreEmpty=true) |
| std::string _NaviExport | templateString (const std::string &templateStr, const Args &args) |
| void _NaviExport | logTemplate (const std::string &templateStr, const Args &args) |
| bool _NaviExport | hexStringToRGB (const std::string &hexString, unsigned char &R, unsigned char &G, unsigned char &B) |
| std::string _NaviExport | encodeBase64 (const std::string &strToEncode) |
| template<class NumberType> | |
| void _NaviExport | limit (NumberType &input, NumberType min, NumberType max) |
This is a simple way to quickly make inline MultiValue vectors.
Syntax is:
Args(x)(x)(x)(x)...
// Before: vector<MultiValue> myArgs; myArgs.push_back("SandyBob"); myArgs.push_back(naviData["class"]); myArgs.push_back(1337); myNavi->evaluateJS("displayInfo(?, ?, ?)", myArgs); // After: myNavi->evaluateJS("displayInfo(?, ?, ?)", Args("SandyBob")(navidata["class"])(1337));
| typedef InlineVector<std::string> NaviLibrary::NaviUtilities::Strings |
This is just a simple way to quickly make inline string vectors.
Syntax is: Strings(x)(x)(x)(x)...
// Before: vector<string> myVector; myVector.push_back("hello"); myVector.push_back("awesome"); myVector.push_back("world"); someFunction(myVector); // After: someFunction(Strings("hello")("awesome")("world"));
| std::wstring NaviLibrary::NaviUtilities::decodeURIComponent | ( | std::string | strToDecode | ) |
This is a C++ mirror implementation that I wrote for the Javascript function 'decodeURIComponent'. For more info: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:decodeURIComponent
| strToDecode | The standard string to decode. Should be previously encoded by 'encodeURIComponent'. |
| std::string NaviLibrary::NaviUtilities::encodeBase64 | ( | const std::string & | strToEncode | ) |
Encodes a string into Base64.
| strToEncode | The string to encode. |
| std::string NaviLibrary::NaviUtilities::encodeURIComponent | ( | std::wstring | strToEncode | ) |
This is a C++ mirror implementation that I wrote for the Javascript function 'encodeURIComponent'. For more info: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:encodeURIComponent
| strToEncode | The wide string to encode. You may use toWide() to convert a standard string to wide. |
| std::string NaviLibrary::NaviUtilities::getCurrentWorkingDirectory | ( | ) |
Gets the current working directory for the executable.
| bool NaviLibrary::NaviUtilities::hexStringToRGB | ( | const std::string & | hexString, | |
| unsigned char & | R, | |||
| unsigned char & | G, | |||
| unsigned char & | B | |||
| ) |
Converts a Hex Color String to R, G, B values.
| hexString | A hex color string in format: "#XXXXXX" | |
| [out] | R | The unsigned char to store the Red value in. |
| [out] | G | The unsigned char to store the Green value in. |
| [out] | B | The unsigned char to store the Blue value in. |
| std::string NaviLibrary::NaviUtilities::htmlToDataURI | ( | std::string | htmlString | ) |
Converts a String containing HTML into an equivalent Data URI, replaces all 'local://' and 'resource://group/filename' instances with their correct equivalent.
| htmlString | The string containing the HTML to convert. |
| bool NaviLibrary::NaviUtilities::isNumeric | ( | const std::string & | numberString | ) |
Checks whether or not a string is 'numeric' in nature (begins with actual, parseable digits).
| numberString | The string to check. |
| bool _NaviExport NaviLibrary::NaviUtilities::isPrefixed | ( | const std::string & | sourceString, | |
| const std::string & | prefix, | |||
| bool | ignoreCase = true | |||
| ) | [inline] |
Checks whether or not a string is prefixed with a certain prefix.
| sourceString | The string to check. | |
| prefix | The prefix to search for. | |
| ignoreCase | Whether or not to ignore differences in case, default is true. |
| std::string NaviLibrary::NaviUtilities::join | ( | const std::vector< std::string > & | sourceVector, | |
| const std::string & | delimiter, | |||
| bool | ignoreEmpty = true | |||
| ) |
Joins a string vector into a single string. (Effectively does the inverse of NaviUtilities::split)
| sourceVector | The string vector to join. | |
| delimiter | What to delimit each token by. | |
| ignoreEmpty | Whether or not to ignore empty strings within the string vector. |
| std::string NaviLibrary::NaviUtilities::joinFromMap | ( | const std::map< std::string, std::string > & | sourceMap, | |
| const std::string & | pairDelimiter, | |||
| const std::string & | keyValueDelimiter, | |||
| bool | ignoreEmpty = true | |||
| ) |
Joins a string map into a single string. (Effectively does the inverse of NaviUtilities::splitToMap)
| sourceMap | The string map to join. | |
| pairDelimiter | What to delimit each pair by. | |
| keyValueDelimiter | What to delimit each key-value by. | |
| ignoreEmpty | Whether or not to ignore empty string values within the string map. |
| void _NaviExport NaviLibrary::NaviUtilities::limit | ( | NumberType & | input, | |
| NumberType | min, | |||
| NumberType | max | |||
| ) | [inline] |
Ensures that a number (input) is within certain limits.
| input | The number that will be limited. | |
| min | The minimum limit. | |
| max | The maximum limit. |
| void NaviLibrary::NaviUtilities::logTemplate | ( | const std::string & | templateStr, | |
| const Args & | args | |||
| ) |
A super-easy way to log messages to the Ogre LogManager. For example, instead of:
LogManager::GetSingleton().logMessage(templateString("a: ?, b: ?"), Args(a)(b)));
logTemplate("a: ?, b: ?", Args(a)(b));
| std::string NaviLibrary::NaviUtilities::lowerString | ( | std::string | strToLower | ) |
Converts a string into its lower-case equivalent.
| strToLower | The standard string to convert to lower-case. |
| std::string _NaviExport NaviLibrary::NaviUtilities::numberToString | ( | const NumberType & | number | ) | [inline] |
Converts a Number (int, float, double, bool, etc.) to a String.
| number | The number (usually of type int, float, double, bool, etc.) to convert to a String. |
| int NaviLibrary::NaviUtilities::replaceAll | ( | std::string & | sourceStr, | |
| const std::string & | replaceWhat, | |||
| const std::string & | replaceWith | |||
| ) |
Replaces all instances of 'replaceWhat' with 'replaceWith' inside a source string.
| sourceStr | The string to do this to. | |
| replaceWhat | What to be replaced. | |
| replaceWith | All occurrences of 'replaceWhat' will be replaced with this. |
| std::string NaviLibrary::NaviUtilities::resourceToDataURI | ( | const std::string & | resFileName, | |
| const std::string & | resourceGroupName = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME | |||
| ) |
Converts an Ogre Resource into an equivalent Data URI. Additional 'local://' and 'resource://' specifier translation will occur on the following filetypes: '.html, .htm, .shtml, .php, .asp, .xhtml, .xml, .js, .cgi, .css'
| resFileName | The filename of the Ogre Resource | |
| resourceGroupName | The name of the Ogre Resource Group to search in. |
| void NaviLibrary::NaviUtilities::setLocale | ( | const std::string & | localeLanguage = "" |
) |
Sets the current locale, used for 'toMultibyte()'. If you never call this, the default is usually "English".
| localeLanguage | The name of the locale language to set. An empty string sets this to the current locale of the OS. |
| std::vector< std::string > NaviLibrary::NaviUtilities::split | ( | const std::string & | sourceStr, | |
| const std::string & | delimiter, | |||
| bool | ignoreEmpty = true | |||
| ) |
Splits a string up into a series of tokens (contained within a string vector), delimited by a certain string.
| sourceStr | The string to split up. | |
| delimiter | What to delimit the source string by. | |
| ignoreEmpty | Whether or not to ignore empty tokens. (usually created by 2 or more immediately adjacent delimiters) |
| std::map< std::string, std::string > NaviLibrary::NaviUtilities::splitToMap | ( | const std::string & | sourceStr, | |
| const std::string & | pairDelimiter, | |||
| const std::string & | keyValueDelimiter, | |||
| bool | ignoreEmpty = true | |||
| ) |
A more advanced form of splitting, parses a string into a string map. Exceptionally useful for use with Query Strings.
| sourceStr | The string to parse. | |
| pairDelimiter | What to delimit pairs by. | |
| keyValueDelimiter | What to delimit key-values by. | |
| ignoreEmpty | Whether or not to ignore empty values. Empty pairs will always be ignored. |
std::string myQueryString = "name=Bob&sex=none&color=purple"; std::map<std::string,std::string> myMap = splitToMap(myQueryString, "&", "="); std::string myColor = myMap["color"]; // myColor is now 'purple'
| std::string NaviLibrary::NaviUtilities::templateString | ( | const std::string & | templateStr, | |
| const Args & | args | |||
| ) |
Translates a template string and some arguments into a full string.
| templateStr | A string containing the base template, the '?' character will be replaced with string representations of the passed arguments. | |
| args | The arguments that will be used to fill in the template. |
std::string myString = templateString("name: ?, strength: ?, color: ?", Args("ValhallaSword")(999)("Red")); // myString is now = "name: ValhallaSword, strength: 999, color: Red";
| std::string NaviLibrary::NaviUtilities::toMultibyte | ( | const std::wstring & | wstringToConvert | ) |
Converts a wide string to a multibyte string (standard string), based on the current locale.
| wstringToConvert | The wide string to convert. |
| NumberType _NaviExport NaviLibrary::NaviUtilities::toNumber | ( | const std::string & | numberString | ) | [inline] |
Converts a String to a Number.
| <NumberType> | The NumberType (int, float, bool, double, etc.) to convert to. | |
| numberString | A string containing a valid numeric sequence (can check using isNumeric()). |
| std::wstring NaviLibrary::NaviUtilities::toWide | ( | const std::string & | stringToConvert | ) |
Converts a multibyte string (standard string) to a wide string.
| stringToConvert | The multibyte (standard) string to convert. |
| void NaviLibrary::NaviUtilities::translateLocalProtocols | ( | std::string & | strToTranslate | ) |
Replaces all 'local://' instances within a String with the correct NaviLocal directory.
local://filename.html --> file:///C:\My Application\NaviLocal\filename.html
The NaviManager singleton must be instantiated prior to calling this utility function.
| strToTranslate | The string to translate. |
| void NaviLibrary::NaviUtilities::translateResourceProtocols | ( | std::string & | strToTranslate | ) |
Replaces all '"resource://Group/Filename.ext"' with an equivalent Data URI of the Ogre Resource. Syntax of '"resource://Filename.ext"' assumes the Resource Group is DEFAULT_RESOURCE_GROUP_NAME. If the Ogre Resource is not found, the 'resource://' specifier instance is skipped. Please note that this statement is required to be encased within double-quotes to be valid. Certain filetypes will be additionally parsed for local/resource specifiers and translated accordingly.
| strToTranslate | The string to translate. |
1.5.3