Use the simplified toUpper for identifiers and filenames

develop
kaetemi 4 years ago
parent 281630c280
commit 36c676e2b2

@ -115,7 +115,7 @@ void CLandscapeIGManager::initIG(UScene *scene, const std::string &igDesc, UDriv
if (ig)
{
// add it to the map.
string tokId= toUpper(string(token));
string tokId= toUpperAscii(string(token));
_ZoneInstanceGroupMap[tokId]= CInstanceGroupElement(ig, token);
// Add a reference on the shapes
@ -295,7 +295,7 @@ UInstanceGroup *CLandscapeIGManager::getIG(const std::string &name) const
std::string CLandscapeIGManager::translateName(const std::string &name) const
{
std::string ret;
ret= toUpper(name + ".ig");
ret= toUpperAscii(name + ".ig");
return ret;
}
@ -364,7 +364,7 @@ void CLandscapeIGManager::reloadAllIgs()
const char *token= bkupIgFileNameList[i].c_str();
UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(token);
// add it to the map.
string tokId= toUpper(token);
string tokId= toUpperAscii(token);
_ZoneInstanceGroupMap[tokId]= CInstanceGroupElement(ig, token);
// If was addedToScene before, re-add to scene now.

@ -1250,7 +1250,7 @@ const IPrimitive *IPrimitive::getPrimitive (const std::string &absoluteOrRelativ
childName=path.substr(0,indexStr);
path.erase(0, indexStr);
}
childName=toUpper(childName);
childName=toUpperAscii(childName);
const IPrimitive*child=NULL;
uint childIndex;
for (childIndex=0;childIndex<cursor->getNumChildren();childIndex++)
@ -1259,7 +1259,7 @@ const IPrimitive *IPrimitive::getPrimitive (const std::string &absoluteOrRelativ
nlassert(child);
string name;
if ( child->getPropertyByName("class", name)
&& toUpper(name)==childName )
&& toUpperAscii(name)==childName )
break;
}
if (childIndex>=cursor->getNumChildren())

@ -1733,7 +1733,7 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion)
HKEY keyRoot = HKEY_LOCAL_MACHINE;
for (i=0; i<sizeof(rootKeysH)/sizeof(HKEY); i++)
{
if (toUpper(keyPath).find (rootKeys[i]) == 0)
if (toUpperAscii(keyPath).find (rootKeys[i]) == 0)
{
keyPath = keyPath.substr (strlen (rootKeys[i]));
keyRoot = rootKeysH[i];

@ -956,7 +956,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
// Load the recording state from the config file
if ((var = ConfigFile.getVarPtr ("Rec")) != NULL)
{
string srecstate = toUpper(var->asString());
string srecstate = toUpperAscii(var->asString());
if ( srecstate == "RECORD" )
{
_RecordingState = CCallbackNetBase::Record;

@ -302,7 +302,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item)
debug(toString("The slot name %d is Empty.", i));
// Push the possible slots for the item in the list.
SlotBF|= SINT64_CONSTANT(1)<< (SLOTTYPE::stringToSlotType(NLMISC::toUpper(slotName)));
SlotBF|= SINT64_CONSTANT(1)<< (SLOTTYPE::stringToSlotType(NLMISC::toUpperAscii(slotName)));
}
}
}
@ -321,7 +321,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item)
}
else
{
Family = (ITEMFAMILY::EItemFamily) ITEMFAMILY::stringToItemFamily(NLMISC::toUpper( family) );
Family = (ITEMFAMILY::EItemFamily) ITEMFAMILY::stringToItemFamily(NLMISC::toUpperAscii( family) );
if(Family == ITEMFAMILY::UNDEFINED)
debug("Item Family Undefined.");
}
@ -335,7 +335,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item)
}
else
{
ItemType = (ITEM_TYPE::TItemType) ITEM_TYPE::stringToItemType(NLMISC::toUpper(itemtype) );
ItemType = (ITEM_TYPE::TItemType) ITEM_TYPE::stringToItemType(NLMISC::toUpperAscii(itemtype) );
if (ItemType == ITEM_TYPE::UNDEFINED)
debug("Item Type Undefined.");
}

@ -103,7 +103,7 @@ void CSBrickSheet::build (const NLGEORGES::UFormElm &root)
{
string sheetName= Id.toString();
std::string::size_type end= sheetName.find(".sbrick")-2;
BrickFamily = BRICK_FAMILIES::toSBrickFamily ( NLMISC::toUpper(sheetName.substr(0,end)) );
BrickFamily = BRICK_FAMILIES::toSBrickFamily ( NLMISC::toUpperAscii(sheetName.substr(0,end)) );
if(BrickFamily==BRICK_FAMILIES::Unknown)
nlwarning("Unknown Family for SBrick: %s", sheetName.c_str());
}

@ -134,7 +134,7 @@ uint CColorSlotManager::addSlot(const TStringVect &slotDescs)
_Slots.push_back(slotDescs);
for(uint k = 0; k < slotDescs.size(); ++k)
{
_Slots.back()[k] = NLMISC::toUpper(_Slots.back()[k]);
_Slots.back()[k] = NLMISC::toUpperAscii(_Slots.back()[k]);
}
return (uint)_Slots.size() - 1;
}
@ -266,7 +266,7 @@ bool CColorSlotManager::parseTexName(const char *texName, std::string *texNameWi
static std::string nameToParse;
static std::string currentExt;
static TIntCoupleVect slotsId;
nameToParse = NLMISC::toUpper(NLMISC::CFile::getFilenameWithoutExtension(texName));
nameToParse = NLMISC::toUpperAscii(NLMISC::CFile::getFilenameWithoutExtension(texName));
TStrPos currPos = nameToParse.length();
@ -376,7 +376,7 @@ bool CColorSlotManager::changeTexName(std::string &texName, TIntCouple *slotIDs,
static TIntCoupleVect srcSlotIDs;
everythingOk = true;
texNameNoExt = NLMISC::toUpper(NLMISC::CFile::getFilenameWithoutExtension(texName));
texNameNoExt = NLMISC::toUpperAscii(NLMISC::CFile::getFilenameWithoutExtension(texName));
texExt = NLMISC::CFile::getExtension(texName);
TTex2Slots::const_iterator texIt = _TexMap.find(texNameNoExt);
if (texIt != _TexMap.end())

@ -229,7 +229,7 @@ struct CStatThread : public NLMISC::IRunnable
name = UserEntity->getEntityName();
std::string userid = toString("u%d", NetMngr.getUserId())+name;
return toUpper(getMD5((const uint8 *)userid.c_str(), (uint32)userid.size()).toString());
return toUpperAscii(getMD5((const uint8 *)userid.c_str(), (uint32)userid.size()).toString());
}
// return true if we sent the connect because we have all information
@ -244,7 +244,7 @@ struct CStatThread : public NLMISC::IRunnable
std::string params;
addParam(params, "ra", randomString());
std::string session = toString("%d%d", NetMngr.getUserId(), CTime::getSecondsSince1970());
addParam(params, "sessioncookie", toUpper(getMD5((const uint8 *)session.c_str(), (uint32)session.size()).toString()));
addParam(params, "sessioncookie", toUpperAscii(getMD5((const uint8 *)session.c_str(), (uint32)session.size()).toString()));
addParam(params, "cookie", cookie());
addParam(params, "browsertoken", "X");
addParam(params, "platformtoken", "Win32");

@ -4613,7 +4613,7 @@ public:
}
std::locale loc("");
const std::collate<char>& coll = std::use_facet<std::collate<char> >(loc);
const std::collate<char>& coll = std::use_facet<std::collate<char> >(loc); // FIXME: Probably does not work
for(uint i = 0; i < nbChilds - 1; ++i)
{

@ -117,7 +117,7 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn
if (!rootBrick->Properties.empty())
{
string prop= NLMISC::toUpper(rootBrick->Properties[0].Text);
string prop= NLMISC::toUpperAscii(rootBrick->Properties[0].Text);
vector<string> strList;
splitString(prop, " ", strList);
// The prop Id should be 'FPLAN:'

@ -431,7 +431,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
// The string may have multiple brick type separated by |
string brickTypeArray= (const char*)prop;
vector<string> strList;
NLMISC::splitString(NLMISC::toUpper(brickTypeArray), "|", strList);
NLMISC::splitString(NLMISC::toUpperAscii(brickTypeArray), "|", strList);
// Test All words
for(uint i=0;i<strList.size();i++)
@ -457,7 +457,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
if(prop)
{
string str= prop.str();
_ItemSlot= SLOTTYPE::stringToSlotType(NLMISC::toUpper(str));
_ItemSlot= SLOTTYPE::stringToSlotType(NLMISC::toUpperAscii(str));
}
// _AutoGrayed

@ -2987,7 +2987,7 @@ void CInterfaceManager::log(const std::string &str, const std::string &cat)
FILE *f = nlfopen(fileName, "at");
if (f != NULL)
{
const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str;
const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpperAscii(cat) + ") * " + str;
fprintf(f, "%s\n", finalString.c_str());
fclose(f);
}

@ -47,7 +47,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
continue;
// Get name id of effect
CSString name = toUpper(eff.splitTo(':', true));
CSString name = toUpperAscii(eff.splitTo(':', true));
// Extract parameters from sheet
vector<CSString> params;

@ -101,7 +101,7 @@ string CItemSpecialEffectHelper::getEffect(const std::string &effect, bool &firs
return result;
// Get name id of effect
CSString name = toUpper(eff.splitTo(':', true));
CSString name = toUpperAscii(eff.splitTo(':', true));
// Extract parameters from sheet
vector<CSString> params;

@ -404,7 +404,7 @@ CModalContainerEditCmd::CModalContainerEditCmd()
void CModalContainerEditCmd::create(const std::string &name, bool bDefKey, bool allowAllActions)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
string prefix = NLMISC::toUpper(name);
string prefix = NLMISC::toUpperAscii(name);
CanDefineKey = bDefKey;
_AllowAllActions = allowAllActions;
prefix = string(DB_EDITCMD_PREFIX) + string(":") + prefix + string(":");

@ -195,22 +195,16 @@ bool CPeopleList::sortExByContactId(const CPeople& a, const CPeople& b)
//==================================================================
bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b)
{
string name_a = toUpper(a.getName());
string name_b = toUpper(b.getName());
return (name_a < name_b);
return -NLMISC::compareCaseInsensitive(a.getName(), b.getName()); // FIXME: Locale-dependent sort
}
//==================================================================
bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b)
{
string name_a = toUpper(a.getName());
string name_b = toUpper(b.getName());
// We want order: online/alpha, offworld/alpha, offline/alpha
if (a.Online == b.Online)
{
return (name_a < name_b);
return -NLMISC::compareCaseInsensitive(a.getName(), b.getName()); // FIXME: Locale-dependent sort
}
else
{

@ -96,7 +96,7 @@ void CItemGroup::addItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlot
void CItemGroup::addRemove(std::string slotName)
{
SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::stringToSlotEquipment(NLMISC::toUpper(slotName));
SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::stringToSlotEquipment(NLMISC::toUpperAscii(slotName));
if(slot != SLOT_EQUIPMENT::UNDEFINED)
addRemove(slot);
}
@ -161,7 +161,7 @@ void CItemGroup::readFrom(xmlNodePtr node)
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"slot");
std::string slot;
if (ptrName) NLMISC::fromString((const char*)ptrName, slot);
item.slot = SLOT_EQUIPMENT::stringToSlotEquipment(NLMISC::toUpper(slot));
item.slot = SLOT_EQUIPMENT::stringToSlotEquipment(NLMISC::toUpperAscii(slot));
// Old read, keep for compatibility reasons
ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"sheetName");
if (ptrName) NLMISC::fromString((const char*)ptrName, item.sheetName);

Loading…
Cancel
Save