comparison src/xlsx/xlsxcellrange.h @ 1:93d3106bb9a4

Add qt xlsx library
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 22 Mar 2016 10:38:08 +0100
parents
children
comparison
equal deleted inserted replaced
0:49cd5cc0b072 1:93d3106bb9a4
1 /****************************************************************************
2 ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me>
3 ** All right reserved.
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining
6 ** a copy of this software and associated documentation files (the
7 ** "Software"), to deal in the Software without restriction, including
8 ** without limitation the rights to use, copy, modify, merge, publish,
9 ** distribute, sublicense, and/or sell copies of the Software, and to
10 ** permit persons to whom the Software is furnished to do so, subject to
11 ** the following conditions:
12 **
13 ** The above copyright notice and this permission notice shall be
14 ** included in all copies or substantial portions of the Software.
15 **
16 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 **
24 ****************************************************************************/
25 #ifndef QXLSX_XLSXCELLRANGE_H
26 #define QXLSX_XLSXCELLRANGE_H
27 #include "xlsxglobal.h"
28 #include "xlsxcellreference.h"
29
30 QT_BEGIN_NAMESPACE_XLSX
31
32 class Q_XLSX_EXPORT CellRange
33 {
34 public:
35 CellRange();
36 CellRange(int firstRow, int firstColumn, int lastRow, int lastColumn);
37 CellRange(const CellReference &topLeft, const CellReference &bottomRight);
38 CellRange(const QString &range);
39 CellRange(const char *range);
40 CellRange(const CellRange &other);
41 ~CellRange();
42
43 QString toString(bool row_abs=false, bool col_abs=false) const;
44 bool isValid() const;
45 inline void setFirstRow(int row) { top = row; }
46 inline void setLastRow(int row) { bottom = row; }
47 inline void setFirstColumn(int col) { left = col; }
48 inline void setLastColumn(int col) { right = col; }
49 inline int firstRow() const { return top; }
50 inline int lastRow() const { return bottom; }
51 inline int firstColumn() const { return left; }
52 inline int lastColumn() const { return right; }
53 inline int rowCount() const { return bottom - top + 1; }
54 inline int columnCount() const { return right - left + 1; }
55 inline CellReference topLeft() const { return CellReference(top, left); }
56 inline CellReference topRight() const { return CellReference(top, right); }
57 inline CellReference bottomLeft() const { return CellReference(bottom, left); }
58 inline CellReference bottomRight() const { return CellReference(bottom, right); }
59
60 inline bool operator ==(const CellRange &other) const
61 {
62 return top==other.top && bottom==other.bottom
63 && left == other.left && right == other.right;
64 }
65 inline bool operator !=(const CellRange &other) const
66 {
67 return top!=other.top || bottom!=other.bottom
68 || left != other.left || right != other.right;
69 }
70 private:
71 void init(const QString &range);
72 int top, left, bottom, right;
73 };
74
75 QT_END_NAMESPACE_XLSX
76
77 Q_DECLARE_TYPEINFO(QXlsx::CellRange, Q_MOVABLE_TYPE);
78
79 #endif // QXLSX_XLSXCELLRANGE_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)