[SP] ConfigMap: StringMap & SMCParser
presenting ConfigMap which is a StringMap Tree very much similar to KeyValues.
Difference is that it only works with strings as values and stringmaps as sections. API: Code:
ConfigMap(const char[] filename); assume this config: Code:
"root" { to access the value "hi", use the key path string: "root.section1.value1" to access the value "bonjour", use the key path string: "root.section2.subsection1.value1" to reduce having to use these key path strings all the time on frequently used subsections, use `GetSection` to save the ConfigMap of a subsection, there is no need to free the instance to the subsection. Download Link Tutorial on how to use it. Features: Iterating key-values by number. Retrieving keys in a performant manner. Partial string interpolation. Math parsing with custom variables. |
Re: [SP] ConfigMap: StringMap & SMCParser
Is there any way to include ConfigMap to Voice Changer? I just don't want to use KeyValues loop every time NormalSoundHook is called.
|
Re: [SP] ConfigMap: StringMap & SMCParser
Quote:
Code:
static char download_keys[][] = { |
Re: [SP] ConfigMap: StringMap & SMCParser
I've updated the OP with the latest code and even converted the library into an include file.
I've also provided a tutorial link on all the capabilities of ConfigMap and how to use it. |
Re: [SP] ConfigMap: StringMap & SMCParser
You can put __nullable__ into methodmap definition like
Code:
methodmap ConfigMap < StringMap __nullable__ { ConfigMap hCfg = new ConfigMap(); EDIT: Nevermind, it seems that Handle-typed methodmaps can use new keyword without __nullable__. PLS add GetBool method (at least as wrapper around GetInt) |
Re: [SP] ConfigMap: StringMap & SMCParser
Quote:
|
Re: [SP] ConfigMap: StringMap & SMCParser
I have this stock:
Code:
#define _BOOL(%1) view_as< bool >( %1 ) |
Re: [SP] ConfigMap: StringMap & SMCParser
Quote:
Another thing is that your method just checks if the word is "true" or something synonymous and returns false otherwise, which means someone could just put "peanut butter" as a value and trying to make that as a bool would return a value of false lol. Treating a string value as a bool would require the value of the key to actually represent something that makes sense as a boolean value as opposed to having specific words being able to be treated as a boolean value while everything else is just assumed boolean false. |
Re: [SP] ConfigMap: StringMap & SMCParser
That's just a stock which returns true (only if string treated as true) or false (in any other case), you don't have to use it. It was just an example of simple/advanced conversion.
|
Re: [SP] ConfigMap: StringMap & SMCParser
Quote:
Code:
public int GetBool(const char[] key_path, bool& b, bool simple=true) { |
All times are GMT -4. The time now is 19:08. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.