Skip to content
Permalink
Browse files

Break oneliners

  • Loading branch information
m-kuhn committed Oct 31, 2016
1 parent 88871c2 commit f438542fe7a4208da9f9f9687e438178b6fa2584
Showing with 33 additions and 14 deletions.
  1. +33 −14 src/core/qgsexpression.cpp
@@ -108,21 +108,36 @@ static QVariant tvl2variant( TVL v )

inline bool isIntSafe( const QVariant& v )
{
if ( v.type() == QVariant::Int ) return true;
if ( v.type() == QVariant::UInt ) return true;
if ( v.type() == QVariant::LongLong ) return true;
if ( v.type() == QVariant::ULongLong ) return true;
if ( v.type() == QVariant::Double ) return false;
if ( v.type() == QVariant::String ) { bool ok; v.toString().toInt( &ok ); return ok; }
if ( v.type() == QVariant::Int )
return true;
if ( v.type() == QVariant::UInt )
return true;
if ( v.type() == QVariant::LongLong )
return true;
if ( v.type() == QVariant::ULongLong )
return true;
if ( v.type() == QVariant::Double )
return false;
if ( v.type() == QVariant::String )
{
bool ok;
v.toString().toInt( &ok );
return ok;
}
return false;
}
inline bool isDoubleSafe( const QVariant& v )
{
if ( v.type() == QVariant::Double ) return true;
if ( v.type() == QVariant::Int ) return true;
if ( v.type() == QVariant::UInt ) return true;
if ( v.type() == QVariant::LongLong ) return true;
if ( v.type() == QVariant::ULongLong ) return true;
if ( v.type() == QVariant::Double )
return true;
if ( v.type() == QVariant::Int )
return true;
if ( v.type() == QVariant::UInt )
return true;
if ( v.type() == QVariant::LongLong )
return true;
if ( v.type() == QVariant::ULongLong )
return true;
if ( v.type() == QVariant::String )
{
bool ok;
@@ -135,8 +150,9 @@ inline bool isDoubleSafe( const QVariant& v )

inline bool isDateTimeSafe( const QVariant& v )
{
return v.type() == QVariant::DateTime || v.type() == QVariant::Date ||
v.type() == QVariant::Time;
return v.type() == QVariant::DateTime
|| v.type() == QVariant::Date
|| v.type() == QVariant::Time;
}

inline bool isIntervalSafe( const QVariant& v )
@@ -153,7 +169,10 @@ inline bool isIntervalSafe( const QVariant& v )
return false;
}

inline bool isNull( const QVariant& v ) { return v.isNull(); }
inline bool isNull( const QVariant& v )
{
return v.isNull();
}

///////////////////////////////////////////////
// evaluation error macros

0 comments on commit f438542

Please sign in to comment.
You can’t perform that action at this time.