mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 17:35:43 +00:00
CPropertyNameValidator: Avoid redundant string construction
Also simplifies scope
This commit is contained in:
@@ -23,27 +23,27 @@ void CPropertyNameValidator::SetTypeNameOverride(const QString& kNewTypeName)
|
||||
/** Perform validation */
|
||||
QValidator::State CPropertyNameValidator::validate(QString& rInput, int&) const
|
||||
{
|
||||
if (mpProperty)
|
||||
if (!mpProperty)
|
||||
return QValidator::Invalid;
|
||||
|
||||
const TString TypeName = mTypeNameOverride.isEmpty() ? mpProperty->HashableTypeName() : TO_TSTRING(mTypeNameOverride);
|
||||
const auto InputString = rInput.toStdString();
|
||||
|
||||
CCRC32 Hash;
|
||||
Hash.Hash(InputString.c_str());
|
||||
Hash.Hash(TypeName.Data());
|
||||
uint32 PropertyID = Hash.Digest();
|
||||
|
||||
if (PropertyID != mpProperty->ID())
|
||||
{
|
||||
TString TypeName = (mTypeNameOverride.isEmpty() ? mpProperty->HashableTypeName() : TO_TSTRING(mTypeNameOverride));
|
||||
|
||||
CCRC32 Hash;
|
||||
Hash.Hash( rInput.toStdString().c_str() );
|
||||
Hash.Hash( *TypeName );
|
||||
uint32 PropertyID = Hash.Digest();
|
||||
|
||||
if (PropertyID != mpProperty->ID())
|
||||
if (mpProperty->Type() == EPropertyType::Int)
|
||||
{
|
||||
if (mpProperty->Type() == EPropertyType::Int)
|
||||
{
|
||||
CCRC32 Hash2;
|
||||
Hash2.Hash( rInput.toStdString().c_str() );
|
||||
Hash2.Hash( "choice" );
|
||||
PropertyID = Hash2.Digest();
|
||||
}
|
||||
CCRC32 Hash2;
|
||||
Hash2.Hash(InputString.c_str());
|
||||
Hash2.Hash("choice");
|
||||
PropertyID = Hash2.Digest();
|
||||
}
|
||||
return ( PropertyID == mpProperty->ID() ? QValidator::Acceptable : QValidator::Invalid );
|
||||
}
|
||||
|
||||
return QValidator::Invalid;
|
||||
return PropertyID == mpProperty->ID() ? QValidator::Acceptable : QValidator::Invalid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user