Formatting and CLang-Tidy warning reduction.

This commit is contained in:
Jeff Young 2022-12-19 13:51:49 +00:00
parent 113fd83fdd
commit cbb70f0da1
3 changed files with 20 additions and 22 deletions

View File

@ -47,13 +47,12 @@ void SIM_PROPERTY::Disable()
}
SIM_BOOL_PROPERTY::SIM_BOOL_PROPERTY( const wxString& aLabel, const wxString& aName,
SIM_MODEL& aModel, int aParamIndex ) :
SIM_BOOL_PROPERTY::SIM_BOOL_PROPERTY( const wxString& aLabel, const wxString& aName, SIM_MODEL& aModel,
int aParamIndex ) :
wxBoolProperty( aLabel, aName ),
SIM_PROPERTY( aModel, aParamIndex )
{
auto simValue = dynamic_cast<SIM_VALUE_INST<bool>*>(
m_model.GetParam( m_paramIndex ).value.get() );
auto simValue = dynamic_cast<SIM_VALUE_INST<bool>*>( m_model.GetParam( m_paramIndex ).value.get() );
wxCHECK( simValue, /*void*/ );
@ -74,8 +73,7 @@ void SIM_BOOL_PROPERTY::OnSetValue()
if( m_disabled )
return;
auto simValue = dynamic_cast<SIM_VALUE_INST<bool>*>(
m_model.GetParam( m_paramIndex ).value.get() );
auto simValue = dynamic_cast<SIM_VALUE_INST<bool>*>( m_model.GetParam( m_paramIndex ).value.get() );
wxCHECK( simValue, /*void*/ );
@ -86,9 +84,8 @@ void SIM_BOOL_PROPERTY::OnSetValue()
}
SIM_STRING_PROPERTY::SIM_STRING_PROPERTY( const wxString& aLabel, const wxString& aName,
SIM_MODEL& aModel, int aParamIndex,
SIM_VALUE::TYPE aValueType,
SIM_STRING_PROPERTY::SIM_STRING_PROPERTY( const wxString& aLabel, const wxString& aName, SIM_MODEL& aModel,
int aParamIndex, SIM_VALUE::TYPE aValueType,
SIM_VALUE_GRAMMAR::NOTATION aNotation ) :
wxStringProperty( aLabel, aName ),
SIM_PROPERTY( aModel, aParamIndex ),
@ -157,8 +154,7 @@ wxValidator* SIM_STRING_PROPERTY::DoGetValidator() const
}
bool SIM_STRING_PROPERTY::StringToValue( wxVariant& aVariant, const wxString& aText,
int aArgFlags ) const
bool SIM_STRING_PROPERTY::StringToValue( wxVariant& aVariant, const wxString& aText, int aArgFlags ) const
{
if( m_disabled )
return false;
@ -188,8 +184,8 @@ static wxArrayString convertStringsToWx( const std::vector<std::string>& aString
}
SIM_ENUM_PROPERTY::SIM_ENUM_PROPERTY( const wxString& aLabel, const wxString& aName,
SIM_MODEL& aModel, int aParamIndex ) :
SIM_ENUM_PROPERTY::SIM_ENUM_PROPERTY( const wxString& aLabel, const wxString& aName, SIM_MODEL& aModel,
int aParamIndex ) :
wxEnumProperty( aLabel, aName, convertStringsToWx( aModel.GetParam( aParamIndex ).info.enumValues ) ),
SIM_PROPERTY( aModel, aParamIndex )
{

View File

@ -359,7 +359,8 @@ std::string SIM_VALUE_PARSER::ExponentToMetricSuffix( double aExponent, int& aRe
}
std::unique_ptr<SIM_VALUE> SIM_VALUE::Create( TYPE aType, std::string aString, NOTATION aNotation )
std::unique_ptr<SIM_VALUE> SIM_VALUE::Create( TYPE aType, const std::string& aString,
NOTATION aNotation )
{
std::unique_ptr<SIM_VALUE> value = SIM_VALUE::Create( aType );
value->FromString( aString, aNotation );
@ -387,9 +388,10 @@ std::unique_ptr<SIM_VALUE> SIM_VALUE::Create( TYPE aType )
}
void SIM_VALUE::operator=( const std::string& aString )
SIM_VALUE& SIM_VALUE::operator=( const std::string& aString )
{
FromString( aString );
return *this;
}
@ -548,7 +550,7 @@ std::string SIM_VALUE_INST<T>::ToString( NOTATION aNotation ) const
{
static_assert( std::is_same<T, std::vector<T>>::value );
std::string string = "";
std::string string;
for( auto it = m_value.cbegin(); it != m_value.cend(); it++ )
{
@ -657,10 +659,11 @@ std::string SIM_VALUE_COMPLEX::ToSimpleString() const
template <typename T>
void SIM_VALUE_INST<T>::operator=( const SIM_VALUE& aOther )
SIM_VALUE_INST<T>& SIM_VALUE_INST<T>::operator=( const SIM_VALUE& aOther )
{
auto other = dynamic_cast<const SIM_VALUE_INST<T>*>( &aOther );
m_value = other->m_value;
return *this;
}

View File

@ -76,7 +76,7 @@ public:
TYPE_COMPLEX_VECTOR
};
static std::unique_ptr<SIM_VALUE> Create( TYPE aType, std::string aString,
static std::unique_ptr<SIM_VALUE> Create( TYPE aType, const std::string& aString,
NOTATION aNotation = NOTATION::SI );
static std::unique_ptr<SIM_VALUE> Create( TYPE aType );
@ -87,8 +87,8 @@ public:
virtual bool HasValue() const = 0;
void operator=( const std::string& aString );
virtual void operator=( const SIM_VALUE& aValue ) = 0;
SIM_VALUE& operator=( const std::string& aString );
virtual SIM_VALUE& operator=( const SIM_VALUE& aValue ) = 0;
virtual bool operator==( const SIM_VALUE& aOther ) const = 0;
bool operator!=( const SIM_VALUE& aOther ) const;
@ -117,8 +117,7 @@ public:
std::string ToString( NOTATION aNotation = NOTATION::SI ) const override;
std::string ToSimpleString() const override;
void operator=( const SIM_VALUE& aOther ) override;
void operator=( const T& aValue );
SIM_VALUE_INST& operator=( const SIM_VALUE& aOther ) override;
bool operator==( const T& aOther ) const;
bool operator==( const SIM_VALUE& aOther ) const override;