Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_interval.h


Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (3 weeks ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_interval.h

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1414#include <qmetatype.h>
    1515
    16 #ifndef QT_NO_DEBUG_STREAM
    17 #include <qdebug.h>
    18 #endif
    19 
    20 /*!
    21   \brief A class representing an interval
    22 
    23   The interval is represented by 2 doubles, the lower and the upper limit.
    24 */
     16/*!
     17   \brief A class representing an interval
     18
     19   The interval is represented by 2 doubles, the lower and the upper limit.
     20 */
    2521
    2622class QWT_EXPORT QwtInterval
    2723{
    28 public:
     24  public:
    2925    /*!
    30       Flag indicating if a border is included or excluded
    31       \sa setBorderFlags(), borderFlags()
    32     */
     26       Flag indicating if a border is included or excluded
     27       \sa setBorderFlags(), borderFlags()
     28     */
    3329    enum BorderFlag
    3430    {
    … …  
    4743
    4844    //! Border flags
    49     typedef QFlags<BorderFlag> BorderFlags;
     45    Q_DECLARE_FLAGS( BorderFlags, BorderFlag )
    5046
    5147    QwtInterval();
    … …  
    6056    QwtInterval limited( double lowerBound, double upperBound ) const;
    6157
    62     bool operator==( const QwtInterval & ) const;
    63     bool operator!=( const QwtInterval & ) const;
     58    bool operator==( const QwtInterval& ) const;
     59    bool operator!=( const QwtInterval& ) const;
    6460
    6561    void setBorderFlags( BorderFlags );
    … …  
    7066
    7167    double width() const;
     68    long double widthL() const;
    7269
    7370    void setMinValue( double );
    … …  
    7572
    7673    bool contains( double value ) const;
    77 
    78     bool intersects( const QwtInterval & ) const;
    79     QwtInterval intersect( const QwtInterval & ) const;
    80     QwtInterval unite( const QwtInterval & ) const;
    81 
    82     QwtInterval operator|( const QwtInterval & ) const;
    83     QwtInterval operator&( const QwtInterval & ) const;
    84 
    85     QwtInterval &operator|=( const QwtInterval & );
    86     QwtInterval &operator&=( const QwtInterval & );
     74    bool contains( const QwtInterval& ) const;
     75
     76    bool intersects( const QwtInterval& ) const;
     77    QwtInterval intersect( const QwtInterval& ) const;
     78    QwtInterval unite( const QwtInterval& ) const;
     79
     80    QwtInterval operator|( const QwtInterval& ) const;
     81    QwtInterval operator&( const QwtInterval& ) const;
     82
     83    QwtInterval& operator|=( const QwtInterval& );
     84    QwtInterval& operator&=( const QwtInterval& );
    8785
    8886    QwtInterval extend( double value ) const;
    8987    QwtInterval operator|( double ) const;
    90     QwtInterval &operator|=( double );
     88    QwtInterval& operator|=( double );
    9189
    9290    bool isValid() const;
    … …  
    9694    QwtInterval symmetrize( double value ) const;
    9795
    98 private:
    99     double d_minValue;
    100     double d_maxValue;
    101     BorderFlags d_borderFlags;
     96  private:
     97    double m_minValue;
     98    double m_maxValue;
     99    BorderFlags m_borderFlags;
    102100};
    103101
    104 Q_DECLARE_TYPEINFO(QwtInterval, Q_MOVABLE_TYPE);
    105 
    106 /*!
    107   \brief Default Constructor
    108 
    109   Creates an invalid interval [0.0, -1.0]
    110   \sa setInterval(), isValid()
    111 */
    112 inline QwtInterval::QwtInterval():
    113     d_minValue( 0.0 ),
    114     d_maxValue( -1.0 ),
    115     d_borderFlags( IncludeBorders )
     102Q_DECLARE_OPERATORS_FOR_FLAGS( QwtInterval::BorderFlags )
     103Q_DECLARE_METATYPE( QwtInterval )
     104Q_DECLARE_TYPEINFO( QwtInterval, Q_MOVABLE_TYPE );
     105
     106/*!
     107   \brief Default Constructor
     108
     109   Creates an invalid interval [0.0, -1.0]
     110   \sa setInterval(), isValid()
     111 */
     112inline QwtInterval::QwtInterval()
     113    : m_minValue( 0.0 )
     114    , m_maxValue( -1.0 )
     115    , m_borderFlags( IncludeBorders )
    116116{
    117117}
    … …  
    125125   \param maxValue Maximum value
    126126   \param borderFlags Include/Exclude borders
    127 */
     127 */
    128128inline QwtInterval::QwtInterval(
    129         double minValue, double maxValue, BorderFlags borderFlags ):
    130     d_minValue( minValue ),
    131     d_maxValue( maxValue ),
    132     d_borderFlags( borderFlags )
     129        double minValue, double maxValue, BorderFlags borderFlags )
     130    : m_minValue( minValue )
     131    , m_maxValue( maxValue )
     132    , m_borderFlags( borderFlags )
    133133{
    134134}
    … …  
    140140   \param maxValue Maximum value
    141141   \param borderFlags Include/Exclude borders
    142 */
     142 */
    143143inline void QwtInterval::setInterval(
    144144    double minValue, double maxValue, BorderFlags borderFlags )
    145145{
    146     d_minValue = minValue;
    147     d_maxValue = maxValue;
    148     d_borderFlags = borderFlags;
     146    m_minValue = minValue;
     147    m_maxValue = maxValue;
     148    m_borderFlags = borderFlags;
    149149}
    150150
    … …  
    154154   \param borderFlags Or'd BorderMode flags
    155155   \sa borderFlags()
    156 */
     156 */
    157157inline void QwtInterval::setBorderFlags( BorderFlags borderFlags )
    158158{
    159     d_borderFlags = borderFlags;
     159    m_borderFlags = borderFlags;
    160160}
    161161
    … …  
    163163   \return Border flags
    164164   \sa setBorderFlags()
    165 */
     165 */
    166166inline QwtInterval::BorderFlags QwtInterval::borderFlags() const
    167167{
    168     return d_borderFlags;
     168    return m_borderFlags;
    169169}
    170170
    … …  
    173173
    174174   \param minValue Minimum value
    175 */
     175 */
    176176inline void QwtInterval::setMinValue( double minValue )
    177177{
    178     d_minValue = minValue;
     178    m_minValue = minValue;
    179179}
    180180
    … …  
    183183
    184184   \param maxValue Maximum value
    185 */
     185 */
    186186inline void QwtInterval::setMaxValue( double maxValue )
    187187{
    188     d_maxValue = maxValue;
     188    m_maxValue = maxValue;
    189189}
    190190
    … …  
    192192inline double QwtInterval::minValue() const
    193193{
    194     return d_minValue;
     194    return m_minValue;
    195195}
    196196
    … …  
    198198inline double QwtInterval::maxValue() const
    199199{
    200     return d_maxValue;
     200    return m_maxValue;
    201201}
    202202
    … …  
    207207
    208208   \return True, when the interval is valid
    209 */
     209 */
    210210inline bool QwtInterval::isValid() const
    211211{
    212     if ( ( d_borderFlags & ExcludeBorders ) == 0 )
    213         return d_minValue <= d_maxValue;
     212    if ( ( m_borderFlags & ExcludeBorders ) == 0 )
     213        return m_minValue <= m_maxValue;
    214214    else
    215         return d_minValue < d_maxValue;
     215        return m_minValue < m_maxValue;
    216216}
    217217
    … …  
    224224   \return Interval width
    225225   \sa isValid()
    226 */
     226 */
    227227inline double QwtInterval::width() const
    228228{
    229     return isValid() ? ( d_maxValue - d_minValue ) : 0.0;
     229    return isValid() ? ( m_maxValue - m_minValue ) : 0.0;
     230}
     231
     232/*!
     233   \brief Return the width of an interval as long double
     234
     235   The width of invalid intervals is 0.0, otherwise the result is
     236   maxValue() - minValue().
     237
     238   \return Interval width
     239   \sa isValid()
     240 */
     241inline long double QwtInterval::widthL() const
     242{
     243    if ( !isValid() )
     244        return 0.0;
     245
     246    return static_cast< long double >( m_maxValue )
     247           - static_cast< long double >( m_minValue );
    230248}
    231249
    … …  
    237255
    238256   \sa intersect()
    239 */
     257 */
    240258inline QwtInterval QwtInterval::operator&(
    241     const QwtInterval &other ) const
     259    const QwtInterval& other ) const
    242260{
    243261    return intersect( other );
    … …  
    251269
    252270   \sa unite()
    253 */
     271 */
    254272inline QwtInterval QwtInterval::operator|(
    255     const QwtInterval &other ) const
     273    const QwtInterval& other ) const
    256274{
    257275    return unite( other );
    … …  
    263281   \param other Interval to compare with
    264282   \return True, when this and other are equal
    265 */
    266 inline bool QwtInterval::operator==( const QwtInterval &other ) const
    267 {
    268     return ( d_minValue == other.d_minValue ) &&
    269            ( d_maxValue == other.d_maxValue ) &&
    270            ( d_borderFlags == other.d_borderFlags );
     283 */
     284inline bool QwtInterval::operator==( const QwtInterval& other ) const
     285{
     286    return ( m_minValue == other.m_minValue ) &&
     287           ( m_maxValue == other.m_maxValue ) &&
     288           ( m_borderFlags == other.m_borderFlags );
    271289}
    272290/*!
    … …  
    275293   \param other Interval to compare with
    276294   \return True, when this and other are not equal
    277 */
    278 inline bool QwtInterval::operator!=( const QwtInterval &other ) const
     295 */
     296inline bool QwtInterval::operator!=( const QwtInterval& other ) const
    279297{
    280298    return ( !( *this == other ) );
    … …  
    287305   \return Extended interval
    288306   \sa extend()
    289 */
     307 */
    290308inline QwtInterval QwtInterval::operator|( double value ) const
    291309{
    … …  
    296314inline bool QwtInterval::isNull() const
    297315{
    298     return isValid() && d_minValue >= d_maxValue;
    299 }
    300 
    301 /*!
    302   Invalidate the interval
    303 
    304   The limits are set to interval [0.0, -1.0]
    305   \sa isValid()
    306 */
     316    return isValid() && m_minValue >= m_maxValue;
     317}
     318
     319/*!
     320   Invalidate the interval
     321
     322   The limits are set to interval [0.0, -1.0]
     323   \sa isValid()
     324 */
    307325inline void QwtInterval::invalidate()
    308326{
    309     d_minValue = 0.0;
    310     d_maxValue = -1.0;
    311 }
    312 
    313 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtInterval::BorderFlags )
    314 Q_DECLARE_METATYPE( QwtInterval )
     327    m_minValue = 0.0;
     328    m_maxValue = -1.0;
     329}
    315330
    316331#ifndef QT_NO_DEBUG_STREAM
    317 QWT_EXPORT QDebug operator<<( QDebug, const QwtInterval & );
     332QWT_EXPORT QDebug operator<<( QDebug, const QwtInterval& );
    318333#endif
    319334
Note: See TracChangeset for help on using the changeset viewer.