mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-02 20:10:32 +00:00
Moves from using dStrCmp to the new String::compare static functions. Keeps things cleaner, consistent, and works with intellisense.
This commit is contained in:
parent
76c5e30869
commit
c999baf7ed
68 changed files with 168 additions and 144 deletions
|
|
@ -142,7 +142,7 @@ U32 CompilerStringTable::add(const char *str, bool caseSens, bool tag)
|
|||
|
||||
if (caseSens)
|
||||
{
|
||||
if (!dStrcmp((*walk)->string, str))
|
||||
if (!String::compare((*walk)->string, str))
|
||||
return (*walk)->start;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -437,7 +437,7 @@ U32 tabComplete(char* inputBuffer, U32 cursorPos, U32 maxResultLength, bool forw
|
|||
}
|
||||
|
||||
// See if this is the same partial text as last checked.
|
||||
if (dStrcmp(tabBuffer, inputBuffer))
|
||||
if (String::compare(tabBuffer, inputBuffer))
|
||||
{
|
||||
// If not...
|
||||
// Save it for checking next time.
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ void printClassHeader(const char* usage, const char * className, const char * su
|
|||
}
|
||||
|
||||
// Print all fields that aren't associated with the 'field' keyword.
|
||||
if( dStrcmp( keyword, "field" ) )
|
||||
if( String::compare( keyword, "field" ) )
|
||||
Con::printf( "%s", lineStr ); // print lineStr as an unformatted string (otherwise '%' characters in the string could cause problems)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ DefineEngineFunction( strcmp, S32, ( const char* str1, const char* str2 ),,
|
|||
"@see strnatcmp\n"
|
||||
"@ingroup Strings" )
|
||||
{
|
||||
return dStrcmp( str1, str2 );
|
||||
return String::compare( str1, str2 );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -949,7 +949,7 @@ DefineEngineFunction( endsWith, bool, ( const char* str, const char* suffix, boo
|
|||
return false;
|
||||
|
||||
if( caseSensitive )
|
||||
return ( dStrcmp( &str[ srcLen - targetLen ], suffix ) == 0 );
|
||||
return ( String::compare( &str[ srcLen - targetLen ], suffix ) == 0 );
|
||||
|
||||
// both src and target are non empty, create temp buffers for lowercase operation
|
||||
char* srcBuf = new char[ srcLen + 1 ];
|
||||
|
|
@ -967,7 +967,7 @@ DefineEngineFunction( endsWith, bool, ( const char* str, const char* suffix, boo
|
|||
str += srcLen - targetLen;
|
||||
|
||||
// do the comparison
|
||||
bool endsWith = dStrcmp( str, suffix ) == 0;
|
||||
bool endsWith = String::compare( str, suffix ) == 0;
|
||||
|
||||
// delete temp buffers
|
||||
delete [] srcBuf;
|
||||
|
|
@ -2577,7 +2577,7 @@ DefineEngineFunction( isDefined, bool, ( const char* varName, const char* varVal
|
|||
else
|
||||
{
|
||||
// Is it an object?
|
||||
if (dStrcmp(varName, "0") && dStrcmp(varName, "") && (Sim::findObject(varName) != NULL))
|
||||
if (String::compare(varName, "0") && String::compare(varName, "") && (Sim::findObject(varName) != NULL))
|
||||
return true;
|
||||
else if (!String::isEmpty(varValue))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1616,13 +1616,13 @@ namespace {
|
|||
if (dStrncmp(nativeType, "const ", 6) == 0)
|
||||
nativeType += 6;
|
||||
|
||||
if (dStrcmp(nativeType, "char*") == 0 || dStrcmp(nativeType, "char *") == 0)
|
||||
if (String::compare(nativeType, "char*") == 0 || String::compare(nativeType, "char *") == 0)
|
||||
return "string";
|
||||
else if (dStrcmp(nativeType, "S32") == 0)
|
||||
else if (String::compare(nativeType, "S32") == 0)
|
||||
return "int";
|
||||
else if (dStrcmp(nativeType, "U32") == 0)
|
||||
else if (String::compare(nativeType, "U32") == 0)
|
||||
return "uint";
|
||||
else if (dStrcmp(nativeType, "F32") == 0)
|
||||
else if (String::compare(nativeType, "F32") == 0)
|
||||
return "float";
|
||||
|
||||
const U32 length = dStrlen(nativeType);
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ void AbstractClassRep::registerClassRep(AbstractClassRep* in_pRep)
|
|||
#ifdef TORQUE_DEBUG // assert if this class is already registered.
|
||||
for(AbstractClassRep *walk = classLinkList; walk; walk = walk->nextClass)
|
||||
{
|
||||
AssertFatal(dStrcmp(in_pRep->mClassName, walk->mClassName),
|
||||
AssertFatal(String::compare(in_pRep->mClassName, walk->mClassName),
|
||||
"Duplicate class name registered in AbstractClassRep::registerClassRep()");
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ ConsoleBaseType* ConsoleBaseType::getTypeByName(const char *typeName)
|
|||
ConsoleBaseType* walk = getListHead();
|
||||
while( walk != NULL )
|
||||
{
|
||||
if( dStrcmp( walk->getTypeName(), typeName ) == 0 )
|
||||
if( String::compare( walk->getTypeName(), typeName ) == 0 )
|
||||
return walk;
|
||||
|
||||
walk = walk->getListNext();
|
||||
|
|
@ -109,7 +109,7 @@ ConsoleBaseType * ConsoleBaseType::getTypeByClassName(const char *typeName)
|
|||
ConsoleBaseType *walk = getListHead();
|
||||
while( walk != NULL )
|
||||
{
|
||||
if( dStrcmp( walk->getTypeClassName(), typeName ) == 0 )
|
||||
if( String::compare( walk->getTypeClassName(), typeName ) == 0 )
|
||||
return walk;
|
||||
|
||||
walk = walk->getListNext();
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ DefineEngineMethod(FieldBrushObject, copyFields, void, (const char* simObjName,
|
|||
void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList )
|
||||
{
|
||||
// FieldBrushObject class?
|
||||
if ( dStrcmp(pSimObject->getClassName(), getClassName()) == 0 )
|
||||
if ( String::compare(pSimObject->getClassName(), getClassName()) == 0 )
|
||||
{
|
||||
// Yes, so warn.
|
||||
Con::warnf("FieldBrushObject::copyFields() - Cannot copy FieldBrushObject objects!");
|
||||
|
|
@ -522,7 +522,7 @@ DefineEngineMethod(FieldBrushObject, pasteFields, void, (const char* simObjName)
|
|||
void FieldBrushObject::pasteFields( SimObject* pSimObject )
|
||||
{
|
||||
// FieldBrushObject class?
|
||||
if ( dStrcmp(pSimObject->getClassName(), getClassName()) == 0 )
|
||||
if ( String::compare(pSimObject->getClassName(), getClassName()) == 0 )
|
||||
{
|
||||
// Yes, so warn.
|
||||
Con::warnf("FieldBrushObject::pasteFields() - Cannot paste FieldBrushObject objects!");
|
||||
|
|
@ -575,7 +575,7 @@ void FieldBrushObject::pasteFields( SimObject* pSimObject )
|
|||
staticField.type != AbstractClassRep::DeprecatedFieldType )
|
||||
{
|
||||
// Target field?
|
||||
if ( dStrcmp(staticField.pFieldname, pInternalField) == 0 )
|
||||
if ( String::compare(staticField.pFieldname, pInternalField) == 0 )
|
||||
{
|
||||
// Yes, so set data.
|
||||
pSimObject->setDataField( staticField.pFieldname, NULL, fieldEntry->value );
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ),
|
|||
{
|
||||
// Grab the full path.
|
||||
char fullpath[1024];
|
||||
Platform::makeFullPathName(dStrcmp(path, "/") == 0 ? "" : path, fullpath, sizeof(fullpath));
|
||||
Platform::makeFullPathName(String::compare(path, "/") == 0 ? "" : path, fullpath, sizeof(fullpath));
|
||||
|
||||
//dSprintf(fullpath, 511, "%s/%s", Platform::getWorkingDirectory(), path);
|
||||
|
||||
|
|
|
|||
|
|
@ -890,10 +890,10 @@ PersistenceManager::ParsedObject* PersistenceManager::findParsedObject(SimObject
|
|||
{
|
||||
const ParsedProperty &prop = testObj->properties[j];
|
||||
|
||||
if ( dStrcmp( prop.name, "internalName" ) == 0 &&
|
||||
dStrcmp( prop.value, object->getInternalName() ) == 0 )
|
||||
if ( String::compare( prop.name, "internalName" ) == 0 &&
|
||||
String::compare( prop.value, object->getInternalName() ) == 0 )
|
||||
return testObj;
|
||||
else if ( dStrcmp(prop.name, "internalName") == 0)
|
||||
else if ( String::compare(prop.name, "internalName") == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1544,7 +1544,7 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj
|
|||
if( object->getCopySource() )
|
||||
{
|
||||
const char* copySourceFieldValue = object->getCopySource()->getDataField( entry->slotName, NULL );
|
||||
if( dStrcmp( copySourceFieldValue, entry->value ) == 0 )
|
||||
if( String::compare( copySourceFieldValue, entry->value ) == 0 )
|
||||
{
|
||||
removeField( prop );
|
||||
continue;
|
||||
|
|
@ -1576,7 +1576,7 @@ void PersistenceManager::updateObject(SimObject* object, ParsedObject* parentObj
|
|||
if( object->getCopySource() )
|
||||
{
|
||||
const char* copySourceFieldValue = object->getCopySource()->getDataField( entry->slotName, NULL );
|
||||
if( dStrcmp( copySourceFieldValue, entry->value ) == 0 )
|
||||
if( String::compare( copySourceFieldValue, entry->value ) == 0 )
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2201,7 +2201,7 @@ DefineEngineMethod( PersistenceManager, setDirty, void, ( const char * objName,
|
|||
"Mark an existing SimObject as dirty (will be written out when saveDirty() is called).")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (dStrcmp(objName,"") != 0)
|
||||
if (String::compare(objName,"") != 0)
|
||||
{
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
|
|
@ -2219,7 +2219,7 @@ DefineEngineMethod( PersistenceManager, setDirty, void, ( const char * objName,
|
|||
|
||||
if (dirtyObject)
|
||||
{
|
||||
if (dStrcmp( fileName,"")!=0)
|
||||
if (String::compare( fileName,"")!=0)
|
||||
object->setDirty(dirtyObject, fileName);
|
||||
else
|
||||
object->setDirty(dirtyObject);
|
||||
|
|
@ -2230,7 +2230,7 @@ DefineEngineMethod( PersistenceManager, removeDirty, void, ( const char * objNam
|
|||
"Remove a SimObject from the dirty list.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (dStrcmp( objName,"")!=0)
|
||||
if (String::compare( objName,"")!=0)
|
||||
{
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
|
|
@ -2364,7 +2364,7 @@ DefineEngineMethod( PersistenceManager, removeObjectFromFile, void, (const char
|
|||
|
||||
if (dirtyObject)
|
||||
{
|
||||
if (dStrcmp( filename,"")!=0)
|
||||
if (String::compare( filename,"")!=0)
|
||||
object->removeObjectFromFile(dirtyObject, filename);
|
||||
else
|
||||
object->removeObjectFromFile(dirtyObject);
|
||||
|
|
@ -2375,7 +2375,7 @@ DefineEngineMethod( PersistenceManager, removeField, void, (const char * objName
|
|||
"Remove a specific field from an object declaration.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (dStrcmp(objName,"")!=0)
|
||||
if (String::compare(objName,"")!=0)
|
||||
{
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
|
|
@ -2386,7 +2386,7 @@ DefineEngineMethod( PersistenceManager, removeField, void, (const char * objName
|
|||
|
||||
if (dirtyObject)
|
||||
{
|
||||
if (dStrcmp(fieldName,"") != 0)
|
||||
if (String::compare(fieldName,"") != 0)
|
||||
object->addRemoveField(dirtyObject, fieldName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ DefineEngineFunction( nameToID, S32, (const char * objectName), ,"nameToID(objec
|
|||
|
||||
DefineEngineFunction( isObject, bool, (const char * objectName), ,"isObject(object)")
|
||||
{
|
||||
if (!dStrcmp(objectName, "0") || !dStrcmp(objectName, ""))
|
||||
if (!String::compare(objectName, "0") || !String::compare(objectName, ""))
|
||||
return false;
|
||||
else
|
||||
return (Sim::findObject(objectName) != NULL);
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ bool SimObject::save(const char *pcFileName, bool bOnlySelected, const char *pre
|
|||
while(!f.isEOF())
|
||||
{
|
||||
buffer = (const char *) f.readLine();
|
||||
if(!dStrcmp(buffer, beginMessage))
|
||||
if(!String::compare(buffer, beginMessage))
|
||||
break;
|
||||
stream->write(dStrlen(buffer), buffer);
|
||||
stream->write(2, "\r\n");
|
||||
|
|
@ -436,7 +436,7 @@ bool SimObject::save(const char *pcFileName, bool bOnlySelected, const char *pre
|
|||
while(!f.isEOF())
|
||||
{
|
||||
buffer = (const char *) f.readLine();
|
||||
if(!dStrcmp(buffer, endMessage))
|
||||
if(!String::compare(buffer, endMessage))
|
||||
break;
|
||||
}
|
||||
while(!f.isEOF())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue