File indexing completed on 2024-06-23 03:45:56

0001 // xlsxcellreference.h
0002 
0003 #ifndef QXLSX_XLSXCELLREFERENCE_H
0004 #define QXLSX_XLSXCELLREFERENCE_H
0005 
0006 #include <QtGlobal>
0007 
0008 #include "xlsxglobal.h"
0009 
0010 QT_BEGIN_NAMESPACE_XLSX
0011 
0012 class QXLSX_EXPORT CellReference
0013 {
0014 public:
0015     CellReference();
0016     CellReference(int row, int column);
0017     CellReference(const QString &cell);
0018     CellReference(const char *cell);
0019     CellReference(const CellReference &other);
0020     ~CellReference();
0021 
0022     QString toString(bool row_abs=false, bool col_abs=false) const;
0023     static CellReference fromString(const QString &cell);
0024     bool isValid() const;
0025     inline void setRow(int row) { _row = row; }
0026     inline void setColumn(int col) { _column = col; }
0027     inline int row() const { return _row; }
0028     inline int column() const { return _column; }
0029 
0030     inline bool operator ==(const CellReference &other) const
0031     {
0032         return _row==other._row && _column==other._column;
0033     }
0034     inline bool operator !=(const CellReference &other) const
0035     {
0036         return _row!=other._row || _column!=other._column;
0037     }
0038 private:
0039     void init(const QString &cell);
0040     int _row, _column;
0041 };
0042 
0043 QT_END_NAMESPACE_XLSX
0044 
0045 Q_DECLARE_TYPEINFO(QXlsx::CellReference, Q_MOVABLE_TYPE);
0046 
0047 #endif // QXLSX_XLSXCELLREFERENCE_H