xlsxcellreference.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // xlsxcellreference.h
  2. #ifndef QXLSX_XLSXCELLREFERENCE_H
  3. #define QXLSX_XLSXCELLREFERENCE_H
  4. #include "xlsxglobal.h"
  5. #include <QtGlobal>
  6. QT_BEGIN_NAMESPACE_XLSX
  7. class QXLSX_EXPORT CellReference
  8. {
  9. public:
  10. CellReference();
  11. CellReference(int row, int column);
  12. CellReference(const QString &cell);
  13. CellReference(const char *cell);
  14. CellReference(const CellReference &other);
  15. ~CellReference();
  16. QString toString(bool row_abs = false, bool col_abs = false) const;
  17. static CellReference fromString(const QString &cell);
  18. bool isValid() const;
  19. inline void setRow(int row) { _row = row; }
  20. inline void setColumn(int col) { _column = col; }
  21. inline int row() const { return _row; }
  22. inline int column() const { return _column; }
  23. inline bool operator==(const CellReference &other) const
  24. {
  25. return _row == other._row && _column == other._column;
  26. }
  27. inline bool operator!=(const CellReference &other) const
  28. {
  29. return _row != other._row || _column != other._column;
  30. }
  31. private:
  32. void init(const QString &cell);
  33. int _row, _column;
  34. };
  35. QT_END_NAMESPACE_XLSX
  36. Q_DECLARE_TYPEINFO(QXlsx::CellReference, Q_MOVABLE_TYPE);
  37. #endif // QXLSX_XLSXCELLREFERENCE_H