From 72a71a2003028fc97d74cebecebb1541d66ded86 Mon Sep 17 00:00:00 2001 From: Javier Date: Sat, 13 Jun 2015 17:35:15 +0200 Subject: split afdpageaddress into new class --- afdnotebook.h | 50 +++++--------------------------------------------- 1 file changed, 5 insertions(+), 45 deletions(-) (limited to 'afdnotebook.h') diff --git a/afdnotebook.h b/afdnotebook.h index 737196e..74861ca 100644 --- a/afdnotebook.h +++ b/afdnotebook.h @@ -5,6 +5,7 @@ #include #include #include +#include "afdpageaddress.h" #include "stfreader.h" class AfdNotebook : public QObject @@ -15,26 +16,6 @@ public: AfdNotebook(QObject *parent = 0); ~AfdNotebook(); - struct PageAddress { - PageAddress(); - explicit PageAddress(uint shelf, uint segment, uint book, uint page); - explicit PageAddress(uint series, uint shelf, uint segment, uint book, uint page); - explicit PageAddress(quint64 addr); - explicit PageAddress(const QString &str); - - QString toString() const; - quint64 toUInt64() const; - - bool operator<(const PageAddress& o) const; - bool operator==(const PageAddress& o) const; - - uint series : 12; - uint shelf : 12; - uint segment : 16; - uint book : 12; - uint page : 12; - }; - bool open(const QString &path); void close(); @@ -43,6 +24,9 @@ public: int numPages() const; + AfdPageAddress getPageAddress(int pageNum) const; + int getPageNumber(const AfdPageAddress &addr) const; + QString getPageBackgroundName(int page) const; QPixmap getPageBackground(int page); @@ -85,39 +69,15 @@ private: bool parseGfx(const QString &file); bool findPenData(); - PageAddress getPageAddress(int page) const; - int getPageNumber(const PageAddress &addr); - private: QDir _dir; QString _title; quint64 _guid; - PageAddress _firstPage, _lastPage; + AfdPageAddress _firstPage, _lastPage; uint _pagesPerBook; QMap _gfx; QList _pages; QMap _penData; }; -inline AfdNotebook::PageAddress::PageAddress() - : series(0), shelf(0), segment(0), book(0), page(0) -{ -} - -inline AfdNotebook::PageAddress::PageAddress(uint shelf, uint segment, uint book, uint page) - : series(0), shelf(shelf), segment(segment), book(book), page(page) -{ -} - -inline AfdNotebook::PageAddress::PageAddress(uint series, uint shelf, uint segment, uint book, uint page) - : series(series), shelf(shelf), segment(segment), book(book), page(page) -{ -} - -inline bool AfdNotebook::PageAddress::operator ==(const PageAddress &o) const -{ - return series == o.series && shelf == o.shelf && segment == o.segment && - book == o.book && page == o.page; -} - #endif -- cgit v1.2.3