Main Page · Class Overview · Hierarchy · All Classes
range.h
1 /***************************************************************************
2 ** **
3 ** QCustomPlot, an easy to use, modern plotting widget for Qt **
4 ** Copyright (C) 2011, 2012, 2013 Emanuel Eichhammer **
5 ** **
6 ** This program is free software: you can redistribute it and/or modify **
7 ** it under the terms of the GNU General Public License as published by **
8 ** the Free Software Foundation, either version 3 of the License, or **
9 ** (at your option) any later version. **
10 ** **
11 ** This program is distributed in the hope that it will be useful, **
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
14 ** GNU General Public License for more details. **
15 ** **
16 ** You should have received a copy of the GNU General Public License **
17 ** along with this program. If not, see http://www.gnu.org/licenses/. **
18 ** **
19 ****************************************************************************
20 ** Author: Emanuel Eichhammer **
21 ** Website/Contact: http://www.qcustomplot.com/ **
22 ** Date: 04.11.13 **
23 ** Version: 1.1.0 **
24 ****************************************************************************/
25 
26 #ifndef QCP_RANGE_H
27 #define QCP_RANGE_H
28 
29 #include "global.h"
30 
31 class QCP_LIB_DECL QCPRange
32 {
33 public:
34  double lower, upper;
35 
36  QCPRange();
37  QCPRange(double lower, double upper);
38 
39  double size() const;
40  double center() const;
41  void normalize();
42  void expand(const QCPRange &otherRange);
43  QCPRange expanded(const QCPRange &otherRange) const;
44  QCPRange sanitizedForLogScale() const;
45  QCPRange sanitizedForLinScale() const;
46  bool contains(double value) const;
47 
48  static bool validRange(double lower, double upper);
49  static bool validRange(const QCPRange &range);
50  static const double minRange; //1e-280;
51  static const double maxRange; //1e280;
52 };
53 Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE);
54 
55 #endif // QCP_RANGE_H