Case insensitive version of StringMap
A wrapper over original SourceMod StringMap allowing to compare keys as case insensitive.
It's done temporarily until the appropriate Issue#1716 in SM Core not fulfilled.
#include <stringmapi>
Just replace all "StringMap" with "StringMapI". StringMapI inherits StringMap methodmap, so it supports same functions.
Usage example:
#include <sourcemod>
#include <stringmapi>
#pragma semicolon 1
#pragma newdecls required
public Plugin myinfo =
{
name = "StringMapI use test",
author = "Dragokas",
description = "Case insensitive StringMap",
version = "1.0",
url = "http://www.sourcemod.net/"
};
public void OnPluginStart()
{
RegConsoleCmd("sm_smi", CmdTest);
}
public Action CmdTest(int client, int args)
{
StringMapI map = new StringMapI();
map.SetString("UserName", "Alex");
map.SetValue("SCORE", 100);
int score;
map.GetValue("score", score);
char name[32];
map.GetString("USERNAME", name, sizeof(name)); // OK
// test case insensitive
PrintToServer("MethodMapI 'USERNAME' value: %s", name);
PrintToServer("MethodMapI 'score' value: %i", score);
// test inherited members
PrintToServer("MethodMapI size: %i", map.Size);
return Plugin_Handled;
}
Case sensitivity is only applicable for latin characters. Atm, there is no support for Russian and other non-English specific characters.