Changed: Replaced string empty comparisons with empty()

This commit is contained in:
kervala 2012-10-06 17:17:26 +02:00
parent 9a12a5b4c2
commit 2b86a180e6
15 changed files with 21 additions and 21 deletions

View file

@ -193,7 +193,7 @@ void SCloudTextureClamp::init (uint32 nWidth, uint32 nHeight, uint32 nDepth, con
Mem = new uint8[NbW*Width*NbH*Height]; Mem = new uint8[NbW*Width*NbH*Height];
uint32 i, j; uint32 i, j;
if (filename == "") if (filename.empty())
{ {
// No filename so init with default // No filename so init with default
for (i = 0; i < NbW; ++i) for (i = 0; i < NbW; ++i)

View file

@ -307,7 +307,7 @@ void CCluster::serial (NLMISC::IStream&f)
_SoundGroupId = CStringMapper::map(soundGroup); _SoundGroupId = CStringMapper::map(soundGroup);
f.serial(envFxName); f.serial(envFxName);
if (envFxName == "") if (envFxName.empty())
envFxName = "no fx"; envFxName = "no fx";
_EnvironmentFxId = CStringMapper::map(envFxName); _EnvironmentFxId = CStringMapper::map(envFxName);
} }

View file

@ -237,7 +237,7 @@ void CZoneLoadingTask::run(void)
{ {
// Lookup the zone // Lookup the zone
string zonePathLookup = CPath::lookup (_ZoneName, false, false, true); string zonePathLookup = CPath::lookup (_ZoneName, false, false, true);
if (zonePathLookup == "") if (zonePathLookup.empty())
zonePathLookup = _ZoneName; zonePathLookup = _ZoneName;
CZone *ZoneTmp = new CZone; CZone *ZoneTmp = new CZone;

View file

@ -89,7 +89,7 @@ void CVarPath::decode ()
string val = getToken (); string val = getToken ();
if (val == "") if (val.empty())
return; return;
if (val == "[" ) if (val == "[" )
@ -105,7 +105,7 @@ void CVarPath::decode ()
osbnb++; osbnb++;
// end of token // end of token
if (val == "") if (val.empty())
{ {
nlwarning ("VP: Bad VarPath '%s', suppose it s an empty varpath", RawVarPath.c_str()); nlwarning ("VP: Bad VarPath '%s', suppose it s an empty varpath", RawVarPath.c_str());
Destination.clear (); Destination.clear ();

View file

@ -142,7 +142,7 @@ public:
for (i=0; i<num; ++i) for (i=0; i<num; ++i)
{ {
std::string fname = NLMISC::CPath::lookup(_NamePrefix + "_" + NLMISC::toString(i) + ".lr", false, true); std::string fname = NLMISC::CPath::lookup(_NamePrefix + "_" + NLMISC::toString(i) + ".lr", false, true);
if (fname == "") if (fname.empty())
continue; continue;
NLMISC::CIFile f(fname); NLMISC::CIFile f(fname);

View file

@ -777,7 +777,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
sint32 dstPhraseId= pCSDst->getSPhraseId(); sint32 dstPhraseId= pCSDst->getSPhraseId();
sint32 dstMacroId= pCSDst->getMacroId(); sint32 dstMacroId= pCSDst->getMacroId();
if ((src == "") && (CHandlerPhraseMemoryCopy::haveLastPhraseElement)) if (src.empty() && (CHandlerPhraseMemoryCopy::haveLastPhraseElement))
{ {
// get the slot ids from save // get the slot ids from save
srcIsMacro= CHandlerPhraseMemoryCopy::isMacro; srcIsMacro= CHandlerPhraseMemoryCopy::isMacro;

View file

@ -1563,7 +1563,7 @@ bool CInterfaceManager::loadConfig (const string &filename)
CIFile f; CIFile f;
string sFileName; string sFileName;
sFileName = NLMISC::CPath::lookup (filename, false); sFileName = NLMISC::CPath::lookup (filename, false);
if (sFileName == "" || !f.open(sFileName)) if (sFileName.empty() || !f.open(sFileName))
return false; return false;

View file

@ -43,7 +43,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
{ {
CSString eff = pIS->Consumable.Properties[i]; CSString eff = pIS->Consumable.Properties[i];
if (eff == "") if (eff.empty())
continue; continue;
// Get name id of effect // Get name id of effect

View file

@ -1228,7 +1228,7 @@ void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str)
p = s.splitTo('.', true); p = s.splitTo('.', true);
while (p.size() > 0) while (p.size() > 0)
{ {
if (path == "") if (path.empty())
path = p; path = p;
else else
path += "." + p; path += "." + p;

View file

@ -707,7 +707,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
SGlobalTexture gt; SGlobalTexture gt;
// Load texture file // Load texture file
string filename = CPath::lookup (textureFileName, false); string filename = CPath::lookup (textureFileName, false);
if (filename == "") return; if (filename.empty()) return;
CIFile ifTmp; CIFile ifTmp;
if (ifTmp.open(filename)) if (ifTmp.open(filename))
CBitmap::loadSize (ifTmp, gt.Width, gt.Height); CBitmap::loadSize (ifTmp, gt.Width, gt.Height);
@ -724,7 +724,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
// Load uv file // Load uv file
CIFile iFile; CIFile iFile;
filename = CPath::lookup (uvFileName, false); filename = CPath::lookup (uvFileName, false);
if (filename == "") return; if (filename.empty()) return;
if (!iFile.open(filename)) return; if (!iFile.open(filename)) return;
_GlobalTextures.push_back (gt); _GlobalTextures.push_back (gt);
@ -866,7 +866,7 @@ sint32 CViewRenderer::createTexture (const std::string &sGlobalTextureName,
SGlobalTexture gtTmp; SGlobalTexture gtTmp;
gtTmp.FromGlobaleTexture = false; gtTmp.FromGlobaleTexture = false;
string filename = CPath::lookup (sLwrGTName, false); string filename = CPath::lookup (sLwrGTName, false);
if (filename == "") return -1; if (filename.empty()) return -1;
CIFile ifTmp; CIFile ifTmp;
if (ifTmp.open(filename)) if (ifTmp.open(filename))
{ {

View file

@ -139,7 +139,7 @@ UInstanceGroup *getCluster(const UGlobalPosition &gp)
return 0; return 0;
const string &strPos = GR->getIdentifier(gp); const string &strPos = GR->getIdentifier(gp);
if(strPos == "") if(strPos.empty())
return 0; return 0;
// try to find the ig in the loaded ig map // try to find the ig in the loaded ig map
std::map<std::string, UInstanceGroup *>::const_iterator igIt = IGLoaded.find(strlwr(strPos)); std::map<std::string, UInstanceGroup *>::const_iterator igIt = IGLoaded.find(strlwr(strPos));

View file

@ -6603,7 +6603,7 @@ NLMISC::CVectorD getVectorD(const CObject *obj)
CObject *buildVector(const NLMISC::CVectorD &vector, const std::string &instanceId /*= ""*/) CObject *buildVector(const NLMISC::CVectorD &vector, const std::string &instanceId /*= ""*/)
{ {
CObject *table; CObject *table;
if (instanceId == "") if (instanceId.empty())
{ {
table = getEditor().getDMC().newComponent("Position"); table = getEditor().getDMC().newComponent("Position");
table->set("x", vector.x); table->set("x", vector.x);

View file

@ -470,7 +470,7 @@ protected:
/// display nodes /// display nodes
void xmlDisplay() void xmlDisplay()
{ {
std::string ntype = (Name == "" ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch"); std::string ntype = (Name.empty() ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch");
nlinfo("<%s name=\"%s\" description=\"%s\">", ntype.c_str(), Name.c_str(), Description.c_str()); nlinfo("<%s name=\"%s\" description=\"%s\">", ntype.c_str(), Name.c_str(), Description.c_str());

View file

@ -483,7 +483,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si
nlassert(index != -1); nlassert(index != -1);
instanceId = parent->getAttr("InstanceId")->toString(); instanceId = parent->getAttr("InstanceId")->toString();
attrName = parent->getKey(index); attrName = parent->getKey(index);
if (attrName == "") if (attrName.empty())
{ {
position = index; position = index;
} }
@ -501,7 +501,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si
nlassert(index2 != -1); nlassert(index2 != -1);
sint32 index = parent->findIndex(this); sint32 index = parent->findIndex(this);
nlassert(index != -1); nlassert(index != -1);
if (parent2->getKey(index2) == "") if (parent2->getKey(index2).empty())
{ {
nlassert(0); // TMP : want to see if may possibly happen nlassert(0); // TMP : want to see if may possibly happen
return false; return false;
@ -1092,7 +1092,7 @@ void CObjectTable::doSerialize(std::string& out, CSerializeContext& context) co
if ( _Value[i].second->isString("Name") if ( _Value[i].second->isString("Name")
&& _Value[i].second->isString("LocationId") && _Value[i].second->isString("LocationId")
&& _Value[i].second->toString("Name") == "Permanent" && _Value[i].second->toString("Name") == "Permanent"
&& _Value[i].second->toString("LocationId") == "") && _Value[i].second->toString("LocationId").empty())
{ {
isDefault = true; isDefault = true;
} }
@ -1248,7 +1248,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value)
//H_AUTO(R2_CObjectTable_setObject) //H_AUTO(R2_CObjectTable_setObject)
CHECK_TABLE_INTEGRITY CHECK_TABLE_INTEGRITY
value->setGhost(this->getGhost()); value->setGhost(this->getGhost());
if (key == "") if (key.empty())
{ {
clear(); clear();

View file

@ -406,7 +406,7 @@ void CScenarioEntryPoints::loadFromXMLFile()
nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str()); nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str());
} }
} }
if(package == "") if(package.empty())
nlinfo("no 'package' tag in %s island", island); nlinfo("no 'package' tag in %s island", island);
else else
completeIsland.Package = CSString(package); completeIsland.Package = CSString(package);