Commit a750b8b9d07fd8935bf54191c0e87cd7679bfb9d
1 parent
4547613e
Move `QPDFXRefEntry` implementation from separate file to `QPDF_objects.cc` and …
…update `CMakeLists.txt` accordingly.
Showing
3 changed files
with
37 additions
and
45 deletions
libqpdf/CMakeLists.txt
| @@ -83,7 +83,6 @@ set(libqpdf_SOURCES | @@ -83,7 +83,6 @@ set(libqpdf_SOURCES | ||
| 83 | QPDFTokenizer.cc | 83 | QPDFTokenizer.cc |
| 84 | QPDFUsage.cc | 84 | QPDFUsage.cc |
| 85 | QPDFWriter.cc | 85 | QPDFWriter.cc |
| 86 | - QPDFXRefEntry.cc | ||
| 87 | QPDF_Array.cc | 86 | QPDF_Array.cc |
| 88 | QPDF_Dictionary.cc | 87 | QPDF_Dictionary.cc |
| 89 | QPDF_Stream.cc | 88 | QPDF_Stream.cc |
libqpdf/QPDFXRefEntry.cc deleted
| 1 | -#include <qpdf/QPDFXRefEntry.hh> | ||
| 2 | - | ||
| 3 | -#include <qpdf/QIntC.hh> | ||
| 4 | -#include <qpdf/QPDFExc.hh> | ||
| 5 | -#include <qpdf/Util.hh> | ||
| 6 | - | ||
| 7 | -using namespace qpdf; | ||
| 8 | - | ||
| 9 | -QPDFXRefEntry::QPDFXRefEntry() = default; | ||
| 10 | - | ||
| 11 | -QPDFXRefEntry::QPDFXRefEntry(int type, qpdf_offset_t field1, int field2) : | ||
| 12 | - type(type), | ||
| 13 | - field1(field1), | ||
| 14 | - field2(field2) | ||
| 15 | -{ | ||
| 16 | - util::assertion(type == 1 || type == 2, "invalid xref type " + std::to_string(type)); | ||
| 17 | -} | ||
| 18 | - | ||
| 19 | -int | ||
| 20 | -QPDFXRefEntry::getType() const | ||
| 21 | -{ | ||
| 22 | - return type; | ||
| 23 | -} | ||
| 24 | - | ||
| 25 | -qpdf_offset_t | ||
| 26 | -QPDFXRefEntry::getOffset() const | ||
| 27 | -{ | ||
| 28 | - util::assertion(type == 1, "getOffset called for xref entry of type != 1"); | ||
| 29 | - return this->field1; | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | -int | ||
| 33 | -QPDFXRefEntry::getObjStreamNumber() const | ||
| 34 | -{ | ||
| 35 | - util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2"); | ||
| 36 | - return QIntC::to_int(field1); | ||
| 37 | -} | ||
| 38 | - | ||
| 39 | -int | ||
| 40 | -QPDFXRefEntry::getObjStreamIndex() const | ||
| 41 | -{ | ||
| 42 | - util::assertion(type == 2, "getObjStreamIndex called for xref entry of type != 2"); | ||
| 43 | - return field2; | ||
| 44 | -} |
libqpdf/QPDF_objects.cc
| @@ -26,6 +26,43 @@ using namespace std::literals; | @@ -26,6 +26,43 @@ using namespace std::literals; | ||
| 26 | 26 | ||
| 27 | using Objects = QPDF::Doc::Objects; | 27 | using Objects = QPDF::Doc::Objects; |
| 28 | 28 | ||
| 29 | +QPDFXRefEntry::QPDFXRefEntry() = default; | ||
| 30 | + | ||
| 31 | +QPDFXRefEntry::QPDFXRefEntry(int type, qpdf_offset_t field1, int field2) : | ||
| 32 | + type(type), | ||
| 33 | + field1(field1), | ||
| 34 | + field2(field2) | ||
| 35 | +{ | ||
| 36 | + util::assertion(type == 1 || type == 2, "invalid xref type " + std::to_string(type)); | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +int | ||
| 40 | +QPDFXRefEntry::getType() const | ||
| 41 | +{ | ||
| 42 | + return type; | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +qpdf_offset_t | ||
| 46 | +QPDFXRefEntry::getOffset() const | ||
| 47 | +{ | ||
| 48 | + util::assertion(type == 1, "getOffset called for xref entry of type != 1"); | ||
| 49 | + return this->field1; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +int | ||
| 53 | +QPDFXRefEntry::getObjStreamNumber() const | ||
| 54 | +{ | ||
| 55 | + util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2"); | ||
| 56 | + return QIntC::to_int(field1); | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +int | ||
| 60 | +QPDFXRefEntry::getObjStreamIndex() const | ||
| 61 | +{ | ||
| 62 | + util::assertion(type == 2, "getObjStreamIndex called for xref entry of type != 2"); | ||
| 63 | + return field2; | ||
| 64 | +} | ||
| 65 | + | ||
| 29 | namespace | 66 | namespace |
| 30 | { | 67 | { |
| 31 | class InvalidInputSource: public InputSource | 68 | class InvalidInputSource: public InputSource |