forked from mirror/openmw-tes3mp
Rename to lowerCaseInPlace
This commit is contained in:
parent
e3d3380c8c
commit
07b064f616
21 changed files with 39 additions and 48 deletions
|
@ -398,7 +398,7 @@ public:
|
|||
virtual void read(ESM::ESMReader &esm)
|
||||
{
|
||||
std::string itemid = esm.getHNString("NAME");
|
||||
Misc::StringUtils::toLower(itemid);
|
||||
Misc::StringUtils::lowerCaseInPlace(itemid);
|
||||
|
||||
while (esm.isNextSub("FNAM") || esm.isNextSub("ONAM"))
|
||||
{
|
||||
|
|
|
@ -846,7 +846,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
|
|||
|
||||
for(std::vector<std::string>::const_iterator entry = it->second.begin(); entry!=it->second.end(); ++entry) {
|
||||
std::string filetype(entry->substr(entry->length()-3));
|
||||
Misc::StringUtils::toLower(filetype);
|
||||
Misc::StringUtils::lowerCaseInPlace(filetype);
|
||||
|
||||
if(filetype.compare("esm") == 0 || filetype.compare("esp") == 0) {
|
||||
boost::filesystem::path filepath(gameFilesDir);
|
||||
|
|
|
@ -93,7 +93,7 @@ void CSMWorld::CommandDispatcher::setEditLock (bool locked)
|
|||
void CSMWorld::CommandDispatcher::setSelection (const std::vector<std::string>& selection)
|
||||
{
|
||||
mSelection = selection;
|
||||
std::for_each (mSelection.begin(), mSelection.end(), Misc::StringUtils::toLowerStr);
|
||||
std::for_each (mSelection.begin(), mSelection.end(), Misc::StringUtils::lowerCaseInPlace);
|
||||
std::sort (mSelection.begin(), mSelection.end());
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ void CSMWorld::RegionMap::updateRegions (const std::vector<std::string>& regions
|
|||
{
|
||||
std::vector<std::string> regions2 (regions);
|
||||
|
||||
std::for_each (regions2.begin(), regions2.end(), Misc::StringUtils::toLowerStr);
|
||||
std::for_each (regions2.begin(), regions2.end(), Misc::StringUtils::lowerCaseInPlace);
|
||||
std::sort (regions2.begin(), regions2.end());
|
||||
|
||||
for (std::map<CellCoordinates, CellDescription>::const_iterator iter (mMap.begin());
|
||||
|
|
|
@ -93,7 +93,7 @@ bool CSMWorld::ScriptContext::isId (const std::string& name) const
|
|||
{
|
||||
mIds = mData.getIds();
|
||||
|
||||
std::for_each (mIds.begin(), mIds.end(), &Misc::StringUtils::toLowerStr);
|
||||
std::for_each (mIds.begin(), mIds.end(), &Misc::StringUtils::lowerCaseInPlace);
|
||||
std::sort (mIds.begin(), mIds.end());
|
||||
|
||||
mIdsUpdated = true;
|
||||
|
|
|
@ -148,11 +148,11 @@ namespace MWClass
|
|||
|
||||
// make key id lowercase
|
||||
std::string keyId = ptr.getCellRef().getKey();
|
||||
Misc::StringUtils::toLower(keyId);
|
||||
Misc::StringUtils::lowerCaseInPlace(keyId);
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
||||
{
|
||||
std::string refId = it->getCellRef().getRefId();
|
||||
Misc::StringUtils::toLower(refId);
|
||||
Misc::StringUtils::lowerCaseInPlace(refId);
|
||||
if (refId == keyId)
|
||||
{
|
||||
hasKey = true;
|
||||
|
|
|
@ -117,11 +117,11 @@ namespace MWClass
|
|||
|
||||
// make key id lowercase
|
||||
std::string keyId = ptr.getCellRef().getKey();
|
||||
Misc::StringUtils::toLower(keyId);
|
||||
Misc::StringUtils::lowerCaseInPlace(keyId);
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
||||
{
|
||||
std::string refId = it->getCellRef().getRefId();
|
||||
Misc::StringUtils::toLower(refId);
|
||||
Misc::StringUtils::lowerCaseInPlace(refId);
|
||||
if (refId == keyId)
|
||||
{
|
||||
hasKey = true;
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace MWGui
|
|||
size_t tagNameEndPos = tag.find(' ');
|
||||
mAttributes.clear();
|
||||
mTag = tag.substr(0, tagNameEndPos);
|
||||
Misc::StringUtils::toLower(mTag);
|
||||
Misc::StringUtils::lowerCaseInPlace(mTag);
|
||||
if (mTag.empty())
|
||||
return;
|
||||
|
||||
|
@ -151,7 +151,7 @@ namespace MWGui
|
|||
return;
|
||||
|
||||
std::string key = tag.substr(0, sepPos);
|
||||
Misc::StringUtils::toLower(key);
|
||||
Misc::StringUtils::lowerCaseInPlace(key);
|
||||
tag.erase(0, sepPos+1);
|
||||
|
||||
std::string value;
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace MWGui
|
|||
{
|
||||
const ESM::GameSetting ¤tSetting = *currentIteration;
|
||||
std::string currentGMSTID = currentSetting.mId;
|
||||
Misc::StringUtils::toLower(currentGMSTID);
|
||||
Misc::StringUtils::lowerCaseInPlace(currentGMSTID);
|
||||
|
||||
// Don't bother checking this GMST if it's not a sMagicBound* one.
|
||||
const std::string& toFind = "smagicbound";
|
||||
|
@ -44,7 +44,7 @@ namespace MWGui
|
|||
|
||||
// All sMagicBound* GMST's should be of type string
|
||||
std::string currentGMSTValue = currentSetting.getString();
|
||||
Misc::StringUtils::toLower(currentGMSTValue);
|
||||
Misc::StringUtils::lowerCaseInPlace(currentGMSTValue);
|
||||
|
||||
boundItemIDCache.insert(currentGMSTValue);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace MWGui
|
|||
|
||||
// Perform bound item check and assign the Flag_Bound bit if it passes
|
||||
std::string tempItemID = base.getCellRef().getRefId();
|
||||
Misc::StringUtils::toLower(tempItemID);
|
||||
Misc::StringUtils::lowerCaseInPlace(tempItemID);
|
||||
|
||||
if (boundItemIDCache.count(tempItemID) != 0)
|
||||
mFlags |= Flag_Bound;
|
||||
|
|
|
@ -132,15 +132,11 @@ namespace MWMechanics
|
|||
return scaledDuration-usedUp;
|
||||
}
|
||||
|
||||
bool ActiveSpells::isSpellActive(std::string id) const
|
||||
bool ActiveSpells::isSpellActive(const std::string& id) const
|
||||
{
|
||||
Misc::StringUtils::toLower(id);
|
||||
for (TContainer::iterator iter = mSpells.begin(); iter != mSpells.end(); ++iter)
|
||||
{
|
||||
std::string left = iter->first;
|
||||
Misc::StringUtils::toLower(left);
|
||||
|
||||
if (iter->first == id)
|
||||
if (Misc::StringUtils::ciEqual(iter->first, id))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace MWMechanics
|
|||
/// Remove all spells
|
||||
void clear();
|
||||
|
||||
bool isSpellActive (std::string id) const;
|
||||
bool isSpellActive (const std::string& id) const;
|
||||
///< case insensitive
|
||||
|
||||
const MagicEffects& getMagicEffects() const;
|
||||
|
|
|
@ -604,7 +604,7 @@ namespace MWMechanics
|
|||
int rank = 0;
|
||||
std::string npcFaction = ptr.getClass().getPrimaryFaction(ptr);
|
||||
|
||||
Misc::StringUtils::toLower(npcFaction);
|
||||
Misc::StringUtils::lowerCaseInPlace(npcFaction);
|
||||
|
||||
if (playerStats.getFactionRanks().find(npcFaction) != playerStats.getFactionRanks().end())
|
||||
{
|
||||
|
@ -1042,7 +1042,7 @@ namespace MWMechanics
|
|||
owner.first = ownerCellRef->getFaction();
|
||||
owner.second = true;
|
||||
}
|
||||
Misc::StringUtils::toLower(owner.first);
|
||||
Misc::StringUtils::lowerCaseInPlace(owner.first);
|
||||
|
||||
if (!Misc::StringUtils::ciEqual(item.getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId))
|
||||
mStolenItems[Misc::StringUtils::lowerCase(item.getClass().getId(item))][owner] += count;
|
||||
|
|
|
@ -390,7 +390,7 @@ namespace MWRender
|
|||
void Animation::addAnimSource(const std::string &model)
|
||||
{
|
||||
std::string kfname = model;
|
||||
Misc::StringUtils::toLower(kfname);
|
||||
Misc::StringUtils::lowerCaseInPlace(kfname);
|
||||
|
||||
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
|
||||
kfname.replace(kfname.size()-4, 4, ".kf");
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace MWScript
|
|||
const MWWorld::CellStore *cell = MWMechanics::getPlayer().getCell();
|
||||
|
||||
std::string current = MWBase::Environment::get().getWorld()->getCellName(cell);
|
||||
Misc::StringUtils::toLower(current);
|
||||
Misc::StringUtils::lowerCaseInPlace(current);
|
||||
|
||||
bool match = current.length()>=name.length() &&
|
||||
current.substr (0, name.length())==name;
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace MWScript
|
|||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
std::string cell = (runtime.getStringLiteral (runtime[0].mInteger));
|
||||
::Misc::StringUtils::toLower(cell);
|
||||
::Misc::StringUtils::lowerCaseInPlace(cell);
|
||||
runtime.pop();
|
||||
|
||||
// "Will match complete or partial cells, so ShowMap, "Vivec" will show cells Vivec and Vivec, Fred's House as well."
|
||||
|
@ -129,7 +129,7 @@ namespace MWScript
|
|||
for (; it != cells.extEnd(); ++it)
|
||||
{
|
||||
std::string name = it->mName;
|
||||
::Misc::StringUtils::toLower(name);
|
||||
::Misc::StringUtils::lowerCaseInPlace(name);
|
||||
if (name.find(cell) != std::string::npos)
|
||||
MWBase::Environment::get().getWindowManager()->addVisitedLocation (
|
||||
it->mName,
|
||||
|
|
|
@ -543,7 +543,7 @@ namespace MWScript
|
|||
factionID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
}
|
||||
::Misc::StringUtils::toLower(factionID);
|
||||
::Misc::StringUtils::lowerCaseInPlace(factionID);
|
||||
// Make sure this faction exists
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionID);
|
||||
|
||||
|
@ -575,7 +575,7 @@ namespace MWScript
|
|||
factionID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
}
|
||||
::Misc::StringUtils::toLower(factionID);
|
||||
::Misc::StringUtils::lowerCaseInPlace(factionID);
|
||||
// Make sure this faction exists
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionID);
|
||||
|
||||
|
@ -614,7 +614,7 @@ namespace MWScript
|
|||
factionID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
}
|
||||
::Misc::StringUtils::toLower(factionID);
|
||||
::Misc::StringUtils::lowerCaseInPlace(factionID);
|
||||
// Make sure this faction exists
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionID);
|
||||
|
||||
|
@ -645,7 +645,7 @@ namespace MWScript
|
|||
{
|
||||
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
||||
}
|
||||
::Misc::StringUtils::toLower(factionID);
|
||||
::Misc::StringUtils::lowerCaseInPlace(factionID);
|
||||
// Make sure this faction exists
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionID);
|
||||
|
||||
|
@ -756,7 +756,7 @@ namespace MWScript
|
|||
if (factionId.empty())
|
||||
throw std::runtime_error ("failed to determine faction");
|
||||
|
||||
::Misc::StringUtils::toLower (factionId);
|
||||
::Misc::StringUtils::lowerCaseInPlace (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
runtime.push (
|
||||
|
@ -791,7 +791,7 @@ namespace MWScript
|
|||
if (factionId.empty())
|
||||
throw std::runtime_error ("failed to determine faction");
|
||||
|
||||
::Misc::StringUtils::toLower (factionId);
|
||||
::Misc::StringUtils::lowerCaseInPlace (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().getNpcStats (player).setFactionReputation (factionId, value);
|
||||
|
@ -825,7 +825,7 @@ namespace MWScript
|
|||
if (factionId.empty())
|
||||
throw std::runtime_error ("failed to determine faction");
|
||||
|
||||
::Misc::StringUtils::toLower (factionId);
|
||||
::Misc::StringUtils::lowerCaseInPlace (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
player.getClass().getNpcStats (player).setFactionReputation (factionId,
|
||||
|
@ -870,11 +870,11 @@ namespace MWScript
|
|||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
std::string race = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
::Misc::StringUtils::toLower(race);
|
||||
::Misc::StringUtils::lowerCaseInPlace(race);
|
||||
runtime.pop();
|
||||
|
||||
std::string npcRace = ptr.get<ESM::NPC>()->mBase->mRace;
|
||||
::Misc::StringUtils::toLower(npcRace);
|
||||
::Misc::StringUtils::lowerCaseInPlace(npcRace);
|
||||
|
||||
runtime.push (npcRace == race);
|
||||
}
|
||||
|
@ -911,7 +911,7 @@ namespace MWScript
|
|||
{
|
||||
factionID = ptr.getClass().getPrimaryFaction(ptr);
|
||||
}
|
||||
::Misc::StringUtils::toLower(factionID);
|
||||
::Misc::StringUtils::lowerCaseInPlace(factionID);
|
||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||
if(factionID!="")
|
||||
{
|
||||
|
|
|
@ -472,7 +472,7 @@ namespace MWWorld
|
|||
|
||||
void CellStore::loadRef (ESM::CellRef& ref, bool deleted, const ESMStore& store)
|
||||
{
|
||||
Misc::StringUtils::toLower (ref.mRefID);
|
||||
Misc::StringUtils::lowerCaseInPlace (ref.mRefID);
|
||||
|
||||
switch (store.find (ref.mRefID))
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace MWWorld
|
|||
// This readRecord() method is used when reading a saved game.
|
||||
// Deleted globals can't appear there, so isDeleted will be ignored here.
|
||||
global.load(reader, isDeleted);
|
||||
Misc::StringUtils::toLower(global.mId);
|
||||
Misc::StringUtils::lowerCaseInPlace(global.mId);
|
||||
|
||||
Collection::iterator iter = mVariables.find (global.mId);
|
||||
if (iter!=mVariables.end())
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace MWWorld
|
|||
bool isDeleted = false;
|
||||
|
||||
record.load(esm, isDeleted);
|
||||
Misc::StringUtils::toLower(record.mId);
|
||||
Misc::StringUtils::lowerCaseInPlace(record.mId);
|
||||
|
||||
std::pair<typename Static::iterator, bool> inserted = mStatic.insert(std::make_pair(record.mId, record));
|
||||
if (inserted.second)
|
||||
|
|
|
@ -51,7 +51,7 @@ std::string Misc::ResourceHelpers::correctResourcePath(const std::string &topLev
|
|||
std::string prefix2 = topLevelDirectory + '/';
|
||||
|
||||
std::string correctedPath = resPath;
|
||||
Misc::StringUtils::toLower(correctedPath);
|
||||
Misc::StringUtils::lowerCaseInPlace(correctedPath);
|
||||
|
||||
// Apparently, leading separators are allowed
|
||||
while (correctedPath.size() && (correctedPath[0] == '/' || correctedPath[0] == '\\'))
|
||||
|
|
|
@ -94,21 +94,16 @@ public:
|
|||
}
|
||||
|
||||
/// Transforms input string to lower case w/o copy
|
||||
static void toLower(std::string &inout) {
|
||||
static void lowerCaseInPlace(std::string &inout) {
|
||||
for (unsigned int i=0; i<inout.size(); ++i)
|
||||
inout[i] = toLower(inout[i]);
|
||||
}
|
||||
|
||||
static void toLowerStr(std::string &inout)
|
||||
{
|
||||
toLower(inout);
|
||||
}
|
||||
|
||||
/// Returns lower case copy of input string
|
||||
static std::string lowerCase(const std::string &in)
|
||||
{
|
||||
std::string out = in;
|
||||
toLower(out);
|
||||
lowerCaseInPlace(out);
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue