mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
Add missing QgsInterval != operator
This commit is contained in:
parent
c25a9e8450
commit
3d23cb62af
@ -288,6 +288,8 @@ QgsInterval instance or interval was set with a mix of units.
|
||||
|
||||
bool operator==( QgsInterval other ) const;
|
||||
|
||||
bool operator!=( QgsInterval other ) const;
|
||||
|
||||
static QgsInterval fromString( const QString &string );
|
||||
%Docstring
|
||||
Converts a string to an interval
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsinterval.h"
|
||||
#include "qgis.h"
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
@ -207,18 +206,6 @@ void QgsInterval::setSeconds( double seconds )
|
||||
mOriginalUnit = QgsUnitTypes::TemporalSeconds;
|
||||
}
|
||||
|
||||
bool QgsInterval::operator==( QgsInterval other ) const
|
||||
{
|
||||
if ( !mValid && !other.mValid )
|
||||
return true;
|
||||
else if ( mValid && other.mValid && ( mOriginalUnit != QgsUnitTypes::TemporalUnknownUnit || other.mOriginalUnit != QgsUnitTypes::TemporalUnknownUnit ) )
|
||||
return mOriginalUnit == other.mOriginalUnit && mOriginalDuration == other.mOriginalDuration;
|
||||
else if ( mValid && other.mValid )
|
||||
return qgsDoubleNear( mSeconds, other.mSeconds );
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
QgsInterval QgsInterval::fromString( const QString &string )
|
||||
{
|
||||
double seconds = 0;
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "qgis_sip.h"
|
||||
#include "qgis_core.h"
|
||||
#include "qgsunittypes.h"
|
||||
#include "qgis.h"
|
||||
|
||||
class QString;
|
||||
|
||||
@ -293,7 +294,22 @@ class CORE_EXPORT QgsInterval
|
||||
*/
|
||||
QgsUnitTypes::TemporalUnit originalUnit() const { return mOriginalUnit; }
|
||||
|
||||
bool operator==( QgsInterval other ) const;
|
||||
bool operator==( QgsInterval other ) const
|
||||
{
|
||||
if ( !mValid && !other.mValid )
|
||||
return true;
|
||||
else if ( mValid && other.mValid && ( mOriginalUnit != QgsUnitTypes::TemporalUnknownUnit || other.mOriginalUnit != QgsUnitTypes::TemporalUnknownUnit ) )
|
||||
return mOriginalUnit == other.mOriginalUnit && mOriginalDuration == other.mOriginalDuration;
|
||||
else if ( mValid && other.mValid )
|
||||
return qgsDoubleNear( mSeconds, other.mSeconds );
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator!=( QgsInterval other ) const
|
||||
{
|
||||
return !( *this == other );
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string to an interval
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user