本文整理汇总了C++中NoCaseCompare函数的典型用法代码示例。如果您正苦于以下问题:C++ NoCaseCompare函数的具体用法?C++ NoCaseCompare怎么用?C++ NoCaseCompare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NoCaseCompare函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cNoise3DGenerator
bool cChunkGenerator::Start(cWorld * a_World, cIniFile & a_IniFile)
{
MTRand rnd;
m_World = a_World;
m_Seed = a_IniFile.GetValueSetI("Seed", "Seed", rnd.randInt());
AString GeneratorName = a_IniFile.GetValueSet("Generator", "Generator", "Composable");
if (NoCaseCompare(GeneratorName, "Noise3D") == 0)
{
m_Generator = new cNoise3DGenerator(*this);
}
else
{
if (NoCaseCompare(GeneratorName, "composable") != 0)
{
LOGWARN("[Generator]::Generator value \"%s\" not recognized, using \"Composable\".", GeneratorName.c_str());
}
m_Generator = new cComposableGenerator(*this);
}
if (m_Generator == NULL)
{
LOGERROR("Generator could not start, aborting the server");
return false;
}
m_Generator->Initialize(a_World, a_IniFile);
return super::Start();
}
示例2: cWSSAnvil
void cWorldStorage::InitSchemas(int a_StorageCompressionFactor)
{
// The first schema added is considered the default
m_Schemas.push_back(new cWSSAnvil (m_World,a_StorageCompressionFactor));
m_Schemas.push_back(new cWSSCompact (m_World,a_StorageCompressionFactor));
m_Schemas.push_back(new cWSSForgetful(m_World));
// Add new schemas here
if (NoCaseCompare(m_StorageSchemaName, "default") == 0)
{
m_SaveSchema = m_Schemas.front();
return;
}
for (cWSSchemaList::iterator itr = m_Schemas.begin(); itr != m_Schemas.end(); ++itr)
{
if (NoCaseCompare((*itr)->GetName(), m_StorageSchemaName) == 0)
{
m_SaveSchema = *itr;
return;
}
} // for itr - m_Schemas[]
// Unknown schema selected, let the admin know:
LOGWARNING("Unknown storage schema name \"%s\". Using default (\"%s\"). Available schemas:",
m_StorageSchemaName.c_str(), m_SaveSchema->GetName().c_str()
);
for (cWSSchemaList::iterator itr = m_Schemas.begin(); itr != m_Schemas.end(); ++itr)
{
LOGWARNING("\t\"%s\"", (*itr)->GetName().c_str());
}
m_SaveSchema = m_Schemas.front();
}
示例3: StringToDimension
void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
{
int Seed = m_ChunkGenerator.GetSeed();
eDimension Dimension = StringToDimension(a_IniFile.GetValue("General", "Dimension", "Overworld"));
AString Finishers = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator");
AStringVector Str = StringSplitAndTrim(Finishers, ",");
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
{
// Finishers, alpha-sorted:
if (NoCaseCompare(*itr, "BottomLava") == 0)
{
int DefaultBottomLavaLevel = (Dimension == dimNether) ? 30 : 10;
int BottomLavaLevel = a_IniFile.GetValueSetI("Generator", "BottomLavaLevel", DefaultBottomLavaLevel);
m_FinishGens.push_back(new cFinishGenBottomLava(BottomLavaLevel));
}
else if (NoCaseCompare(*itr, "DeadBushes") == 0)
{
m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_DEAD_BUSH, biDesert, 2, E_BLOCK_SAND, E_BLOCK_SAND));
}
else if (NoCaseCompare(*itr, "Ice") == 0)
{
m_FinishGens.push_back(new cFinishGenIce);
}
else if (NoCaseCompare(*itr, "LavaSprings") == 0)
{
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_LAVA, a_IniFile, Dimension));
}
else if (NoCaseCompare(*itr, "Lilypads") == 0)
{
m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_LILY_PAD, biSwampland, 4, E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER));
}
else if (NoCaseCompare(*itr, "NetherClumpFoliage") == 0)
{
m_FinishGens.push_back(new cFinishGenNetherClumpFoliage(Seed));
}
else if (NoCaseCompare(*itr, "PreSimulator") == 0)
{
m_FinishGens.push_back(new cFinishGenPreSimulator);
}
else if (NoCaseCompare(*itr, "Snow") == 0)
{
m_FinishGens.push_back(new cFinishGenSnow);
}
else if (NoCaseCompare(*itr, "SprinkleFoliage") == 0)
{
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed));
}
else if (NoCaseCompare(*itr, "WaterSprings") == 0)
{
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, Dimension));
}
} // for itr - Str[]
}
示例4: StringToType
cObjective::eType cObjective::StringToType(const AString & a_Name)
{
static struct
{
eType m_Type;
const char * m_String;
} TypeMap [] =
{
{otDummy, "dummy" },
{otDeathCount, "deathCount" },
{otPlayerKillCount, "playerKillCount" },
{otTotalKillCount, "totalKillCount" },
{otHealth, "health" },
{otAchievement, "achievement" },
{otStat, "stat" },
{otStatItemCraft, "stat.craftItem" },
{otStatItemUse, "stat.useItem" },
{otStatItemBreak, "stat.breakItem" },
{otStatBlockMine, "stat.mineBlock" },
{otStatEntityKill, "stat.killEntity" },
{otStatEntityKilledBy, "stat.entityKilledBy"}
};
for (size_t i = 0; i < ARRAYCOUNT(TypeMap); i++)
{
if (NoCaseCompare(TypeMap[i].m_String, a_Name) == 0)
{
return TypeMap[i].m_Type;
}
} // for i - TypeMap[]
return otDummy;
}
示例5: StringToBiome
EMCSBiome StringToBiome(const AString & a_BiomeString)
{
// If it is a number, return it:
int res = atoi(a_BiomeString.c_str());
if ((res != 0) || (a_BiomeString.compare("0") == 0))
{
if ((res >= biFirstBiome) && (res < biNumBiomes))
{
return (EMCSBiome)res;
}
else if ((res >= biFirstVariantBiome) && (res < biNumVariantBiomes))
{
return (EMCSBiome)res;
}
// It was an invalid number
return biInvalidBiome;
}
for (size_t i = 0; i < ARRAYCOUNT(g_BiomeMap); i++)
{
if (NoCaseCompare(g_BiomeMap[i].m_String, a_BiomeString) == 0)
{
return g_BiomeMap[i].m_Biome;
}
} // for i - BiomeMap[]
return biInvalidBiome;
}
示例6: CreateVerticalStrategyFromString
cPiece::cVerticalStrategyPtr CreateVerticalStrategyFromString(const AString & a_StrategyDesc, bool a_LogWarnings)
{
// Break apart the strategy class, the first parameter before the first pipe char:
auto idxPipe = a_StrategyDesc.find('|');
if (idxPipe == AString::npos)
{
idxPipe = a_StrategyDesc.length();
}
AString StrategyClass = a_StrategyDesc.substr(0, idxPipe);
// Create a strategy class based on the class string:
cPiece::cVerticalStrategyPtr Strategy;
if (NoCaseCompare(StrategyClass, "Fixed") == 0)
{
Strategy = std::make_shared<cVerticalStrategyFixed>();
}
else if (NoCaseCompare(StrategyClass, "Range") == 0)
{
Strategy = std::make_shared<cVerticalStrategyRange>();
}
else if (NoCaseCompare(StrategyClass, "TerrainTop") == 0)
{
Strategy = std::make_shared<cVerticalStrategyTerrainTop>();
}
else if (NoCaseCompare(StrategyClass, "TerrainOrOceanTop") == 0)
{
Strategy = std::make_shared<cVerticalStrategyTerrainOrOceanTop>();
}
else
{
return nullptr;
}
// Initialize the strategy's parameters:
AString Params;
if (idxPipe < a_StrategyDesc.length())
{
Params = a_StrategyDesc.substr(idxPipe + 1);
}
if (!Strategy->InitializeFromString(Params, a_LogWarnings))
{
return nullptr;
}
return Strategy;
}
示例7: LOGINFO
bool cChunkGenerator::Start(cPluginInterface & a_PluginInterface, cChunkSink & a_ChunkSink, cIniFile & a_IniFile)
{
m_PluginInterface = &a_PluginInterface;
m_ChunkSink = &a_ChunkSink;
// Get the seed; create a new one and log it if not found in the INI file:
if (a_IniFile.HasValue("Seed", "Seed"))
{
m_Seed = a_IniFile.GetValueI("Seed", "Seed");
}
else
{
MTRand rnd;
m_Seed = rnd.randInt();
LOGINFO("Chosen a new random seed for world: %d", m_Seed);
a_IniFile.SetValueI("Seed", "Seed", m_Seed);
}
// Get the generator engine based on the INI file settings:
AString GeneratorName = a_IniFile.GetValueSet("Generator", "Generator", "Composable");
if (NoCaseCompare(GeneratorName, "Noise3D") == 0)
{
m_Generator = new cNoise3DGenerator(*this);
}
else
{
if (NoCaseCompare(GeneratorName, "composable") != 0)
{
LOGWARN("[Generator]::Generator value \"%s\" not recognized, using \"Composable\".", GeneratorName.c_str());
}
m_Generator = new cComposableGenerator(*this);
}
if (m_Generator == nullptr)
{
LOGERROR("Generator could not start, aborting the server");
return false;
}
m_Generator->Initialize(a_IniFile);
return super::Start();
}
示例8: StringToBiome
EMCSBiome StringToBiome(const AString & a_BiomeString)
{
// If it is a number, return it:
int res = atoi(a_BiomeString.c_str());
if ((res != 0) || (a_BiomeString.compare("0") == 0))
{
// It was a valid number
return (EMCSBiome)res;
}
// Convert using the built-in map:
static struct {
EMCSBiome m_Biome;
const char * m_String;
} BiomeMap[] =
{
{biOcean, "Ocean"} ,
{biPlains, "Plains"},
{biDesert, "Desert"},
{biExtremeHills, "ExtremeHills"},
{biForest, "Forest"},
{biTaiga, "Taiga"},
{biSwampland, "Swampland"},
{biRiver, "River"},
{biNether, "Hell"},
{biNether, "Nether"},
{biEnd, "Sky"},
{biEnd, "End"},
{biFrozenOcean, "FrozenOcean"},
{biFrozenRiver, "FrozenRiver"},
{biIcePlains, "IcePlains"},
{biIcePlains, "Tundra"},
{biIceMountains, "IceMountains"},
{biMushroomIsland, "MushroomIsland"},
{biMushroomShore, "MushroomShore"},
{biBeach, "Beach"},
{biDesertHills, "DesertHills"},
{biForestHills, "ForestHills"},
{biTaigaHills, "TaigaHills"},
{biExtremeHillsEdge, "ExtremeHillsEdge"},
{biJungle, "Jungle"},
{biJungleHills, "JungleHills"},
} ;
for (int i = 0; i < ARRAYCOUNT(BiomeMap); i++)
{
if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0)
{
return BiomeMap[i].m_Biome;
}
} // for i - BiomeMap[]
return (EMCSBiome)-1;
}
示例9: atoi
int cEnchantments::StringToEnchantmentID(const AString & a_EnchantmentName)
{
static const struct
{
int m_Value;
const char * m_Name;
} EnchantmentNames[] =
{
{ enchProtection, "Protection"},
{ enchFireProtection, "FireProtection"},
{ enchFeatherFalling, "FeatherFalling"},
{ enchBlastProtection, "BlastProtection"},
{ enchProjectileProtection, "ProjectileProtection"},
{ enchRespiration, "Respiration"},
{ enchAquaAffinity, "AquaAffinity"},
{ enchThorns, "Thorns"},
{ enchDepthStrider, "DepthStrider"},
{ enchSharpness, "Sharpness"},
{ enchSmite, "Smite"},
{ enchBaneOfArthropods, "BaneOfArthropods"},
{ enchKnockback, "Knockback"},
{ enchFireAspect, "FireAspect"},
{ enchLooting, "Looting"},
{ enchEfficiency, "Efficiency"},
{ enchSilkTouch, "SilkTouch"},
{ enchUnbreaking, "Unbreaking"},
{ enchFortune, "Fortune"},
{ enchPower, "Power"},
{ enchPunch, "Punch"},
{ enchFlame, "Flame"},
{ enchInfinity, "Infinity"},
{ enchLuckOfTheSea, "LuckOfTheSea"},
{ enchLure, "Lure"},
} ;
// First try to parse as a number:
int id = atoi(a_EnchantmentName.c_str());
if ((id != 0) || (a_EnchantmentName == "0"))
{
return id;
}
// It wasn't a number, do a lookup:
for (size_t i = 0; i < ARRAYCOUNT(EnchantmentNames); i++)
{
if (NoCaseCompare(EnchantmentNames[i].m_Name, a_EnchantmentName) == 0)
{
return EnchantmentNames[i].m_Value;
}
} // for i - EnchantmentNames[]
return -1;
}
示例10: Base64Decode
void cHTTPRequest::OnHeaderLine(const AString & a_Key, const AString & a_Value)
{
if (
(NoCaseCompare(a_Key, "Authorization") == 0) &&
(strncmp(a_Value.c_str(), "Basic ", 6) == 0)
)
{
AString UserPass = Base64Decode(a_Value.substr(6));
size_t idxCol = UserPass.find(':');
if (idxCol != AString::npos)
{
m_AuthUsername = UserPass.substr(0, idxCol);
m_AuthPassword = UserPass.substr(idxCol + 1);
m_HasAuth = true;
}
}
if ((a_Key == "Connection") && (NoCaseCompare(a_Value, "keep-alive") == 0))
{
m_AllowKeepAlive = true;
}
AddHeader(a_Key, a_Value);
}
示例11: LOGWARN
cBiomeGen * cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & a_CacheOffByDefault)
{
AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", "");
if (BiomeGenName.empty())
{
LOGWARN("[Generator] BiomeGen value not set in world.ini, using \"MultiStepMap\".");
BiomeGenName = "MultiStepMap";
}
cBiomeGen * res = NULL;
a_CacheOffByDefault = false;
if (NoCaseCompare(BiomeGenName, "constant") == 0)
{
res = new cBioGenConstant;
a_CacheOffByDefault = true; // we're generating faster than a cache would retrieve data :)
}
else if (NoCaseCompare(BiomeGenName, "checkerboard") == 0)
{
res = new cBioGenCheckerboard;
a_CacheOffByDefault = true; // we're (probably) generating faster than a cache would retrieve data
}
else if (NoCaseCompare(BiomeGenName, "voronoi") == 0)
{
res = new cBioGenVoronoi(a_Seed);
}
else if (NoCaseCompare(BiomeGenName, "distortedvoronoi") == 0)
{
res = new cBioGenDistortedVoronoi(a_Seed);
}
else if (NoCaseCompare(BiomeGenName, "twolevel") == 0)
{
res = new cBioGenTwoLevel(a_Seed);
}
else
{
if (NoCaseCompare(BiomeGenName, "multistepmap") != 0)
{
LOGWARNING("Unknown BiomeGen \"%s\", using \"MultiStepMap\" instead.", BiomeGenName.c_str());
}
res = new cBioGenMultiStepMap(a_Seed);
/*
// Performance-testing:
LOGINFO("Measuring performance of cBioGenMultiStepMap...");
clock_t BeginTick = clock();
for (int x = 0; x < 5000; x++)
{
cChunkDef::BiomeMap Biomes;
res->GenBiomes(x * 5, x * 5, Biomes);
}
clock_t Duration = clock() - BeginTick;
LOGINFO("cBioGenMultiStepMap for 5000 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC);
//*/
}
res->InitializeBiomeGen(a_IniFile);
return res;
}
示例12: StringToMobType
int StringToMobType(const AString & a_MobString)
{
static struct
{
int m_MobType;
const char * m_String;
} MobMap [] =
{
{cMonster::mtCreeper, "Creeper"},
{cMonster::mtSkeleton, "Skeleton"},
{cMonster::mtSpider, "Spider"},
{cMonster::mtGiant, "Giant"},
{cMonster::mtZombie, "Zombie"},
{cMonster::mtSlime, "Slime"},
{cMonster::mtGhast, "Ghast"},
{cMonster::mtZombiePigman, "ZombiePigman"},
{cMonster::mtEnderman, "Enderman"},
{cMonster::mtCaveSpider, "CaveSpider"},
{cMonster::mtSilverfish, "SilverFish"},
{cMonster::mtBlaze, "Blaze"},
{cMonster::mtMagmaCube, "MagmaCube"},
{cMonster::mtEnderDragon, "EnderDragon"},
{cMonster::mtWither, "Wither"},
{cMonster::mtBat, "Bat"},
{cMonster::mtWitch, "Witch"},
{cMonster::mtPig, "Pig"},
{cMonster::mtSheep, "Sheep"},
{cMonster::mtCow, "Cow"},
{cMonster::mtChicken, "Chicken"},
{cMonster::mtSquid, "Squid"},
{cMonster::mtWolf, "Wolf"},
{cMonster::mtMooshroom, "Mooshroom"},
{cMonster::mtSnowGolem, "SnowGolem"},
{cMonster::mtOcelot, "Ocelot"},
{cMonster::mtIronGolem, "IronGolem"},
{cMonster::mtVillager, "Villager"},
};
for (size_t i = 0; i < ARRAYCOUNT(MobMap); i++)
{
if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0)
{
return MobMap[i].m_MobType;
}
} // for i - MobMap[]
return -1;
}
示例13: TabCompleteCommand
void cPluginManager::TabCompleteCommand(const AString & a_Text, AStringVector & a_Results, cPlayer * a_Player)
{
for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr)
{
if (NoCaseCompare(itr->first.substr(0, a_Text.length()), a_Text) != 0)
{
// Command name doesn't match
continue;
}
if ((a_Player != NULL) && !a_Player->HasPermission(itr->second.m_Permission))
{
// Player doesn't have permission for the command
continue;
}
a_Results.push_back(itr->first);
}
}
示例14: OnPartHeader
void cHTTPFormParser::OnPartHeader(const AString & a_Key, const AString & a_Value)
{
if (NoCaseCompare(a_Key, "Content-Disposition") == 0)
{
size_t len = a_Value.size();
size_t ParamsStart = AString::npos;
for (size_t i = 0; i < len; ++i)
{
if (a_Value[i] > ' ')
{
if (strncmp(a_Value.c_str() + i, "form-data", 9) != 0)
{
// Content disposition is not "form-data", mark the whole form invalid
m_IsValid = false;
return;
}
ParamsStart = a_Value.find(';', i + 9);
break;
}
}
if (ParamsStart == AString::npos)
{
// There is data missing in the Content-Disposition field, mark the whole form invalid:
m_IsValid = false;
return;
}
// Parse the field name and optional filename from this header:
cNameValueParser Parser(a_Value.data() + ParamsStart, a_Value.size() - ParamsStart);
Parser.Finish();
m_CurrentPartName = Parser["name"];
if (!Parser.IsValid() || m_CurrentPartName.empty())
{
// The required parameter "name" is missing, mark the whole form invalid:
m_IsValid = false;
return;
}
m_CurrentPartFileName = Parser["filename"];
}
}
示例15: StringToEnchantmentID
int cEnchantments::StringToEnchantmentID(const AString & a_EnchantmentName)
{
struct
{
int m_Value;
const char * m_Name;
} EnchantmentNames[] =
{
{ enchProtection, "Protection"},
{ enchFireProtection, "FireProtection"},
{ enchFeatherFalling, "FeatherFalling"},
{ enchBlastProtection, "BlastProtection"},
{ enchProjectileProtection, "ProjectileProtection"},
{ enchRespiration, "Respiration"},
{ enchAquaAffinity, "AquaAffinity"},
{ enchThorns, "Thorns"},
{ enchSharpness, "Sharpness"},
{ enchSmite, "Smite"},
{ enchBaneOfArthropods, "BaneOfArthropods"},
{ enchKnockback, "Knockback"},
{ enchFireAspect, "FireAspect"},
{ enchLooting, "Looting"},
{ enchEfficiency, "Efficiency"},
{ enchSilkTouch, "SilkTouch"},
{ enchUnbreaking, "Unbreaking"},
{ enchFortune, "Fortune"},
{ enchPower, "Power"},
{ enchPunch, "Punch"},
{ enchFlame, "Flame"},
{ enchInfinity, "Infinity"},
} ;
for (int i = 0; i < ARRAYCOUNT(EnchantmentNames); i++)
{
if (NoCaseCompare(EnchantmentNames[i].m_Name, a_EnchantmentName) == 0)
{
return EnchantmentNames[i].m_Value;
}
} // for i - EnchantmentNames[]
return -1;
}