|
Revision 48, 1.0 KB
(checked in by mirko, 3 years ago)
|
|
simplistic makefile
|
| Line | |
|---|
| 1 | #ifndef __PDFCUBE__DOCUMENT_HH__ |
|---|
| 2 | #define __PDFCUBE__DOCUMENT_HH__ |
|---|
| 3 | |
|---|
| 4 | #include <vector> |
|---|
| 5 | #include <glib.h> |
|---|
| 6 | #include <poppler.h> |
|---|
| 7 | #include "page.hh" |
|---|
| 8 | |
|---|
| 9 | namespace pdfcube { |
|---|
| 10 | |
|---|
| 11 | /** |
|---|
| 12 | * @brief A document of pdfcube::page elements made from a |
|---|
| 13 | * PopplerDocument object. |
|---|
| 14 | */ |
|---|
| 15 | class document |
|---|
| 16 | { |
|---|
| 17 | public: |
|---|
| 18 | /** @brief Ctor. */ |
|---|
| 19 | document(PopplerDocument* doc) |
|---|
| 20 | : doc_m(doc), |
|---|
| 21 | page_m(poppler_document_get_n_pages(doc_m)) |
|---|
| 22 | { |
|---|
| 23 | for(int ii(0); ii != page_m.size(); ++ii) |
|---|
| 24 | page_m[ii] = new pdfcube::page(poppler_document_get_page(doc_m, ii)); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | /** |
|---|
| 28 | * @brief Returns ii-th page. |
|---|
| 29 | */ |
|---|
| 30 | pdfcube::page& |
|---|
| 31 | page(int ii) |
|---|
| 32 | { return *page_m[ii]; } |
|---|
| 33 | |
|---|
| 34 | /** |
|---|
| 35 | * @brief Returns ii-th page, const version. |
|---|
| 36 | */ |
|---|
| 37 | const pdfcube::page& |
|---|
| 38 | page(int ii) const |
|---|
| 39 | { return *page_m[ii]; } |
|---|
| 40 | |
|---|
| 41 | /** |
|---|
| 42 | * @brief Returns number of pages. |
|---|
| 43 | */ |
|---|
| 44 | int |
|---|
| 45 | n_pages() const |
|---|
| 46 | { return poppler_document_get_n_pages(doc_m); } |
|---|
| 47 | |
|---|
| 48 | protected: |
|---|
| 49 | PopplerDocument* doc_m; |
|---|
| 50 | std::vector<pdfcube::page*> page_m; |
|---|
| 51 | }; |
|---|
| 52 | } |
|---|
| 53 | |
|---|
| 54 | #endif |
|---|