diff --git a/src/lib/FileChunkReference.h b/src/lib/FileChunkReference.h index 0fe90f1..af2045d 100644 --- a/src/lib/FileChunkReference.h +++ b/src/lib/FileChunkReference.h @@ -13,6 +13,7 @@ #include #include "libone_utils.h" + namespace libone { @@ -30,7 +31,6 @@ class FileChunkReference FileChunkReference(const enum FileChunkReferenceSize fcr_size); FileChunkReference(const uint64_t stp, const uint64_t cb, const enum FileChunkReferenceSize fcr_size = fcr_size_invalid); - void parse(const libone::RVNGInputStreamPtr_t &input); std::string to_string() const; uint64_t get_location() const; diff --git a/src/lib/FileDataStore.cpp b/src/lib/FileDataStore.cpp index c71e1c7..a0d3dab 100644 --- a/src/lib/FileDataStore.cpp +++ b/src/lib/FileDataStore.cpp @@ -18,12 +18,11 @@ namespace libone { - -void FileDataStore::parse(libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref) +void FileDataStore::parse(const libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref) { - FileNodeList list(ref.get_location(), ref.get_size()); + FileNodeList list(ref.stp(), ref.cb()); FileNode node; - input->seek(ref.get_location(), librevenge::RVNG_SEEK_SET); + input->seek(ref.stp(), librevenge::RVNG_SEEK_SET); list.parse(input); ONE_DEBUG_MSG(("\n")); diff --git a/src/lib/FileDataStore.h b/src/lib/FileDataStore.h index 9e7440e..515ecc9 100644 --- a/src/lib/FileDataStore.h +++ b/src/lib/FileDataStore.h @@ -21,7 +21,7 @@ class FileDataStore { public: - void parse(libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref); + void parse(const libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref); std::string to_string(); diff --git a/src/lib/FileNode.cpp b/src/lib/FileNode.cpp index 2d1b820..1c5beb9 100644 --- a/src/lib/FileNode.cpp +++ b/src/lib/FileNode.cpp @@ -19,9 +19,42 @@ #include #include "FileNode.h" +#include "FileNodeData/FileNodeData.h" namespace libone { +FileNode::FileNode() + : m_offset(0), m_size_in_file(0), m_header_size(0), m_fncr(), + m_fnd_id(FndId::fnd_invalid_id), + m_base_type(fnd_basetype::fnd_invalid_basetype), m_fnd(nullptr) {} + +FileNode::FileNode(const FileNode &source) + : m_offset(source.m_offset), m_size_in_file(source.m_size_in_file), + m_header_size(source.m_header_size), m_fncr(source.m_fncr), + m_fnd_id(source.m_fnd_id), m_base_type(source.m_base_type), + m_fnd(nullptr) +{ + m_fnd = source.m_fnd->clone(); +} + +FileNode &FileNode::operator=(const FileNode &source) +{ + if (this == &source) + { + return *this; + } + delete m_fnd; + + m_fnd = source.m_fnd->clone(); + + return *this; +} + + +FileNode::~FileNode() +{ + delete m_fnd; +} std::string fnd_id_to_string(FndId id_fnd) { @@ -95,78 +128,130 @@ void FileNode::parse(const libone::RVNGInputStreamPtr_t &input) { m_offset = input->tell(); - parse_header(input); + DBMSG << "Will parse at " << m_offset << std::endl; + + uint32_t temp; + StpFormat format_stp; + CbFormat format_cb; + + temp = readU32(input, false); + format_stp = static_cast((temp >> shift_format_stp) & mask_format_stp); + format_cb = static_cast((temp >> shift_format_cb) & mask_format_cb); + m_base_type = static_cast((temp >> shift_base_type) & mask_fnd_base_type); + m_fnd_id = static_cast(temp & mask_fnd_id); + m_size_in_file = (temp >> shift_fnd_size) & mask_fnd_size; + + m_fncr = FileNodeChunkReference(m_offset, m_size_in_file, format_stp, format_cb); switch (m_fnd_id) { - break; case FndId::DataSignatureGroupDefinitionFND: + m_fnd = new DataSignatureGroupDefinitionFND(); break; case FndId::FileDataStoreListReferenceFND: + m_fnd = new FileDataStoreListReferenceFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::FileDataStoreObjectReferenceFND: + m_fnd = new FileDataStoreObjectReferenceFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::GlobalIdTableEntry2FNDX: + m_fnd = new GlobalIdTableEntry2FNDX(); break; case FndId::GlobalIdTableEntry3FNDX: + m_fnd = new GlobalIdTableEntry3FNDX(); break; case FndId::GlobalIdTableEntryFNDX: + m_fnd = new GlobalIdTableEntryFNDX(); break; case FndId::GlobalIdTableStartFNDX: + m_fnd = new GlobalIdTableStartFNDX(); break; case FndId::HashedChunkDescriptor2FND: + m_fnd = new HashedChunkDescriptor2FND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectDataEncryptionKeyV2FNDX: + m_fnd = new ObjectDataEncryptionKeyV2FNDX(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectDeclaration2LargeRefCountFND: + m_fnd = + new ObjectDeclaration2LargeRefCountFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectDeclaration2RefCountFND: + m_fnd = new ObjectDeclaration2RefCountFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectDeclarationFileData3LargeRefCountFND: + m_fnd = new ObjectDeclarationFileData3LargeRefCountFND(); break; case FndId::ObjectDeclarationFileData3RefCountFND: + m_fnd = new ObjectDeclarationFileData3RefCountFND(); break; case FndId::ObjectDeclarationWithRefCount2FNDX: + m_fnd = + new ObjectDeclarationWithRefCount2FNDX(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectDeclarationWithRefCountFNDX: + m_fnd = + new ObjectDeclarationWithRefCountFNDX(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectGroupListReferenceFND: + m_fnd = new ObjectGroupListReferenceFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectGroupStartFND: + m_fnd = new ObjectGroupStartFND(); break; case FndId::ObjectInfoDependencyOverridesFND: + m_fnd = new ObjectInfoDependencyOverridesFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectRevisionWithRefCount2FNDX: + m_fnd = new ObjectRevisionWithRefCount2FNDX(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectRevisionWithRefCountFNDX: + m_fnd = new ObjectRevisionWithRefCountFNDX(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectSpaceManifestListReferenceFND: + m_fnd = + new ObjectSpaceManifestListReferenceFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::ObjectSpaceManifestListStartFND: + m_fnd = new ObjectSpaceManifestListStartFND(); break; case FndId::ObjectSpaceManifestRootFND: + m_fnd = new ObjectSpaceManifestRootFND(); break; case FndId::ReadOnlyObjectDeclaration2LargeRefCountFND: + m_fnd = new ReadOnlyObjectDeclaration2LargeRefCountFND(m_fncr.get_stp_fmt(), + m_fncr.get_cb_fmt()); break; case FndId::ReadOnlyObjectDeclaration2RefCountFND: + m_fnd = + new ReadOnlyObjectDeclaration2RefCountFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::RevisionManifestListReferenceFND: + m_fnd = new RevisionManifestListReferenceFND(m_fncr.get_stp_fmt(), m_fncr.get_cb_fmt()); break; case FndId::RevisionManifestListStartFND: + m_fnd = new RevisionManifestListStartFND(); break; case FndId::RevisionManifestStart4FND: + m_fnd = new RevisionManifestStart4FND(); break; case FndId::RevisionManifestStart6FND: + m_fnd = new RevisionManifestStart6FND(); break; case FndId::RevisionManifestStart7FND: + m_fnd = new RevisionManifestStart7FND(); break; case FndId::RevisionRoleAndContextDeclarationFND: + m_fnd = new RevisionRoleAndContextDeclarationFND(); break; case FndId::RevisionRoleDeclarationFND: + m_fnd = new RevisionRoleDeclarationFND(); break; case FndId::RootObjectReference2FNDX: + m_fnd = new RootObjectReference2FNDX(); break; case FndId::RootObjectReference3FND: + m_fnd = new RootObjectReference3FND(); break; // nodes without data @@ -178,9 +263,15 @@ void FileNode::parse(const libone::RVNGInputStreamPtr_t &input) break; case FndId::fnd_invalid_id: default: - assert(false); + m_fnd = nullptr; break; } + + if (m_fnd != nullptr) + { + input >> *m_fnd; + } + } std::string FileNode::to_string() @@ -189,6 +280,7 @@ std::string FileNode::to_string() stream << fnd_id_to_string(m_fnd_id); stream << "; "; + stream << "size " << m_size_in_file << "; "; stream << std::hex << "base_type "; switch (m_base_type) @@ -197,10 +289,10 @@ std::string FileNode::to_string() stream << "fnd_no_data"; break; case fnd_ref_data: - stream << "fnd_ref_data@0x" << m_fnd.get_location(); + stream << "fnd_ref_data@0x" << m_fncr.stp(); break; case fnd_ref_filenodelist: - stream << "fnd_ref_filenodelist@0x" << m_fnd.get_location(); + stream << "fnd_ref_filenodelist@0x" << m_fncr.stp(); break; default: stream << "UNKNOWN BASETYPE"; @@ -211,48 +303,6 @@ std::string FileNode::to_string() return stream.str(); } -void FileNode::parse_header(const libone::RVNGInputStreamPtr_t &input) -{ - uint32_t temp; - enum stp_format format_stp; - enum cb_format format_cb; - int d; - - temp = readU32(input, false); - d = temp >> 31; - format_stp = static_cast((temp >> shift_format_stp) & mask_format_stp); - format_cb = static_cast((temp >> shift_format_cb) & mask_format_cb); - m_base_type = static_cast((temp >> shift_base_type) & mask_fnd_base_type); - m_fnd_id = static_cast(temp & mask_fnd_id); - m_size_in_file = (temp >> shift_fnd_size) & mask_fnd_size; - if (d == 0) - { - std::bitset<13> z(m_size_in_file); - ONE_DEBUG_MSG(("%s\n", z.to_string().c_str())); - ONE_DEBUG_MSG(("warning: d is zero\n")); - } - assert(d == 1); - FileNodeChunkReference reference(format_stp, format_cb, input->tell()); - - std::bitset<32> y(temp); - ONE_DEBUG_MSG((" filenode bits %s\n", y.to_string().c_str())); - switch (m_base_type) - { - case fnd_ref_data: - case fnd_ref_filenodelist: - reference.parse(input); - ONE_DEBUG_MSG(("\n")); - break; - case fnd_no_data: - reference.set_zero(); - break; - default: - assert(false); - break; - } - m_fnd = reference; -} - void FileNode::skip_node(const libone::RVNGInputStreamPtr_t &input) { DBMSG << "Skipping file node by jumping over " << m_size_in_file << " bytes to " << m_offset + m_size_in_file << std::endl; diff --git a/src/lib/FileNode.h b/src/lib/FileNode.h index 0b1d87b..b644d4b 100644 --- a/src/lib/FileNode.h +++ b/src/lib/FileNode.h @@ -10,9 +10,12 @@ #ifndef INCLUDED_LIBONE_FILENODE_H #define INCLUDED_LIBONE_FILENODE_H + +#include "FileNodeData/FileNodeData.h" #include "FileNodeChunkReference.h" #include + #include "libone_utils.h" @@ -68,7 +71,7 @@ enum class FndId ReadOnlyObjectDeclaration2RefCountFND = 0x0C4, ReadOnlyObjectDeclaration2LargeRefCountFND = 0x0F5, ChunkTerminatorFND = 0x0FF, - fnd_invalid_id + fnd_invalid_id = 0x0 }; std::string fnd_id_to_string(FndId id_fnd); @@ -76,6 +79,11 @@ std::string fnd_id_to_string(FndId id_fnd); class FileNode { public: + + FileNode(); + FileNode(const FileNode &source); + FileNode &operator=(const FileNode &source); + ~FileNode(); void parse(const libone::RVNGInputStreamPtr_t &input); std::string to_string(); @@ -93,10 +101,16 @@ class FileNode { return m_base_type; } - FileNodeChunkReference get_fnd() + + IFileNodeData *get_fnd() { return m_fnd; } + + FileNodeChunkReference fncr() const + { + return m_fncr; + } uint32_t get_location() { return m_offset; @@ -108,10 +122,10 @@ class FileNode uint32_t m_size_in_file = 0; uint32_t m_header_size = 0; + FileNodeChunkReference m_fncr = FileNodeChunkReference(); FndId m_fnd_id = FndId::fnd_invalid_id; enum fnd_basetype m_base_type = fnd_invalid_basetype; - void parse_header(const libone::RVNGInputStreamPtr_t &input); - FileNodeChunkReference m_fnd = FileNodeChunkReference(stp_invalid, cb_invalid, 0); + IFileNodeData *m_fnd = nullptr; static const uint32_t mask_fnd_id = 0x3FF; static const uint32_t mask_fnd_base_type = 0xF; diff --git a/src/lib/FileNodeChunkReference.cpp b/src/lib/FileNodeChunkReference.cpp index ea92976..05da336 100644 --- a/src/lib/FileNodeChunkReference.cpp +++ b/src/lib/FileNodeChunkReference.cpp @@ -15,27 +15,35 @@ namespace libone { -FileNodeChunkReference::FileNodeChunkReference(enum stp_format format_stp, enum cb_format format_cb, long offset) : - m_offset(offset), +FileNodeChunkReference::FileNodeChunkReference(const StpFormat format_stp, const CbFormat format_cb) : + m_offset(0), m_stp(0), m_cb(0), m_format_stp(format_stp), m_format_cb(format_cb) {} +FileNodeChunkReference::FileNodeChunkReference(const uint64_t stp, const uint64_t cb, const StpFormat format_stp, const CbFormat format_cb) : + m_offset(0), + m_stp(stp), + m_cb(cb), + m_format_stp(format_stp), + m_format_cb(format_cb) +{} + bool FileNodeChunkReference::is_fcrNil() { bool cbval = (m_cb == 0); switch (m_format_stp) { - case stp_uncompressed_8: + case StpFormat::stp_uncompressed_8: return (cbval && (m_stp & 0xFFFFFFFFFFFFFFFF)); - case stp_uncompressed_4: - case stp_compressed_4: + case StpFormat::stp_uncompressed_4: + case StpFormat::stp_compressed_4: return (cbval && (m_stp & 0xFFFFFFFF)); - case stp_compressed_2: + case StpFormat::stp_compressed_2: return (cbval && (m_stp & 0xFFFF)); default: @@ -48,32 +56,22 @@ bool FileNodeChunkReference::is_fcrZero() return ((m_stp == 0) && (m_cb == 0)); } -uint64_t FileNodeChunkReference::get_location() -{ - return m_stp; -} - -uint64_t FileNodeChunkReference::get_size() -{ - return m_cb; -} - uint32_t FileNodeChunkReference::get_size_in_file() { uint32_t ret = 0; switch (m_format_stp) { - case stp_uncompressed_8: + case StpFormat::stp_uncompressed_8: ret += sizeof(uint64_t); break; - case stp_uncompressed_4: - case stp_compressed_4: + case StpFormat::stp_uncompressed_4: + case StpFormat::stp_compressed_4: ret += sizeof(uint32_t); break; - case stp_compressed_2: + case StpFormat::stp_compressed_2: ret += sizeof(uint16_t); break; - case stp_invalid: + case StpFormat::stp_invalid: default: // size would be 0 break; @@ -81,19 +79,19 @@ uint32_t FileNodeChunkReference::get_size_in_file() switch (m_format_cb) { - case cb_uncompressed_8: + case CbFormat::cb_uncompressed_8: ret += sizeof(uint64_t); break; - case cb_uncompressed_4: + case CbFormat::cb_uncompressed_4: ret += sizeof(uint32_t); break; - case cb_compressed_2: + case CbFormat::cb_compressed_2: ret += sizeof(uint16_t); break; - case cb_compressed_1: + case CbFormat::cb_compressed_1: ret += sizeof(uint8_t); break; - case cb_invalid: + case CbFormat::cb_invalid: default: // size would be 0 break; @@ -102,25 +100,42 @@ uint32_t FileNodeChunkReference::get_size_in_file() return ret; } +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference &obj) +{ + obj.parse(input); + return input; +} + + +void FileNodeChunkReference::parse(const libone::RVNGInputStreamPtr_t &input, const uint64_t offset) +{ + const uint64_t origLocation = input->tell(); + input->seek(offset, librevenge::RVNG_SEEK_SET); + + parse(input); + + input->seek(origLocation, librevenge::RVNG_SEEK_SET); +} + void FileNodeChunkReference::parse(const libone::RVNGInputStreamPtr_t &input) { - input->seek(m_offset, librevenge::RVNG_SEEK_SET); + m_offset = input->tell(); switch (m_format_stp) { - case stp_uncompressed_8: + case StpFormat::stp_uncompressed_8: m_stp = readU64(input, false); break; - case stp_uncompressed_4: + case StpFormat::stp_uncompressed_4: m_stp = readU32(input, false); break; - case stp_compressed_2: + case StpFormat::stp_compressed_2: m_stp = readU16(input, false) * 8; break; - case stp_compressed_4: + case StpFormat::stp_compressed_4: m_stp = readU32(input, false) * 8; break; - case stp_invalid: + case StpFormat::stp_invalid: default: assert(false); break; @@ -128,19 +143,19 @@ void FileNodeChunkReference::parse(const libone::RVNGInputStreamPtr_t &input) switch (m_format_cb) { - case cb_uncompressed_4: + case CbFormat::cb_uncompressed_4: m_cb = readU32(input, false); break; - case cb_uncompressed_8: + case CbFormat::cb_uncompressed_8: m_cb = readU64(input, false); break; - case cb_compressed_1: + case CbFormat::cb_compressed_1: m_cb = readU8(input) * 8; break; - case cb_compressed_2: - m_cb = readU16(input, false); + case CbFormat::cb_compressed_2: + m_cb = readU16(input, false) * 8; break; - case cb_invalid: + case CbFormat::cb_invalid: default: assert(false); break; @@ -153,8 +168,8 @@ void FileNodeChunkReference::set_zero() { m_stp = 0; m_cb = 0; - m_format_stp = stp_invalid; - m_format_cb = cb_invalid; + m_format_stp = StpFormat::stp_invalid; + m_format_cb = CbFormat::cb_invalid; } } diff --git a/src/lib/FileNodeChunkReference.h b/src/lib/FileNodeChunkReference.h index de9e531..48d24de 100644 --- a/src/lib/FileNodeChunkReference.h +++ b/src/lib/FileNodeChunkReference.h @@ -17,7 +17,7 @@ namespace libone { -enum stp_format +enum class StpFormat { stp_uncompressed_8 = 0, stp_uncompressed_4 = 1, @@ -26,7 +26,7 @@ enum stp_format stp_invalid }; -enum cb_format +enum class CbFormat { cb_uncompressed_4 = 0, cb_uncompressed_8 = 1, @@ -38,19 +38,28 @@ enum cb_format class FileNodeChunkReference { public: - FileNodeChunkReference(enum stp_format format_stp, enum cb_format format_cb, long offset); + FileNodeChunkReference(const StpFormat format_stp = StpFormat::stp_invalid, const CbFormat format_cb = CbFormat::cb_invalid); + FileNodeChunkReference(const uint64_t stp, const uint64_t cb, const StpFormat format_stp = StpFormat::stp_uncompressed_8, const CbFormat format_cb = CbFormat::cb_uncompressed_8); bool is_fcrNil(); bool is_fcrZero(); - uint64_t get_location(); - uint64_t get_size(); + uint64_t stp() const + { + return m_stp; + } + uint64_t cb() const + { + return m_cb; + } uint32_t get_size_in_file(); + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference &obj); void parse(const libone::RVNGInputStreamPtr_t &input); + void parse(const libone::RVNGInputStreamPtr_t &input, const uint64_t offset); void set_zero(); - enum stp_format get_stp_fmt() + StpFormat get_stp_fmt() { return m_format_stp; } - enum cb_format get_cb_fmt() + CbFormat get_cb_fmt() { return m_format_cb; } @@ -59,8 +68,8 @@ class FileNodeChunkReference uint64_t m_offset; uint64_t m_stp; uint64_t m_cb; - enum stp_format m_format_stp; - enum cb_format m_format_cb; + StpFormat m_format_stp; + CbFormat m_format_cb; }; } diff --git a/src/lib/FileNodeData/DataSignatureGroupDefinitionFND.cpp b/src/lib/FileNodeData/DataSignatureGroupDefinitionFND.cpp new file mode 100644 index 0000000..c8c1e23 --- /dev/null +++ b/src/lib/FileNodeData/DataSignatureGroupDefinitionFND.cpp @@ -0,0 +1,31 @@ +#include "DataSignatureGroupDefinitionFND.h" + +namespace libone +{ + +DataSignatureGroupDefinitionFND::DataSignatureGroupDefinitionFND() + : m_dataSignatureGroup() +{} + +ExtendedGUID DataSignatureGroupDefinitionFND::dataSignatureGroup() const +{ + return m_dataSignatureGroup; +} + +void DataSignatureGroupDefinitionFND::setDataSignatureGroup(const ExtendedGUID &DataSignatureGroup) +{ + m_dataSignatureGroup = DataSignatureGroup; +} + + +void DataSignatureGroupDefinitionFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_dataSignatureGroup; +} + +std::string DataSignatureGroupDefinitionFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/DataSignatureGroupDefinitionFND.h b/src/lib/FileNodeData/DataSignatureGroupDefinitionFND.h new file mode 100644 index 0000000..1675481 --- /dev/null +++ b/src/lib/FileNodeData/DataSignatureGroupDefinitionFND.h @@ -0,0 +1,33 @@ +#ifndef DATASIGNATUREGROUPDEFINITIONFND_H +#define DATASIGNATUREGROUPDEFINITIONFND_H + +#include "../ExtendedGUID.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class DataSignatureGroupDefinitionFND : public IFileNodeData +{ +private: + ExtendedGUID m_dataSignatureGroup; +public: + DataSignatureGroupDefinitionFND(); + + ExtendedGUID dataSignatureGroup() const; + void setDataSignatureGroup(const ExtendedGUID &DataSignatureGroup); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new DataSignatureGroupDefinitionFND(*this); + } + +}; + +} // namespace libone + +#endif // DATASIGNATUREGROUPDEFINITIONFND_H diff --git a/src/lib/FileNodeData/FileDataStoreListReferenceFND.cpp b/src/lib/FileNodeData/FileDataStoreListReferenceFND.cpp new file mode 100644 index 0000000..d45e1af --- /dev/null +++ b/src/lib/FileNodeData/FileDataStoreListReferenceFND.cpp @@ -0,0 +1,33 @@ +#include "FileDataStoreListReferenceFND.h" + +namespace libone +{ + +FileDataStoreListReferenceFND::FileDataStoreListReferenceFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref(stpFormat, cbFormat) {} + +FileDataStoreListReferenceFND::~FileDataStoreListReferenceFND() {} + +FileNodeChunkReference FileDataStoreListReferenceFND::getRef() const +{ + return m_ref; +} + +void FileDataStoreListReferenceFND::setRef( + const FileNodeChunkReference &value) +{ + m_ref = value; +} + +void FileDataStoreListReferenceFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; +} + +std::string FileDataStoreListReferenceFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/FileDataStoreListReferenceFND.h b/src/lib/FileNodeData/FileDataStoreListReferenceFND.h new file mode 100644 index 0000000..81af968 --- /dev/null +++ b/src/lib/FileNodeData/FileDataStoreListReferenceFND.h @@ -0,0 +1,33 @@ +#ifndef FILEDATASTORELISTREFERENCEFND_H +#define FILEDATASTORELISTREFERENCEFND_H + +#include "../FileNodeChunkReference.h" +#include "IFileNodeData.h" +namespace libone +{ + +class FileDataStoreListReferenceFND : public IFileNodeData +{ +private: + FileNodeChunkReference m_ref; + +public: + FileDataStoreListReferenceFND(StpFormat stpFormat, CbFormat cbFormat); + ~FileDataStoreListReferenceFND(); + + FileNodeChunkReference getRef() const; + void setRef(const FileNodeChunkReference &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new FileDataStoreListReferenceFND(*this); + } +}; + +} // namespace libone + +#endif // FILEDATASTORELISTREFERENCEFND_H diff --git a/src/lib/FileNodeData/FileDataStoreObjectReferenceFND.cpp b/src/lib/FileNodeData/FileDataStoreObjectReferenceFND.cpp new file mode 100644 index 0000000..c79afa8 --- /dev/null +++ b/src/lib/FileNodeData/FileDataStoreObjectReferenceFND.cpp @@ -0,0 +1,44 @@ +#include "FileDataStoreObjectReferenceFND.h" + +namespace libone +{ + +FileDataStoreObjectReferenceFND::FileDataStoreObjectReferenceFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref(stpFormat, cbFormat) {} + +FileDataStoreObjectReferenceFND::~FileDataStoreObjectReferenceFND() {} + +FileNodeChunkReference FileDataStoreObjectReferenceFND::getRef() const +{ + return m_ref; +} + +void FileDataStoreObjectReferenceFND::setRef( + const FileNodeChunkReference &value) +{ + m_ref = value; +} + +libone::GUID FileDataStoreObjectReferenceFND::getGuidReference() const +{ + return m_guidReference; +} + +void FileDataStoreObjectReferenceFND::setGuidReference(const GUID &value) +{ + m_guidReference = value; +} + +void FileDataStoreObjectReferenceFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; + input >> m_guidReference; +} + +std::string FileDataStoreObjectReferenceFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/FileDataStoreObjectReferenceFND.h b/src/lib/FileNodeData/FileDataStoreObjectReferenceFND.h new file mode 100644 index 0000000..105aa57 --- /dev/null +++ b/src/lib/FileNodeData/FileDataStoreObjectReferenceFND.h @@ -0,0 +1,40 @@ +#ifndef FILEDATASTOREOBJECTREFERENCEFND_H +#define FILEDATASTOREOBJECTREFERENCEFND_H + +#include "../FileNodeChunkReference.h" +#include "../GUID.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class FileDataStoreObjectReferenceFND : public IFileNodeData +{ +private: + FileNodeChunkReference m_ref; + GUID m_guidReference {}; + +public: + FileDataStoreObjectReferenceFND(StpFormat stpFormat, + CbFormat cbFormat); + ~FileDataStoreObjectReferenceFND(); + + FileNodeChunkReference getRef() const; + void setRef(const FileNodeChunkReference &value); + + libone::GUID getGuidReference() const; + void setGuidReference(const GUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new FileDataStoreObjectReferenceFND(*this); + } +}; + +} // namespace libone + +#endif // FILEDATASTOREOBJECTREFERENCEFND_H diff --git a/src/lib/FileNodeData/FileNodeData.h b/src/lib/FileNodeData/FileNodeData.h new file mode 100644 index 0000000..2cd1471 --- /dev/null +++ b/src/lib/FileNodeData/FileNodeData.h @@ -0,0 +1,43 @@ +#ifndef FILENODEDATA_H +#define FILENODEDATA_H + + +#include "IFileNodeData.h" + +#include "DataSignatureGroupDefinitionFND.h" +#include "FileDataStoreListReferenceFND.h" +#include "FileDataStoreObjectReferenceFND.h" +#include "GlobalIdTableEntry2FNDX.h" +#include "GlobalIdTableEntry3FNDX.h" +#include "GlobalIdTableEntryFNDX.h" +#include "GlobalIdTableStartFNDX.h" +#include "HashedChunkDescriptor2FND.h" +#include "ObjectDataEncryptionKeyV2FNDX.h" +#include "ObjectDeclaration2LargeRefCountFND.h" +#include "ObjectDeclaration2RefCountFND.h" +#include "ObjectDeclarationFileData3LargeRefCountFND.h" +#include "ObjectDeclarationFileData3RefCountFND.h" +#include "ObjectDeclarationWithRefCount2FNDX.h" +#include "ObjectDeclarationWithRefCountFNDX.h" +#include "ObjectGroupListReferenceFND.h" +#include "ObjectGroupStartFND.h" +#include "ObjectInfoDependencyOverridesFND.h" +#include "ObjectRevisionWithRefCount2FNDX.h" +#include "ObjectRevisionWithRefCountFNDX.h" +#include "ObjectSpaceManifestListReferenceFND.h" +#include "ObjectSpaceManifestListStartFND.h" +#include "ObjectSpaceManifestRootFND.h" +#include "ReadOnlyObjectDeclaration2LargeRefCountFND.h" +#include "ReadOnlyObjectDeclaration2RefCountFND.h" +#include "RevisionManifestListReferenceFND.h" +#include "RevisionManifestListStartFND.h" +#include "RevisionManifestStart4FND.h" +#include "RevisionManifestStart6FND.h" +#include "RevisionManifestStart7FND.h" +#include "RevisionRoleAndContextDeclarationFND.h" +#include "RevisionRoleDeclarationFND.h" +#include "RootObjectReference2FNDX.h" +#include "RootObjectReference3FND.h" + + +#endif // FILENODEDATA_H diff --git a/src/lib/FileNodeData/GlobalIdTableEntry2FNDX.cpp b/src/lib/FileNodeData/GlobalIdTableEntry2FNDX.cpp new file mode 100644 index 0000000..191218e --- /dev/null +++ b/src/lib/FileNodeData/GlobalIdTableEntry2FNDX.cpp @@ -0,0 +1,42 @@ +#include "GlobalIdTableEntry2FNDX.h" + +#include "../libone_utils.h" + +namespace libone +{ + +GlobalIdTableEntry2FNDX::GlobalIdTableEntry2FNDX() + : m_iIndexMapFrom{0}, m_iIndexMapTo{0} {} + +uint32_t GlobalIdTableEntry2FNDX::getIIndexMapFrom() const +{ + return m_iIndexMapFrom; +} + +void GlobalIdTableEntry2FNDX::setIIndexMapFrom(const uint32_t &value) +{ + m_iIndexMapFrom = value; +} + +uint32_t GlobalIdTableEntry2FNDX::getIIndexMapTo() const +{ + return m_iIndexMapTo; +} + +void GlobalIdTableEntry2FNDX::setIIndexMapTo(const uint32_t &value) +{ + m_iIndexMapTo = value; +} + +void GlobalIdTableEntry2FNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_iIndexMapFrom; + input >> m_iIndexMapTo; +} + +std::string GlobalIdTableEntry2FNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/GlobalIdTableEntry2FNDX.h b/src/lib/FileNodeData/GlobalIdTableEntry2FNDX.h new file mode 100644 index 0000000..75ab749 --- /dev/null +++ b/src/lib/FileNodeData/GlobalIdTableEntry2FNDX.h @@ -0,0 +1,38 @@ +#ifndef GLOBALIDTABLEENTRY2FNDX_H +#define GLOBALIDTABLEENTRY2FNDX_H + +#include "IFileNodeData.h" + +namespace libone +{ + +class GlobalIdTableEntry2FNDX : public IFileNodeData +{ +private: + uint32_t m_iIndexMapFrom; + + uint32_t m_iIndexMapTo; +public: + GlobalIdTableEntry2FNDX(); + + + + uint32_t getIIndexMapTo() const; + void setIIndexMapTo(const uint32_t &value); + + uint32_t getIIndexMapFrom() const; + void setIIndexMapFrom(const uint32_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new GlobalIdTableEntry2FNDX(*this); + } +}; + +} // namespace libone + +#endif // GLOBALIDTABLEENTRY2FNDX_H diff --git a/src/lib/FileNodeData/GlobalIdTableEntry3FNDX.cpp b/src/lib/FileNodeData/GlobalIdTableEntry3FNDX.cpp new file mode 100644 index 0000000..7563369 --- /dev/null +++ b/src/lib/FileNodeData/GlobalIdTableEntry3FNDX.cpp @@ -0,0 +1,52 @@ +#include "GlobalIdTableEntry3FNDX.h" + +namespace libone +{ + +GlobalIdTableEntry3FNDX::GlobalIdTableEntry3FNDX() + : m_iIndexCopyFromStart{0}, m_cEntriesToCopy{0}, m_iIndexCopyToStart{0} {} + +uint32_t GlobalIdTableEntry3FNDX::getIIndexCopyFromStart() const +{ + return m_iIndexCopyFromStart; +} + +void GlobalIdTableEntry3FNDX::setIIndexCopyFromStart(const uint32_t &value) +{ + m_iIndexCopyFromStart = value; +} + +uint32_t GlobalIdTableEntry3FNDX::getCEntriesToCopy() const +{ + return m_cEntriesToCopy; +} + +void GlobalIdTableEntry3FNDX::setCEntriesToCopy(const uint32_t &value) +{ + m_cEntriesToCopy = value; +} + +uint32_t GlobalIdTableEntry3FNDX::getIIndexCopyToStart() const +{ + return m_iIndexCopyToStart; +} + +void GlobalIdTableEntry3FNDX::setIIndexCopyToStart(const uint32_t &value) +{ + m_iIndexCopyToStart = value; +} + +void GlobalIdTableEntry3FNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_iIndexCopyFromStart; + input >> m_cEntriesToCopy; + input >> m_iIndexCopyToStart; +} + +std::string GlobalIdTableEntry3FNDX::to_string() const +{ + return ""; +} + + +} //namespace libone diff --git a/src/lib/FileNodeData/GlobalIdTableEntry3FNDX.h b/src/lib/FileNodeData/GlobalIdTableEntry3FNDX.h new file mode 100644 index 0000000..babc606 --- /dev/null +++ b/src/lib/FileNodeData/GlobalIdTableEntry3FNDX.h @@ -0,0 +1,40 @@ +#ifndef GLOBALIDTABLEENTRY3FNDX_H +#define GLOBALIDTABLEENTRY3FNDX_H + +#include "IFileNodeData.h" + +namespace libone +{ + +class GlobalIdTableEntry3FNDX : public IFileNodeData +{ +private: + uint32_t m_iIndexCopyFromStart; + uint32_t m_cEntriesToCopy; + uint32_t m_iIndexCopyToStart; + +public: + GlobalIdTableEntry3FNDX(); + + + + uint32_t getIIndexCopyFromStart() const; + void setIIndexCopyFromStart(const uint32_t &value); + uint32_t getCEntriesToCopy() const; + void setCEntriesToCopy(const uint32_t &value); + uint32_t getIIndexCopyToStart() const; + void setIIndexCopyToStart(const uint32_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new GlobalIdTableEntry3FNDX(*this); + } +}; + +} // namespace libone + +#endif // GLOBALIDTABLEENTRY3FNDX_H diff --git a/src/lib/FileNodeData/GlobalIdTableEntryFNDX.cpp b/src/lib/FileNodeData/GlobalIdTableEntryFNDX.cpp new file mode 100644 index 0000000..1733023 --- /dev/null +++ b/src/lib/FileNodeData/GlobalIdTableEntryFNDX.cpp @@ -0,0 +1,39 @@ +#include "GlobalIdTableEntryFNDX.h" + +namespace libone +{ + +GlobalIdTableEntryFNDX::GlobalIdTableEntryFNDX() : m_index{0}, m_guid() {} + +GUID GlobalIdTableEntryFNDX::getGuid() const +{ + return m_guid; +} + +void GlobalIdTableEntryFNDX::setGuid(const GUID &value) +{ + m_guid = value; +} + +uint32_t GlobalIdTableEntryFNDX::getIndex() const +{ + return m_index; +} + +void GlobalIdTableEntryFNDX::setIndex(const uint32_t &value) +{ + m_index = value; +} + +void GlobalIdTableEntryFNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_index; + input >> m_guid; +} + +std::string GlobalIdTableEntryFNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/GlobalIdTableEntryFNDX.h b/src/lib/FileNodeData/GlobalIdTableEntryFNDX.h new file mode 100644 index 0000000..f0c113b --- /dev/null +++ b/src/lib/FileNodeData/GlobalIdTableEntryFNDX.h @@ -0,0 +1,37 @@ +#ifndef GLOBALIDTABLEENTRYFNDX_H +#define GLOBALIDTABLEENTRYFNDX_H + +#include "../GUID.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class GlobalIdTableEntryFNDX : public IFileNodeData +{ +private: + uint32_t m_index; + + GUID m_guid; +public: + GlobalIdTableEntryFNDX(); + + uint32_t getIndex() const; + void setIndex(const uint32_t &value); + + GUID getGuid() const; + void setGuid(const GUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new GlobalIdTableEntryFNDX(*this); + } +}; + +} //namespace libone + +#endif // GLOBALIDTABLEENTRYFNDX_H diff --git a/src/lib/FileNodeData/GlobalIdTableStartFNDX.cpp b/src/lib/FileNodeData/GlobalIdTableStartFNDX.cpp new file mode 100644 index 0000000..5ea153d --- /dev/null +++ b/src/lib/FileNodeData/GlobalIdTableStartFNDX.cpp @@ -0,0 +1,28 @@ +#include "GlobalIdTableStartFNDX.h" + +namespace libone +{ + +GlobalIdTableStartFNDX::GlobalIdTableStartFNDX() : m_reserved{0} {} + +uint8_t GlobalIdTableStartFNDX::getReserved() const +{ + return m_reserved; +} + +void GlobalIdTableStartFNDX::setReserved(const uint8_t &value) +{ + m_reserved = value; +} + +void GlobalIdTableStartFNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_reserved; +} + +std::string GlobalIdTableStartFNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/GlobalIdTableStartFNDX.h b/src/lib/FileNodeData/GlobalIdTableStartFNDX.h new file mode 100644 index 0000000..39fab96 --- /dev/null +++ b/src/lib/FileNodeData/GlobalIdTableStartFNDX.h @@ -0,0 +1,31 @@ +#ifndef GLOBALIDTABLESTARTFNDX_H +#define GLOBALIDTABLESTARTFNDX_H + +#include "IFileNodeData.h" + +namespace libone +{ + +class GlobalIdTableStartFNDX : public IFileNodeData +{ +private: + uint8_t m_reserved; +public: + GlobalIdTableStartFNDX(); + + uint8_t getReserved() const; + void setReserved(const uint8_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new GlobalIdTableStartFNDX(*this); + } + +}; + +} // namespace libone +#endif // GLOBALIDTABLESTARTFNDX_H diff --git a/src/lib/FileNodeData/HashedChunkDescriptor2FND.cpp b/src/lib/FileNodeData/HashedChunkDescriptor2FND.cpp new file mode 100644 index 0000000..0cbbe7f --- /dev/null +++ b/src/lib/FileNodeData/HashedChunkDescriptor2FND.cpp @@ -0,0 +1,52 @@ +#include "HashedChunkDescriptor2FND.h" + +#include + +namespace libone +{ +HashedChunkDescriptor2FND::HashedChunkDescriptor2FND(StpFormat stpFormat, + CbFormat cbFormat) + : m_BlobRef(stpFormat, cbFormat) {} + +HashedChunkDescriptor2FND::HashedChunkDescriptor2FND(const HashedChunkDescriptor2FND &source) + : m_BlobRef(source.BlobRef()), m_guidHash(source.m_guidHash) +{ +} + +FileNodeChunkReference HashedChunkDescriptor2FND::BlobRef() const +{ + return m_BlobRef; +} + +void HashedChunkDescriptor2FND::setBlobRef( + const FileNodeChunkReference &BlobRef) +{ + m_BlobRef = BlobRef; +} + +std::array HashedChunkDescriptor2FND::guidHash() const +{ + return m_guidHash; +} + +void HashedChunkDescriptor2FND::setGuidHash(std::array guidHash) +{ + m_guidHash = guidHash; +} + + + +void HashedChunkDescriptor2FND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_BlobRef; + const unsigned char *temp= readNBytes(input, m_guidHash_length); + + std::copy_n(temp, m_guidHash_length, std::begin(m_guidHash)); +} + +std::string HashedChunkDescriptor2FND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/HashedChunkDescriptor2FND.h b/src/lib/FileNodeData/HashedChunkDescriptor2FND.h new file mode 100644 index 0000000..69dac78 --- /dev/null +++ b/src/lib/FileNodeData/HashedChunkDescriptor2FND.h @@ -0,0 +1,43 @@ +#ifndef HASHEDCHUNKDESCRIPTOR2FND_H +#define HASHEDCHUNKDESCRIPTOR2FND_H + +#include + +#include "../FileNodeChunkReference.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class HashedChunkDescriptor2FND : public IFileNodeData +{ +private: + FileNodeChunkReference m_BlobRef; + + std::array m_guidHash {}; + uint8_t m_guidHash_length = 16; + +public: + HashedChunkDescriptor2FND(StpFormat stpFormat, CbFormat cbFormat); + HashedChunkDescriptor2FND(const HashedChunkDescriptor2FND &source); + + FileNodeChunkReference BlobRef() const; + void setBlobRef(const FileNodeChunkReference &BlobRef); + + std::array guidHash() const; + void setGuidHash(const std::array guidHash); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new HashedChunkDescriptor2FND(*this); + } + +}; + +} // namespace libone + +#endif // HASHEDCHUNKDESCRIPTOR2FND_H diff --git a/src/lib/FileNodeData/IFileNodeData.cpp b/src/lib/FileNodeData/IFileNodeData.cpp new file mode 100644 index 0000000..7bda5fc --- /dev/null +++ b/src/lib/FileNodeData/IFileNodeData.cpp @@ -0,0 +1,23 @@ +#include "IFileNodeData.h" + +namespace libone +{ +IFileNodeData::IFileNodeData() {} + +IFileNodeData::~IFileNodeData() {} + +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, IFileNodeData &obj) +{ + obj.parse(input); + return input; +} + +std::stringstream &operator<<(std::stringstream &input, IFileNodeData &obj) +{ + input << obj.to_string(); + return input; +} + +} // namespace libone + +/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/src/lib/FileNodeData/IFileNodeData.h b/src/lib/FileNodeData/IFileNodeData.h new file mode 100644 index 0000000..16657ff --- /dev/null +++ b/src/lib/FileNodeData/IFileNodeData.h @@ -0,0 +1,35 @@ +#ifndef IFILENODEDATA_H +#define IFILENODEDATA_H + +#include +#include + +#include "../libone_utils.h" + +namespace libone +{ +class IFileNodeData +{ +protected: + IFileNodeData(); + +public: + virtual ~IFileNodeData(); + + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, IFileNodeData &obj); + friend std::stringstream &operator<<(std::stringstream &input, IFileNodeData &obj); + + virtual void parse(const libone::RVNGInputStreamPtr_t &input) = 0; + + virtual std::string to_string() const = 0; + + virtual IFileNodeData *clone() const = 0; + +}; + + +} // namespace libone + +#endif // IFILENODEDATA_H + +/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/src/lib/FileNodeData/ObjectDataEncryptionKeyV2FNDX.cpp b/src/lib/FileNodeData/ObjectDataEncryptionKeyV2FNDX.cpp new file mode 100644 index 0000000..890b9b0 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDataEncryptionKeyV2FNDX.cpp @@ -0,0 +1,92 @@ +#include "ObjectDataEncryptionKeyV2FNDX.h" + + + +namespace libone +{ +ObjectDataEncryptionKeyV2FNDX::ObjectDataEncryptionKeyV2FNDX( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref(stpFormat, cbFormat), m_EncryptionData() {} + +ObjectDataEncryptionKeyV2FNDX::ObjectDataEncryptionKeyV2FNDX(const ObjectDataEncryptionKeyV2FNDX &source) + : m_ref(source.m_ref), m_EncryptionData(std::unique_ptr +{ + new unsigned char[source.getEncryptionDataLength()] +}) +{ + std::copy(source.getEncryptionData(), source.getEncryptionData() + source.getEncryptionDataLength(), m_EncryptionData.get()); +} + +ObjectDataEncryptionKeyV2FNDX::~ObjectDataEncryptionKeyV2FNDX() = default; + + +// ObjectDataEncryptionKeyV2FNDX &ObjectDataEncryptionKeyV2FNDX::operator=(const ObjectDataEncryptionKeyV2FNDX &rhs) +// { +// if (this == &rhs) +// { +// return *this; +// } +// +// delete[] this->m_EncryptionData; +// m_EncryptionData = new unsigned char[rhs.m_ref.cb()]; +// std::copy(rhs.m_EncryptionData, rhs.m_EncryptionData + rhs.m_ref.cb(), m_EncryptionData); +// return *this; +// } + +unsigned char *ObjectDataEncryptionKeyV2FNDX::getEncryptionData() const +{ + return m_EncryptionData.get(); +} + +uint64_t ObjectDataEncryptionKeyV2FNDX::getEncryptionDataLength() const +{ + return m_ref.cb(); +} + +void ObjectDataEncryptionKeyV2FNDX::setEncryptionData(const unsigned char *value, const uint64_t length) +{ + if (0 < length) + { + m_EncryptionData.reset(new unsigned char[length]); + std::copy(value, value + length, m_EncryptionData.get()); + } +} + +FileNodeChunkReference ObjectDataEncryptionKeyV2FNDX::getRef() const +{ + return m_ref; +} + +void ObjectDataEncryptionKeyV2FNDX::setRef( + const FileNodeChunkReference &value) +{ + m_ref = value; +} + +void ObjectDataEncryptionKeyV2FNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; + + uint64_t currentloc = input->tell(); + + seek(input,m_ref.stp()); + // skip header + skip(input,8); + + const unsigned char *const temp = readNBytes(input, m_ref.cb()); + m_EncryptionData.reset(new unsigned char[m_ref.cb()]); + std::copy(temp, temp + m_ref.cb(), m_EncryptionData.get()); + delete temp; + + // skip footer + skip(input,8); + + seek(input, currentloc); +} + +std::string ObjectDataEncryptionKeyV2FNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectDataEncryptionKeyV2FNDX.h b/src/lib/FileNodeData/ObjectDataEncryptionKeyV2FNDX.h new file mode 100644 index 0000000..10cd11d --- /dev/null +++ b/src/lib/FileNodeData/ObjectDataEncryptionKeyV2FNDX.h @@ -0,0 +1,45 @@ +#ifndef OBJECTDATAENCRYPTIONKEYV2FNDX_H +#define OBJECTDATAENCRYPTIONKEYV2FNDX_H + +#include "../FileNodeChunkReference.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class ObjectDataEncryptionKeyV2FNDX : public IFileNodeData +{ +private: + FileNodeChunkReference m_ref; + + static constexpr const uint64_t m_header = 0xFB6BA385DAD1A067; + static constexpr const uint64_t m_footer = 0x2649294F8E198B3C; + + std::unique_ptr m_EncryptionData; +public: + ObjectDataEncryptionKeyV2FNDX(const StpFormat stpFormat, const CbFormat cbFormat); + ObjectDataEncryptionKeyV2FNDX(const ObjectDataEncryptionKeyV2FNDX &source); + ~ObjectDataEncryptionKeyV2FNDX(); + +// ObjectDataEncryptionKeyV2FNDX &operator=(const ObjectDataEncryptionKeyV2FNDX &rhs); + + FileNodeChunkReference getRef() const; + void setRef(const FileNodeChunkReference &value); + + unsigned char *getEncryptionData() const; + uint64_t getEncryptionDataLength() const; + void setEncryptionData(const unsigned char *value, const uint64_t length); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectDataEncryptionKeyV2FNDX(*this); + } +}; + +} // namespace libone + +#endif // OBJECTDATAENCRYPTIONKEYV2FNDX_H diff --git a/src/lib/FileNodeData/ObjectDeclaration2LargeRefCountFND.cpp b/src/lib/FileNodeData/ObjectDeclaration2LargeRefCountFND.cpp new file mode 100644 index 0000000..4248afc --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclaration2LargeRefCountFND.cpp @@ -0,0 +1,56 @@ +#include "ObjectDeclaration2LargeRefCountFND.h" + +namespace libone +{ + +ObjectDeclaration2LargeRefCountFND::ObjectDeclaration2LargeRefCountFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_BlobRef(stpFormat, cbFormat), m_body(), m_cRef() {} + +ObjectDeclaration2LargeRefCountFND::~ObjectDeclaration2LargeRefCountFND() {} + +ObjectDeclaration2Body ObjectDeclaration2LargeRefCountFND::body() const +{ + return m_body; +} + +void ObjectDeclaration2LargeRefCountFND::setBody( + const ObjectDeclaration2Body &body) +{ + m_body = body; +} + +uint32_t ObjectDeclaration2LargeRefCountFND::cRef() const +{ + return m_cRef; +} + +void ObjectDeclaration2LargeRefCountFND::setCRef(const uint32_t &cRef) +{ + m_cRef = cRef; +} + +FileNodeChunkReference ObjectDeclaration2LargeRefCountFND::BlobRef() const +{ + return m_BlobRef; +} + +void ObjectDeclaration2LargeRefCountFND::setBlobRef( + const FileNodeChunkReference &BlobRef) +{ + m_BlobRef = BlobRef; +} + +void ObjectDeclaration2LargeRefCountFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_BlobRef; + input >> m_body; + input >> m_cRef; +} + +std::string ObjectDeclaration2LargeRefCountFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectDeclaration2LargeRefCountFND.h b/src/lib/FileNodeData/ObjectDeclaration2LargeRefCountFND.h new file mode 100644 index 0000000..9dd28f6 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclaration2LargeRefCountFND.h @@ -0,0 +1,47 @@ +#ifndef OBJECTDECLARATION2LARGEREFCOUNTFND_H +#define OBJECTDECLARATION2LARGEREFCOUNTFND_H + +#include "../FileNodeChunkReference.h" +#include "../ObjectDeclaration2Body.h" +#include "IFileNodeData.h" + + +namespace libone +{ +class ObjectDeclaration2LargeRefCountFND : public IFileNodeData +{ +private: + FileNodeChunkReference m_BlobRef; + + ObjectDeclaration2Body m_body; + + uint32_t m_cRef; + +public: + ObjectDeclaration2LargeRefCountFND(StpFormat stpFormat, + CbFormat cbFormat); + + ~ObjectDeclaration2LargeRefCountFND(); + + + FileNodeChunkReference BlobRef() const; + void setBlobRef(const FileNodeChunkReference &BlobRef); + + ObjectDeclaration2Body body() const; + void setBody(const ObjectDeclaration2Body &body); + + uint32_t cRef() const; + void setCRef(const uint32_t &cRef); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectDeclaration2LargeRefCountFND(*this); + } +}; + +} // namespace libone +#endif // OBJECTDECLARATION2LARGEREFCOUNTFND_H diff --git a/src/lib/FileNodeData/ObjectDeclaration2RefCountFND.cpp b/src/lib/FileNodeData/ObjectDeclaration2RefCountFND.cpp new file mode 100644 index 0000000..3551944 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclaration2RefCountFND.cpp @@ -0,0 +1,54 @@ +#include "ObjectDeclaration2RefCountFND.h" + +namespace libone +{ + +ObjectDeclaration2RefCountFND::ObjectDeclaration2RefCountFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_blobRef(stpFormat, cbFormat), m_body(), m_cRef{} {} + +uint8_t ObjectDeclaration2RefCountFND::getCRef() const +{ + return m_cRef; +} + +void ObjectDeclaration2RefCountFND::setCRef(const uint8_t &value) +{ + m_cRef = value; +} + +ObjectDeclaration2Body ObjectDeclaration2RefCountFND::getBody() const +{ + return m_body; +} + +void ObjectDeclaration2RefCountFND::setBody( + const ObjectDeclaration2Body &value) +{ + m_body = value; +} + +FileNodeChunkReference ObjectDeclaration2RefCountFND::getBlobRef() const +{ + return m_blobRef; +} + +void ObjectDeclaration2RefCountFND::setBlobRef( + const FileNodeChunkReference &value) +{ + m_blobRef = value; +} + +void ObjectDeclaration2RefCountFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_blobRef; + input >> m_body; + input >> m_cRef; +} + +std::string ObjectDeclaration2RefCountFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectDeclaration2RefCountFND.h b/src/lib/FileNodeData/ObjectDeclaration2RefCountFND.h new file mode 100644 index 0000000..ced43c4 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclaration2RefCountFND.h @@ -0,0 +1,44 @@ +#ifndef OBJECTDECLARATION2REFCOUNTFND_H +#define OBJECTDECLARATION2REFCOUNTFND_H + +#include "../FileNodeChunkReference.h" +#include "../ObjectDeclaration2Body.h" +#include "IFileNodeData.h" + +namespace libone +{ +class ObjectDeclaration2RefCountFND : public IFileNodeData +{ +private: + FileNodeChunkReference m_blobRef; + + ObjectDeclaration2Body m_body; + + uint8_t m_cRef; +public: + ObjectDeclaration2RefCountFND(StpFormat stpFormat, + CbFormat cbFormat); + ~ObjectDeclaration2RefCountFND() = default; + + FileNodeChunkReference getBlobRef() const; + void setBlobRef(const FileNodeChunkReference &value); + + ObjectDeclaration2Body getBody() const; + void setBody(const ObjectDeclaration2Body &value); + + uint8_t getCRef() const; + void setCRef(const uint8_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectDeclaration2RefCountFND(*this); + } +}; + +} // namespace libone + +#endif // OBJECTDECLARATION2REFCOUNTFND_H diff --git a/src/lib/FileNodeData/ObjectDeclarationFileData3LargeRefCountFND.cpp b/src/lib/FileNodeData/ObjectDeclarationFileData3LargeRefCountFND.cpp new file mode 100644 index 0000000..7cf301d --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclarationFileData3LargeRefCountFND.cpp @@ -0,0 +1,78 @@ +#include "ObjectDeclarationFileData3LargeRefCountFND.h" + +namespace libone +{ + +ObjectDeclarationFileData3LargeRefCountFND:: +ObjectDeclarationFileData3LargeRefCountFND() : m_oid(), m_jcid(), m_cRef(), m_FileDataReference(), m_Extension() {} + +CompactID ObjectDeclarationFileData3LargeRefCountFND::oid() const +{ + return m_oid; +} + +void ObjectDeclarationFileData3LargeRefCountFND::setOid(const CompactID &oid) +{ + m_oid = oid; +} + +JCID ObjectDeclarationFileData3LargeRefCountFND::jcid() const +{ + return m_jcid; +} + +void ObjectDeclarationFileData3LargeRefCountFND::setJcid(const JCID &jcid) +{ + m_jcid = jcid; +} + +uint32_t ObjectDeclarationFileData3LargeRefCountFND::cRef() const +{ + return m_cRef; +} + +void ObjectDeclarationFileData3LargeRefCountFND::setCRef(const uint32_t &cRef) +{ + m_cRef = cRef; +} + +StringInStorageBuffer +ObjectDeclarationFileData3LargeRefCountFND::FileDataReference() const +{ + return m_FileDataReference; +} + +void ObjectDeclarationFileData3LargeRefCountFND::setFileDataReference( + const StringInStorageBuffer &FileDataReference) +{ + m_FileDataReference = FileDataReference; +} + +StringInStorageBuffer +ObjectDeclarationFileData3LargeRefCountFND::Extension() const +{ + return m_Extension; +} + +void ObjectDeclarationFileData3LargeRefCountFND::setExtension( + const StringInStorageBuffer &Extension) +{ + m_Extension = Extension; +} + + +void ObjectDeclarationFileData3LargeRefCountFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oid; + input >> m_jcid; + input >> m_cRef; + input >> m_FileDataReference; + input >> m_Extension; +} + +std::string ObjectDeclarationFileData3LargeRefCountFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectDeclarationFileData3LargeRefCountFND.h b/src/lib/FileNodeData/ObjectDeclarationFileData3LargeRefCountFND.h new file mode 100644 index 0000000..3110e37 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclarationFileData3LargeRefCountFND.h @@ -0,0 +1,51 @@ +#ifndef OBJECTDECLARATIONFILEDATA3LARGEREFCOUNTFND_H +#define OBJECTDECLARATIONFILEDATA3LARGEREFCOUNTFND_H + +#include "../CompactID.h" +#include "../StringInStorageBuffer.h" +#include "../JCID.h" +#include "IFileNodeData.h" + +namespace libone +{ +class ObjectDeclarationFileData3LargeRefCountFND : public IFileNodeData +{ +private: + CompactID m_oid; + JCID m_jcid; + + uint32_t m_cRef; + + StringInStorageBuffer m_FileDataReference; + StringInStorageBuffer m_Extension; + +public: + ObjectDeclarationFileData3LargeRefCountFND(); + + CompactID oid() const; + void setOid(const CompactID &oid); + + JCID jcid() const; + void setJcid(const JCID &jcid); + + uint32_t cRef() const; + void setCRef(const uint32_t &cRef); + + StringInStorageBuffer FileDataReference() const; + void setFileDataReference(const StringInStorageBuffer &FileDataReference); + + StringInStorageBuffer Extension() const; + void setExtension(const StringInStorageBuffer &Extension); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectDeclarationFileData3LargeRefCountFND(*this); + } +}; + +} // namespace libone +#endif // OBJECTDECLARATIONFILEDATA3LARGEREFCOUNTFND_H diff --git a/src/lib/FileNodeData/ObjectDeclarationFileData3RefCountFND.cpp b/src/lib/FileNodeData/ObjectDeclarationFileData3RefCountFND.cpp new file mode 100644 index 0000000..f560b92 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclarationFileData3RefCountFND.cpp @@ -0,0 +1,73 @@ +#include "ObjectDeclarationFileData3RefCountFND.h" + +namespace libone +{ + +ObjectDeclarationFileData3RefCountFND::ObjectDeclarationFileData3RefCountFND() : + m_oid(), m_jcid(), m_cRef{}, m_FileDataReference(), m_Extension() {} + +CompactID ObjectDeclarationFileData3RefCountFND::oid() const +{ + return m_oid; +} + +void ObjectDeclarationFileData3RefCountFND::setOid(const CompactID &oid) +{ + m_oid = oid; +} + +JCID ObjectDeclarationFileData3RefCountFND::jcid() const +{ + return m_jcid; +} + +void ObjectDeclarationFileData3RefCountFND::setJcid(const JCID &jcid) +{ + m_jcid = jcid; +} + +uint8_t ObjectDeclarationFileData3RefCountFND::cRef() const +{ + return m_cRef; +} + +void ObjectDeclarationFileData3RefCountFND::setCRef(const uint8_t &cRef) +{ + m_cRef = cRef; +} + +StringInStorageBuffer ObjectDeclarationFileData3RefCountFND::FileDataReference() const +{ + return m_FileDataReference; +} + +void ObjectDeclarationFileData3RefCountFND::setFileDataReference(const StringInStorageBuffer &FileDataReference) +{ + m_FileDataReference = FileDataReference; +} + +StringInStorageBuffer ObjectDeclarationFileData3RefCountFND::Extension() const +{ + return m_Extension; +} + +void ObjectDeclarationFileData3RefCountFND::setExtension(const StringInStorageBuffer &Extension) +{ + m_Extension = Extension; +} + +void ObjectDeclarationFileData3RefCountFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oid; + input >> m_jcid; + input >> m_cRef; + input >> m_FileDataReference; + input >> m_Extension; +} + +std::string ObjectDeclarationFileData3RefCountFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectDeclarationFileData3RefCountFND.h b/src/lib/FileNodeData/ObjectDeclarationFileData3RefCountFND.h new file mode 100644 index 0000000..6301058 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclarationFileData3RefCountFND.h @@ -0,0 +1,53 @@ +#ifndef OBJECTDECLARATIONFILEDATA3REFCOUNTFND_H +#define OBJECTDECLARATIONFILEDATA3REFCOUNTFND_H + +#include "IFileNodeData.h" + +#include "../CompactID.h" +#include "../StringInStorageBuffer.h" +#include "../JCID.h" + +namespace libone +{ +class ObjectDeclarationFileData3RefCountFND : public IFileNodeData +{ +private: + CompactID m_oid; + JCID m_jcid; + + uint8_t m_cRef = 0; + + StringInStorageBuffer m_FileDataReference; + StringInStorageBuffer m_Extension; + +public: + ObjectDeclarationFileData3RefCountFND(); + + CompactID oid() const; + void setOid(const CompactID &oid); + + JCID jcid() const; + void setJcid(const JCID &jcid); + + uint8_t cRef() const; + void setCRef(const uint8_t &cRef); + + StringInStorageBuffer FileDataReference() const; + void setFileDataReference(const StringInStorageBuffer &FileDataReference); + + StringInStorageBuffer Extension() const; + void setExtension(const StringInStorageBuffer &Extension); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectDeclarationFileData3RefCountFND(*this); + } +}; + +} // namespace libone + +#endif // OBJECTDECLARATIONFILEDATA3REFCOUNTFND_H diff --git a/src/lib/FileNodeData/ObjectDeclarationWithRefCount2FNDX.cpp b/src/lib/FileNodeData/ObjectDeclarationWithRefCount2FNDX.cpp new file mode 100644 index 0000000..a892f3a --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclarationWithRefCount2FNDX.cpp @@ -0,0 +1,58 @@ +#include "ObjectDeclarationWithRefCount2FNDX.h" + + +namespace libone +{ +ObjectDeclarationWithRefCount2FNDX::ObjectDeclarationWithRefCount2FNDX( + StpFormat stpFormat, CbFormat cbFormat) + : m_objectRef(stpFormat, cbFormat), m_body(), m_cRef{} {} + +ObjectDeclarationWithRefCount2FNDX::~ObjectDeclarationWithRefCount2FNDX() {} + +FileNodeChunkReference +ObjectDeclarationWithRefCount2FNDX::getObjectRef() const +{ + return m_objectRef; +} + +void ObjectDeclarationWithRefCount2FNDX::setObjectRef( + const FileNodeChunkReference &value) +{ + m_objectRef = value; +} + +ObjectDeclarationWithRefCountBody +ObjectDeclarationWithRefCount2FNDX::getBody() const +{ + return m_body; +} + +void ObjectDeclarationWithRefCount2FNDX::setBody( + const ObjectDeclarationWithRefCountBody &value) +{ + m_body = value; +} + +uint32_t ObjectDeclarationWithRefCount2FNDX::getCRef() const +{ + return m_cRef; +} + +void ObjectDeclarationWithRefCount2FNDX::setCRef(const uint32_t &value) +{ + m_cRef = value; +} + +void ObjectDeclarationWithRefCount2FNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_objectRef; + input >> m_body; + input >> m_cRef; +} + +std::string ObjectDeclarationWithRefCount2FNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectDeclarationWithRefCount2FNDX.h b/src/lib/FileNodeData/ObjectDeclarationWithRefCount2FNDX.h new file mode 100644 index 0000000..b25c4d4 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclarationWithRefCount2FNDX.h @@ -0,0 +1,48 @@ +#ifndef OBJECTDECLARATIONWITHREFCOUNT2FNDX_H +#define OBJECTDECLARATIONWITHREFCOUNT2FNDX_H + + +#include "../FileNodeChunkReference.h" +#include "../ObjectDeclarationWithRefCountBody.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class ObjectDeclarationWithRefCount2FNDX : public IFileNodeData +{ +private: + FileNodeChunkReference m_objectRef; + + ObjectDeclarationWithRefCountBody m_body; + + uint32_t m_cRef; +public: + ObjectDeclarationWithRefCount2FNDX(StpFormat stpFormat, + CbFormat cbFormat); + ~ObjectDeclarationWithRefCount2FNDX(); + + + + FileNodeChunkReference getObjectRef() const; + void setObjectRef(const FileNodeChunkReference &value); + + ObjectDeclarationWithRefCountBody getBody() const; + void setBody(const ObjectDeclarationWithRefCountBody &value); + + uint32_t getCRef() const; + void setCRef(const uint32_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectDeclarationWithRefCount2FNDX(*this); + } +}; + +} // namespace libone + +#endif // OBJECTDECLARATIONWITHREFCOUNT2FNDX_H diff --git a/src/lib/FileNodeData/ObjectDeclarationWithRefCountFNDX.cpp b/src/lib/FileNodeData/ObjectDeclarationWithRefCountFNDX.cpp new file mode 100644 index 0000000..0aa2509 --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclarationWithRefCountFNDX.cpp @@ -0,0 +1,57 @@ +#include "ObjectDeclarationWithRefCountFNDX.h" + +namespace libone +{ + +ObjectDeclarationWithRefCountFNDX::ObjectDeclarationWithRefCountFNDX( + StpFormat stpFormat, CbFormat cbFormat) + : m_objectRef(stpFormat, cbFormat), m_body(), m_cRef() {} + +ObjectDeclarationWithRefCountFNDX::~ObjectDeclarationWithRefCountFNDX() {} + +FileNodeChunkReference ObjectDeclarationWithRefCountFNDX::getObjectRef() const +{ + return m_objectRef; +} + +void ObjectDeclarationWithRefCountFNDX::setObjectRef( + const FileNodeChunkReference &value) +{ + m_objectRef = value; +} + +ObjectDeclarationWithRefCountBody +ObjectDeclarationWithRefCountFNDX::getBody() const +{ + return m_body; +} + +void ObjectDeclarationWithRefCountFNDX::setBody( + const ObjectDeclarationWithRefCountBody &value) +{ + m_body = value; +} + +uint8_t ObjectDeclarationWithRefCountFNDX::getCRef() const +{ + return m_cRef; +} + +void ObjectDeclarationWithRefCountFNDX::setCRef(const uint8_t &value) +{ + m_cRef = value; +} + +void ObjectDeclarationWithRefCountFNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_objectRef; + input >> m_body; + input>> m_cRef; +} + +std::string ObjectDeclarationWithRefCountFNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectDeclarationWithRefCountFNDX.h b/src/lib/FileNodeData/ObjectDeclarationWithRefCountFNDX.h new file mode 100644 index 0000000..bb6876e --- /dev/null +++ b/src/lib/FileNodeData/ObjectDeclarationWithRefCountFNDX.h @@ -0,0 +1,49 @@ +#ifndef OBJECTDECLARATIONWITHREFCOUNTFNDX_H +#define OBJECTDECLARATIONWITHREFCOUNTFNDX_H + +#include "../FileNodeChunkReference.h" +#include "../ObjectDeclarationWithRefCountBody.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class ObjectDeclarationWithRefCountFNDX : public IFileNodeData +{ +private: + + FileNodeChunkReference m_objectRef; + + ObjectDeclarationWithRefCountBody m_body; + + uint8_t m_cRef; + +public: + ObjectDeclarationWithRefCountFNDX(StpFormat stpFormat, + CbFormat cbFormat); + ~ObjectDeclarationWithRefCountFNDX(); + + + + FileNodeChunkReference getObjectRef() const; + void setObjectRef(const FileNodeChunkReference &value); + + ObjectDeclarationWithRefCountBody getBody() const; + void setBody(const ObjectDeclarationWithRefCountBody &value); + + uint8_t getCRef() const; + void setCRef(const uint8_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectDeclarationWithRefCountFNDX(*this); + } +}; + +} // namespace libone + +#endif // OBJECTDECLARATIONWITHREFCOUNTFNDX_H diff --git a/src/lib/FileNodeData/ObjectGroupListReferenceFND.cpp b/src/lib/FileNodeData/ObjectGroupListReferenceFND.cpp new file mode 100644 index 0000000..7d9e4d3 --- /dev/null +++ b/src/lib/FileNodeData/ObjectGroupListReferenceFND.cpp @@ -0,0 +1,42 @@ +#include "ObjectGroupListReferenceFND.h" + +namespace libone +{ + +ObjectGroupListReferenceFND::ObjectGroupListReferenceFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref(stpFormat, cbFormat), m_ObjectGroupID() {} + +ExtendedGUID ObjectGroupListReferenceFND::objectGroupID() const +{ + return m_ObjectGroupID; +} + +void ObjectGroupListReferenceFND::setObjectGroupID( + const ExtendedGUID &objectGroupID) +{ + m_ObjectGroupID = objectGroupID; +} + +FileNodeChunkReference ObjectGroupListReferenceFND::ref() const +{ + return m_ref; +} + +void ObjectGroupListReferenceFND::setRef(const FileNodeChunkReference &ref) +{ + m_ref = ref; +} + +void ObjectGroupListReferenceFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; + input >> m_ObjectGroupID; +} + +std::string ObjectGroupListReferenceFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectGroupListReferenceFND.h b/src/lib/FileNodeData/ObjectGroupListReferenceFND.h new file mode 100644 index 0000000..87db417 --- /dev/null +++ b/src/lib/FileNodeData/ObjectGroupListReferenceFND.h @@ -0,0 +1,41 @@ +#ifndef OBJECTGROUPLISTREFERENCEFND_H +#define OBJECTGROUPLISTREFERENCEFND_H + +#include "../ExtendedGUID.h" +#include "../FileNodeChunkReference.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class ObjectGroupListReferenceFND : public IFileNodeData +{ +private: + FileNodeChunkReference m_ref; + + ExtendedGUID m_ObjectGroupID; + +public: + ObjectGroupListReferenceFND(StpFormat stpFormat, + CbFormat cbFormat); + ~ObjectGroupListReferenceFND() = default; + + FileNodeChunkReference ref() const; + void setRef(const FileNodeChunkReference &ref); + + ExtendedGUID objectGroupID() const; + void setObjectGroupID(const ExtendedGUID &objectGroupID); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectGroupListReferenceFND(*this); + } +}; + +} // namespace libone + +#endif // OBJECTGROUPLISTREFERENCEFND_H diff --git a/src/lib/FileNodeData/ObjectGroupStartFND.cpp b/src/lib/FileNodeData/ObjectGroupStartFND.cpp new file mode 100644 index 0000000..cc56e48 --- /dev/null +++ b/src/lib/FileNodeData/ObjectGroupStartFND.cpp @@ -0,0 +1,31 @@ +#include "ObjectGroupStartFND.h" + + +namespace libone +{ +ObjectGroupStartFND::ObjectGroupStartFND() + : m_oid(ExtendedGUID()) +{ +} + +ExtendedGUID ObjectGroupStartFND::oid() const +{ + return m_oid; +} + +void ObjectGroupStartFND::setOid(const ExtendedGUID &oid) +{ + m_oid = oid; +} + + +void ObjectGroupStartFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oid; +} + +std::string ObjectGroupStartFND::to_string() const +{ + return ""; +} +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectGroupStartFND.h b/src/lib/FileNodeData/ObjectGroupStartFND.h new file mode 100644 index 0000000..26c2347 --- /dev/null +++ b/src/lib/FileNodeData/ObjectGroupStartFND.h @@ -0,0 +1,32 @@ +#ifndef OBJECTGROUPSTARTFND_H +#define OBJECTGROUPSTARTFND_H + +#include "../ExtendedGUID.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class ObjectGroupStartFND : public IFileNodeData +{ +private: + ExtendedGUID m_oid; +public: + ObjectGroupStartFND(); + + ExtendedGUID oid() const; + void setOid(const ExtendedGUID &oid); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectGroupStartFND(*this); + } +}; + +} // namespace libone + +#endif // OBJECTGROUPSTARTFND_H diff --git a/src/lib/FileNodeData/ObjectInfoDependencyOverridesFND.cpp b/src/lib/FileNodeData/ObjectInfoDependencyOverridesFND.cpp new file mode 100644 index 0000000..f2bd4c6 --- /dev/null +++ b/src/lib/FileNodeData/ObjectInfoDependencyOverridesFND.cpp @@ -0,0 +1,56 @@ +#include "ObjectInfoDependencyOverridesFND.h" + +namespace libone +{ +ObjectInfoDependencyOverridesFND::ObjectInfoDependencyOverridesFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref(stpFormat, cbFormat), m_data() {} + +ObjectInfoDependencyOverridesFND::~ObjectInfoDependencyOverridesFND() {} + +ObjectInfoDependencyOverrideData +ObjectInfoDependencyOverridesFND::getData() const +{ + return m_data; +} + +void ObjectInfoDependencyOverridesFND::setData( + const ObjectInfoDependencyOverrideData &value) +{ + m_data = value; +} + +FileNodeChunkReference ObjectInfoDependencyOverridesFND::getRef() const +{ + return m_ref; +} + +void ObjectInfoDependencyOverridesFND::setRef( + const FileNodeChunkReference &value) +{ + m_ref = value; +} + +void ObjectInfoDependencyOverridesFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; + + if (m_ref.is_fcrNil()) + { + input >> m_data; + } + else + { + uint64_t currentloc = input->tell(); + input->seek(m_ref.stp(), librevenge::RVNG_SEEK_SET); + input >> m_data; + input->seek(currentloc, librevenge::RVNG_SEEK_SET); + } +} + +std::string ObjectInfoDependencyOverridesFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectInfoDependencyOverridesFND.h b/src/lib/FileNodeData/ObjectInfoDependencyOverridesFND.h new file mode 100644 index 0000000..db2bf84 --- /dev/null +++ b/src/lib/FileNodeData/ObjectInfoDependencyOverridesFND.h @@ -0,0 +1,40 @@ +#ifndef OBJECTINFODEPENDENCYOVERRIDESFND_H +#define OBJECTINFODEPENDENCYOVERRIDESFND_H + +#include "IFileNodeData.h" +#include "../FileNodeChunkReference.h" +#include "../ObjectInfoDependencyOverrideData.h" + +namespace libone +{ + +class ObjectInfoDependencyOverridesFND : public IFileNodeData +{ +private: + FileNodeChunkReference m_ref; + + ObjectInfoDependencyOverrideData m_data; + +public: + ObjectInfoDependencyOverridesFND(StpFormat stpFormat, CbFormat cbFormat); + ~ObjectInfoDependencyOverridesFND(); + + FileNodeChunkReference getRef() const; + void setRef(const FileNodeChunkReference &value); + + ObjectInfoDependencyOverrideData getData() const; + void setData(const ObjectInfoDependencyOverrideData &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectInfoDependencyOverridesFND(*this); + } +}; + +} // namespace libone + +#endif // OBJECTINFODEPENDENCYOVERRIDESFND_H diff --git a/src/lib/FileNodeData/ObjectRevisionWithRefCount2FNDX.cpp b/src/lib/FileNodeData/ObjectRevisionWithRefCount2FNDX.cpp new file mode 100644 index 0000000..71abea3 --- /dev/null +++ b/src/lib/FileNodeData/ObjectRevisionWithRefCount2FNDX.cpp @@ -0,0 +1,81 @@ +#include "ObjectRevisionWithRefCount2FNDX.h" + +namespace libone +{ + +ObjectRevisionWithRefCount2FNDX::ObjectRevisionWithRefCount2FNDX( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref(stpFormat, cbFormat), m_oid(), + m_fHasOidReferences(false), m_fHasOsidReferences(false), m_cRef(0) {} + +uint32_t ObjectRevisionWithRefCount2FNDX::getCRef() const +{ + return m_cRef; +} + +void ObjectRevisionWithRefCount2FNDX::setCRef(const uint32_t &value) +{ + m_cRef = value; +} + +bool ObjectRevisionWithRefCount2FNDX::getFHasOsidReferences() const +{ + return m_fHasOsidReferences; +} + +void ObjectRevisionWithRefCount2FNDX::setFHasOsidReferences(bool value) +{ + m_fHasOsidReferences = value; +} + +bool ObjectRevisionWithRefCount2FNDX::getFHasOidReferences() const +{ + return m_fHasOidReferences; +} + +void ObjectRevisionWithRefCount2FNDX::setFHasOidReferences(bool value) +{ + m_fHasOidReferences = value; +} + +CompactID ObjectRevisionWithRefCount2FNDX::getOid() const +{ + return m_oid; +} + +void ObjectRevisionWithRefCount2FNDX::setOid(const CompactID &value) +{ + m_oid = value; +} + +FileNodeChunkReference ObjectRevisionWithRefCount2FNDX::getRef() const +{ + return m_ref; +} + +void ObjectRevisionWithRefCount2FNDX::setRef( + const FileNodeChunkReference &value) +{ + m_ref = value; +} + +void ObjectRevisionWithRefCount2FNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; + input >> m_oid; + + uint32_t temp; + input >> temp; + + m_fHasOidReferences = temp & 0x1; + m_fHasOsidReferences = (temp & 0x2) >> 1; + + input >> m_cRef; +} + +std::string ObjectRevisionWithRefCount2FNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectRevisionWithRefCount2FNDX.h b/src/lib/FileNodeData/ObjectRevisionWithRefCount2FNDX.h new file mode 100644 index 0000000..d9acbe4 --- /dev/null +++ b/src/lib/FileNodeData/ObjectRevisionWithRefCount2FNDX.h @@ -0,0 +1,55 @@ +#ifndef OBJECTREVISIONWITHREFCOUNT2FNDX_H +#define OBJECTREVISIONWITHREFCOUNT2FNDX_H + +#include "../CompactID.h" +#include "../FileNodeChunkReference.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class ObjectRevisionWithRefCount2FNDX : public IFileNodeData +{ +private: + + FileNodeChunkReference m_ref; + + CompactID m_oid; + + bool m_fHasOidReferences; + bool m_fHasOsidReferences; + + uint32_t m_cRef; + +public: + ObjectRevisionWithRefCount2FNDX(StpFormat stpFormat, + CbFormat cbFormat); + + FileNodeChunkReference getRef() const; + void setRef(const FileNodeChunkReference &value); + + CompactID getOid() const; + void setOid(const CompactID &value); + + bool getFHasOidReferences() const; + void setFHasOidReferences(bool value); + + bool getFHasOsidReferences() const; + void setFHasOsidReferences(bool value); + + uint32_t getCRef() const; + void setCRef(const uint32_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectRevisionWithRefCount2FNDX(*this); + } +}; + +} // namespace libone + +#endif // OBJECTREVISIONWITHREFCOUNT2FNDX_H diff --git a/src/lib/FileNodeData/ObjectRevisionWithRefCountFNDX.cpp b/src/lib/FileNodeData/ObjectRevisionWithRefCountFNDX.cpp new file mode 100644 index 0000000..1c8934a --- /dev/null +++ b/src/lib/FileNodeData/ObjectRevisionWithRefCountFNDX.cpp @@ -0,0 +1,79 @@ +#include "ObjectRevisionWithRefCountFNDX.h" + + +namespace libone +{ +ObjectRevisionWithRefCountFNDX::ObjectRevisionWithRefCountFNDX( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref(stpFormat, cbFormat), m_oid(), + m_fHasOidReferences(false), m_fHasOsidReferences(false), m_cRef(0) {} + +bool ObjectRevisionWithRefCountFNDX::getFHasOsidReferences() const +{ + return m_fHasOsidReferences; +} + +void ObjectRevisionWithRefCountFNDX::setFHasOsidReferences(bool value) +{ + m_fHasOsidReferences = value; +} + +bool ObjectRevisionWithRefCountFNDX::getFHasOidReferences() const +{ + return m_fHasOidReferences; +} + +void ObjectRevisionWithRefCountFNDX::setFHasOidReferences(bool value) +{ + m_fHasOidReferences = value; +} + +uint8_t ObjectRevisionWithRefCountFNDX::getCRef() const +{ + return m_cRef; +} + +void ObjectRevisionWithRefCountFNDX::setCRef(const uint8_t &value) +{ + m_cRef = value; +} + +CompactID ObjectRevisionWithRefCountFNDX::getOid() const +{ + return m_oid; +} + +void ObjectRevisionWithRefCountFNDX::setOid(const CompactID &value) +{ + m_oid = value; +} + +FileNodeChunkReference ObjectRevisionWithRefCountFNDX::getRef() const +{ + return m_ref; +} + +void ObjectRevisionWithRefCountFNDX::setRef( + const FileNodeChunkReference &value) +{ + m_ref = value; +} + +void ObjectRevisionWithRefCountFNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; + input >> m_oid; + input >> m_cRef; + + m_fHasOidReferences = m_cRef & 0x1; + m_fHasOsidReferences = m_cRef & 0x2; + + m_cRef = m_cRef >> 2; +} + +std::string ObjectRevisionWithRefCountFNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectRevisionWithRefCountFNDX.h b/src/lib/FileNodeData/ObjectRevisionWithRefCountFNDX.h new file mode 100644 index 0000000..2d90cc3 --- /dev/null +++ b/src/lib/FileNodeData/ObjectRevisionWithRefCountFNDX.h @@ -0,0 +1,51 @@ +#ifndef OBJECTREVISIONWITHREFCOUNTFNDX_H +#define OBJECTREVISIONWITHREFCOUNTFNDX_H + +#include "../CompactID.h" +#include "../FileNodeChunkReference.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class ObjectRevisionWithRefCountFNDX : public IFileNodeData +{ +private: + FileNodeChunkReference m_ref; + + CompactID m_oid; + + bool m_fHasOidReferences; + bool m_fHasOsidReferences; + + uint8_t m_cRef; + +public: + ObjectRevisionWithRefCountFNDX(StpFormat stpFormat, + CbFormat cbFormat); + ~ObjectRevisionWithRefCountFNDX() = default; + + FileNodeChunkReference getRef() const; + void setRef(const FileNodeChunkReference &value); + CompactID getOid() const; + void setOid(const CompactID &value); + uint8_t getCRef() const; + void setCRef(const uint8_t &value); + bool getFHasOidReferences() const; + void setFHasOidReferences(bool value); + bool getFHasOsidReferences() const; + void setFHasOsidReferences(bool value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectRevisionWithRefCountFNDX(*this); + } +}; + +} // namespace libone + +#endif // OBJECTREVISIONWITHREFCOUNTFNDX_H diff --git a/src/lib/FileNodeData/ObjectSpaceManifestListReferenceFND.cpp b/src/lib/FileNodeData/ObjectSpaceManifestListReferenceFND.cpp new file mode 100644 index 0000000..0fc8485 --- /dev/null +++ b/src/lib/FileNodeData/ObjectSpaceManifestListReferenceFND.cpp @@ -0,0 +1,43 @@ +#include "ObjectSpaceManifestListReferenceFND.h" + +namespace libone +{ +ObjectSpaceManifestListReferenceFND::ObjectSpaceManifestListReferenceFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref{FileNodeChunkReference(stpFormat, cbFormat)}, m_gosid() {} + +ObjectSpaceManifestListReferenceFND::~ObjectSpaceManifestListReferenceFND() {} + +ExtendedGUID ObjectSpaceManifestListReferenceFND::getGosid() const +{ + return m_gosid; +} + +void ObjectSpaceManifestListReferenceFND::setGosid(const ExtendedGUID &value) +{ + m_gosid = value; +} + +FileNodeChunkReference ObjectSpaceManifestListReferenceFND::getRef() const +{ + return m_ref; +} + +void ObjectSpaceManifestListReferenceFND::setRef( + const FileNodeChunkReference &value) +{ + m_ref = value; +} + +void ObjectSpaceManifestListReferenceFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; + input >> m_gosid; +} + +std::string ObjectSpaceManifestListReferenceFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectSpaceManifestListReferenceFND.h b/src/lib/FileNodeData/ObjectSpaceManifestListReferenceFND.h new file mode 100644 index 0000000..14e5067 --- /dev/null +++ b/src/lib/FileNodeData/ObjectSpaceManifestListReferenceFND.h @@ -0,0 +1,42 @@ +#ifndef OBJECTSPACEMANIFESTLISTREFERENCEFND_H +#define OBJECTSPACEMANIFESTLISTREFERENCEFND_H + +#include "../ExtendedGUID.h" +#include "../FileNodeChunkReference.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class ObjectSpaceManifestListReferenceFND : public IFileNodeData +{ +private: + FileNodeChunkReference m_ref; + + ExtendedGUID m_gosid; +public: + ObjectSpaceManifestListReferenceFND(StpFormat stpFormat, + CbFormat cbFormat); + + ~ObjectSpaceManifestListReferenceFND(); + + + FileNodeChunkReference getRef() const; + void setRef(const FileNodeChunkReference &value); + + ExtendedGUID getGosid() const; + void setGosid(const ExtendedGUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectSpaceManifestListReferenceFND(*this); + } +}; + +} // namespace libone + +#endif // OBJECTSPACEMANIFESTLISTREFERENCEFND_H diff --git a/src/lib/FileNodeData/ObjectSpaceManifestListStartFND.cpp b/src/lib/FileNodeData/ObjectSpaceManifestListStartFND.cpp new file mode 100644 index 0000000..a4edd08 --- /dev/null +++ b/src/lib/FileNodeData/ObjectSpaceManifestListStartFND.cpp @@ -0,0 +1,27 @@ +#include "ObjectSpaceManifestListStartFND.h" + +namespace libone +{ +ObjectSpaceManifestListStartFND::ObjectSpaceManifestListStartFND() : m_gosid() {} + +ExtendedGUID ObjectSpaceManifestListStartFND::getGosid() const +{ + return m_gosid; +} + +void ObjectSpaceManifestListStartFND::setGosid(const ExtendedGUID &value) +{ + m_gosid = value; +} + +void ObjectSpaceManifestListStartFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_gosid; +} + +std::string ObjectSpaceManifestListStartFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectSpaceManifestListStartFND.h b/src/lib/FileNodeData/ObjectSpaceManifestListStartFND.h new file mode 100644 index 0000000..363a870 --- /dev/null +++ b/src/lib/FileNodeData/ObjectSpaceManifestListStartFND.h @@ -0,0 +1,33 @@ +#ifndef OBJECTSPACEMANIFESTLISTSTARTFND_H +#define OBJECTSPACEMANIFESTLISTSTARTFND_H + +#include "../ExtendedGUID.h" +#include "IFileNodeData.h" + +namespace libone +{ +class ObjectSpaceManifestListStartFND : public IFileNodeData +{ +private: + ExtendedGUID m_gosid; + +public: + ObjectSpaceManifestListStartFND(); + ~ObjectSpaceManifestListStartFND() = default; + + ExtendedGUID getGosid() const; + void setGosid(const ExtendedGUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectSpaceManifestListStartFND(*this); + } +}; + +} // namespace libone + +#endif // OBJECTSPACEMANIFESTLISTSTARTFND_H diff --git a/src/lib/FileNodeData/ObjectSpaceManifestRootFND.cpp b/src/lib/FileNodeData/ObjectSpaceManifestRootFND.cpp new file mode 100644 index 0000000..9fff44e --- /dev/null +++ b/src/lib/FileNodeData/ObjectSpaceManifestRootFND.cpp @@ -0,0 +1,30 @@ +#include "ObjectSpaceManifestRootFND.h" + +namespace libone +{ + +ObjectSpaceManifestRootFND::ObjectSpaceManifestRootFND() : m_gosidRoot() {} + +ObjectSpaceManifestRootFND::~ObjectSpaceManifestRootFND() {} + +ExtendedGUID ObjectSpaceManifestRootFND::getGosidRoot() const +{ + return m_gosidRoot; +} + +void ObjectSpaceManifestRootFND::setGosidRoot(const ExtendedGUID &value) +{ + m_gosidRoot = value; +} + +void ObjectSpaceManifestRootFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_gosidRoot; +} + +std::string ObjectSpaceManifestRootFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ObjectSpaceManifestRootFND.h b/src/lib/FileNodeData/ObjectSpaceManifestRootFND.h new file mode 100644 index 0000000..14b0dea --- /dev/null +++ b/src/lib/FileNodeData/ObjectSpaceManifestRootFND.h @@ -0,0 +1,34 @@ +#ifndef OBJECTSPACEMANIFESTROOTFND_H +#define OBJECTSPACEMANIFESTROOTFND_H + +#include "IFileNodeData.h" + +#include "../ExtendedGUID.h" + +namespace libone +{ +class ObjectSpaceManifestRootFND : public IFileNodeData +{ +private: + ExtendedGUID m_gosidRoot; + +public: + ObjectSpaceManifestRootFND(); + ~ObjectSpaceManifestRootFND(); + + ExtendedGUID getGosidRoot() const; + void setGosidRoot(const ExtendedGUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ObjectSpaceManifestRootFND(*this); + } +}; + +} // namespace libone + +#endif // OBJECTSPACEMANIFESTROOTFND_H diff --git a/src/lib/FileNodeData/ReadOnlyObjectDeclaration2LargeRefCountFND.cpp b/src/lib/FileNodeData/ReadOnlyObjectDeclaration2LargeRefCountFND.cpp new file mode 100644 index 0000000..7d00a64 --- /dev/null +++ b/src/lib/FileNodeData/ReadOnlyObjectDeclaration2LargeRefCountFND.cpp @@ -0,0 +1,67 @@ +#include "ReadOnlyObjectDeclaration2LargeRefCountFND.h" + +#include + +namespace libone +{ +ReadOnlyObjectDeclaration2LargeRefCountFND:: +ReadOnlyObjectDeclaration2LargeRefCountFND(StpFormat stpFormat, + CbFormat cbFormat) + : m_stpFormat(stpFormat), m_cbFormat(cbFormat), + m_base(stpFormat, cbFormat), m_md5hash() {} + +ReadOnlyObjectDeclaration2LargeRefCountFND:: +~ReadOnlyObjectDeclaration2LargeRefCountFND() {} + +StpFormat +ReadOnlyObjectDeclaration2LargeRefCountFND::getStpFormat() const +{ + return m_stpFormat; +} + +CbFormat ReadOnlyObjectDeclaration2LargeRefCountFND::getCbFormat() const +{ + return m_cbFormat; +} + +ObjectDeclaration2LargeRefCountFND +ReadOnlyObjectDeclaration2LargeRefCountFND::getBase() const +{ + return m_base; +} + +void ReadOnlyObjectDeclaration2LargeRefCountFND::setBase( + const ObjectDeclaration2LargeRefCountFND &value) +{ + m_base = value; +} + +std::array ReadOnlyObjectDeclaration2LargeRefCountFND::getMd5hash() const +{ + return m_md5hash; +} + +void ReadOnlyObjectDeclaration2LargeRefCountFND::setMd5hash( + const std::array &value) +{ + m_md5hash = value; +} + +void ReadOnlyObjectDeclaration2LargeRefCountFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + + m_base = ObjectDeclaration2LargeRefCountFND(m_stpFormat, m_cbFormat); + input >> m_base; + + const unsigned char *md5hashRaw {}; + md5hashRaw = readNBytes(input, 16); + + std::copy_n(md5hashRaw, 16, std::begin(m_md5hash)); +} + +std::string ReadOnlyObjectDeclaration2LargeRefCountFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ReadOnlyObjectDeclaration2LargeRefCountFND.h b/src/lib/FileNodeData/ReadOnlyObjectDeclaration2LargeRefCountFND.h new file mode 100644 index 0000000..992dcdb --- /dev/null +++ b/src/lib/FileNodeData/ReadOnlyObjectDeclaration2LargeRefCountFND.h @@ -0,0 +1,52 @@ +#ifndef READONLYOBJECTDECLARATION2LARGEREFCOUNTFND_H +#define READONLYOBJECTDECLARATION2LARGEREFCOUNTFND_H + +#include + +#include "../FileNodeChunkReference.h" +#include "IFileNodeData.h" +#include "ObjectDeclaration2LargeRefCountFND.h" + +namespace libone +{ +class ReadOnlyObjectDeclaration2LargeRefCountFND : public IFileNodeData +{ +private: + StpFormat m_stpFormat; + CbFormat m_cbFormat; + + ObjectDeclaration2LargeRefCountFND m_base; + + std::array m_md5hash; + +public: + ReadOnlyObjectDeclaration2LargeRefCountFND(StpFormat stpFormat, + CbFormat cbFormat); + + ~ReadOnlyObjectDeclaration2LargeRefCountFND(); + + FileNodeChunkReference ref() const; + void setRef(const FileNodeChunkReference &ref); + ObjectDeclaration2LargeRefCountFND getBase() const; + void setBase(const ObjectDeclaration2LargeRefCountFND &value); + + std::array getMd5hash() const; + void setMd5hash(const std::array &value); + + StpFormat getStpFormat() const; + + CbFormat getCbFormat() const; + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ReadOnlyObjectDeclaration2LargeRefCountFND(*this); + } +}; + +} // namespace libone + +#endif // READONLYOBJECTDECLARATION2LARGEREFCOUNTFND_H diff --git a/src/lib/FileNodeData/ReadOnlyObjectDeclaration2RefCountFND.cpp b/src/lib/FileNodeData/ReadOnlyObjectDeclaration2RefCountFND.cpp new file mode 100644 index 0000000..b04e5e4 --- /dev/null +++ b/src/lib/FileNodeData/ReadOnlyObjectDeclaration2RefCountFND.cpp @@ -0,0 +1,67 @@ +#include "ReadOnlyObjectDeclaration2RefCountFND.h" + +#include + +namespace libone +{ + +ReadOnlyObjectDeclaration2RefCountFND::ReadOnlyObjectDeclaration2RefCountFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_stpFormat(stpFormat), m_cbFormat(cbFormat), + m_base(stpFormat, cbFormat), m_md5hash() {} + +ReadOnlyObjectDeclaration2RefCountFND:: +~ReadOnlyObjectDeclaration2RefCountFND() {} + + +StpFormat ReadOnlyObjectDeclaration2RefCountFND::getStpFormat() const +{ + return m_stpFormat; +} + +CbFormat ReadOnlyObjectDeclaration2RefCountFND::getCbFormat() const +{ + return m_cbFormat; +} + +ObjectDeclaration2RefCountFND +ReadOnlyObjectDeclaration2RefCountFND::getBase() const +{ + return m_base; +} + +void ReadOnlyObjectDeclaration2RefCountFND::setBase( + const ObjectDeclaration2RefCountFND &value) +{ + m_base = value; +} + +std::array ReadOnlyObjectDeclaration2RefCountFND::getMd5hash() const +{ + return m_md5hash; +} + +void ReadOnlyObjectDeclaration2RefCountFND::setMd5hash( + const std::array &value) +{ + m_md5hash = value; +} + +void ReadOnlyObjectDeclaration2RefCountFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + + m_base = ObjectDeclaration2RefCountFND(m_stpFormat, m_cbFormat); + input >> m_base; + + const unsigned char *md5hashRaw; + md5hashRaw = readNBytes(input, 16); + std::copy_n(md5hashRaw, 16, std::begin(m_md5hash)); + +} + +std::string ReadOnlyObjectDeclaration2RefCountFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/ReadOnlyObjectDeclaration2RefCountFND.h b/src/lib/FileNodeData/ReadOnlyObjectDeclaration2RefCountFND.h new file mode 100644 index 0000000..96069da --- /dev/null +++ b/src/lib/FileNodeData/ReadOnlyObjectDeclaration2RefCountFND.h @@ -0,0 +1,49 @@ +#ifndef READONLYOBJECTDECLARATION2REFCOUNTFND_H +#define READONLYOBJECTDECLARATION2REFCOUNTFND_H + +#include "IFileNodeData.h" +#include "ObjectDeclaration2RefCountFND.h" +#include "../FileNodeChunkReference.h" + +namespace libone +{ + +class ReadOnlyObjectDeclaration2RefCountFND : public IFileNodeData +{ +private: + StpFormat m_stpFormat; + CbFormat m_cbFormat; + ObjectDeclaration2RefCountFND m_base; + + std::array m_md5hash; + +public: + ReadOnlyObjectDeclaration2RefCountFND(StpFormat stpFormat, + CbFormat cbFormat); + + ~ReadOnlyObjectDeclaration2RefCountFND(); + + FileNodeChunkReference ref() const; + void setRef(const FileNodeChunkReference &ref); + ObjectDeclaration2RefCountFND getBase() const; + void setBase(const ObjectDeclaration2RefCountFND &value); + + std::array getMd5hash() const; + void setMd5hash(const std::array &value); + + StpFormat getStpFormat() const; + CbFormat getCbFormat() const; + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new ReadOnlyObjectDeclaration2RefCountFND(*this); + } +}; + +} // namespace libone + +#endif // READONLYOBJECTDECLARATION2REFCOUNTFND_H diff --git a/src/lib/FileNodeData/RevisionManifestListReferenceFND.cpp b/src/lib/FileNodeData/RevisionManifestListReferenceFND.cpp new file mode 100644 index 0000000..4253c9d --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestListReferenceFND.cpp @@ -0,0 +1,32 @@ +#include "RevisionManifestListReferenceFND.h" + +namespace libone +{ + +RevisionManifestListReferenceFND::RevisionManifestListReferenceFND( + StpFormat stpFormat, CbFormat cbFormat) + : m_ref(stpFormat, cbFormat) {} +RevisionManifestListReferenceFND::~RevisionManifestListReferenceFND() {} + +FileNodeChunkReference RevisionManifestListReferenceFND::getRef() const +{ + return m_ref; +} + +void RevisionManifestListReferenceFND::setRef( + const FileNodeChunkReference &value) +{ + m_ref = value; +} + +void RevisionManifestListReferenceFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_ref; +} + +std::string RevisionManifestListReferenceFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RevisionManifestListReferenceFND.h b/src/lib/FileNodeData/RevisionManifestListReferenceFND.h new file mode 100644 index 0000000..095607b --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestListReferenceFND.h @@ -0,0 +1,36 @@ +#ifndef REVISIONMANIFESTLISTREFERENCEFND_H +#define REVISIONMANIFESTLISTREFERENCEFND_H + +#include "IFileNodeData.h" +#include "../FileNodeChunkReference.h" + +namespace libone +{ + +class RevisionManifestListReferenceFND : public IFileNodeData +{ +private: + FileNodeChunkReference m_ref; + +public: + RevisionManifestListReferenceFND(StpFormat stpFormat, + CbFormat cbFormat); + + ~RevisionManifestListReferenceFND(); + + FileNodeChunkReference getRef() const; + void setRef(const FileNodeChunkReference &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RevisionManifestListReferenceFND(*this); + } +}; + +} // namespace libone + +#endif // REVISIONMANIFESTLISTREFERENCEFND_H diff --git a/src/lib/FileNodeData/RevisionManifestListStartFND.cpp b/src/lib/FileNodeData/RevisionManifestListStartFND.cpp new file mode 100644 index 0000000..d266ba1 --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestListStartFND.cpp @@ -0,0 +1,39 @@ +#include "RevisionManifestListStartFND.h" + +namespace libone +{ +RevisionManifestListStartFND::RevisionManifestListStartFND() : m_gosid(), m_nInstance() {} +RevisionManifestListStartFND::~RevisionManifestListStartFND() {} + +ExtendedGUID RevisionManifestListStartFND::getGosid() const +{ + return m_gosid; +} + +void RevisionManifestListStartFND::setGosid(const ExtendedGUID &value) +{ + m_gosid = value; +} + +uint32_t RevisionManifestListStartFND::getNInstance() const +{ + return m_nInstance; +} + +void RevisionManifestListStartFND::setNInstance(const uint32_t &value) +{ + m_nInstance = value; +} + +void RevisionManifestListStartFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_gosid; + input >> m_nInstance; +} + +std::string RevisionManifestListStartFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RevisionManifestListStartFND.h b/src/lib/FileNodeData/RevisionManifestListStartFND.h new file mode 100644 index 0000000..e7bd375 --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestListStartFND.h @@ -0,0 +1,39 @@ +#ifndef REVISIONMANIFESTLISTSTARTFND_H +#define REVISIONMANIFESTLISTSTARTFND_H + +#include "IFileNodeData.h" + +#include "../ExtendedGUID.h" + +namespace libone +{ + +class RevisionManifestListStartFND : public IFileNodeData +{ +private: + ExtendedGUID m_gosid; + + uint32_t m_nInstance; + +public: + RevisionManifestListStartFND(); + ~RevisionManifestListStartFND(); + + ExtendedGUID getGosid() const; + void setGosid(const ExtendedGUID &value); + uint32_t getNInstance() const; + void setNInstance(const uint32_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RevisionManifestListStartFND(*this); + } +}; + +} // namespace libone + +#endif // REVISIONMANIFESTLISTSTARTFND_H diff --git a/src/lib/FileNodeData/RevisionManifestStart4FND.cpp b/src/lib/FileNodeData/RevisionManifestStart4FND.cpp new file mode 100644 index 0000000..a21cdce --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestStart4FND.cpp @@ -0,0 +1,73 @@ +#include "RevisionManifestStart4FND.h" + +namespace libone +{ + +RevisionManifestStart4FND::RevisionManifestStart4FND() : m_rid(), m_ridDependent(), + m_timeCreation(), m_revisionRole(), m_odcsDefault() {} + +ExtendedGUID RevisionManifestStart4FND::getRid() const +{ + return m_rid; +} + +void RevisionManifestStart4FND::setRid(const ExtendedGUID &value) +{ + m_rid = value; +} + +ExtendedGUID RevisionManifestStart4FND::getRidDependent() const +{ + return m_ridDependent; +} + +void RevisionManifestStart4FND::setRidDependent(const ExtendedGUID &value) +{ + m_ridDependent = value; +} + +uint64_t RevisionManifestStart4FND::getTimeCreation() const +{ + return m_timeCreation; +} + +void RevisionManifestStart4FND::setTimeCreation(const uint64_t &value) +{ + m_timeCreation = value; +} + +int32_t RevisionManifestStart4FND::getRevisionRole() const +{ + return m_revisionRole; +} + +void RevisionManifestStart4FND::setRevisionRole(const int32_t &value) +{ + m_revisionRole = value; +} + +uint16_t RevisionManifestStart4FND::getOdcsDefault() const +{ + return m_odcsDefault; +} + +void RevisionManifestStart4FND::setOdcsDefault(const uint16_t &value) +{ + m_odcsDefault = value; +} + +void RevisionManifestStart4FND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_rid; + input >> m_ridDependent; + input >> m_timeCreation; + input >> m_revisionRole; + input >> m_odcsDefault; +} + +std::string RevisionManifestStart4FND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RevisionManifestStart4FND.h b/src/lib/FileNodeData/RevisionManifestStart4FND.h new file mode 100644 index 0000000..fb96315 --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestStart4FND.h @@ -0,0 +1,52 @@ +#ifndef REVISIONMANIFESTSTART4FND_H +#define REVISIONMANIFESTSTART4FND_H + + +#include "IFileNodeData.h" + +#include "../ExtendedGUID.h" + +namespace libone +{ + +class RevisionManifestStart4FND : public IFileNodeData +{ +private: + ExtendedGUID m_rid; + ExtendedGUID m_ridDependent; + + uint64_t m_timeCreation; + int32_t m_revisionRole; + uint16_t m_odcsDefault; + +public: + RevisionManifestStart4FND(); + + uint16_t getOdcsDefault() const; + void setOdcsDefault(const uint16_t &value); + + int32_t getRevisionRole() const; + void setRevisionRole(const int32_t &value); + + uint64_t getTimeCreation() const; + void setTimeCreation(const uint64_t &value); + + ExtendedGUID getRidDependent() const; + void setRidDependent(const ExtendedGUID &value); + + ExtendedGUID getRid() const; + void setRid(const ExtendedGUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RevisionManifestStart4FND(*this); + } +}; + +} // namespace libone + +#endif // REVISIONMANIFESTSTART4FND_H diff --git a/src/lib/FileNodeData/RevisionManifestStart6FND.cpp b/src/lib/FileNodeData/RevisionManifestStart6FND.cpp new file mode 100644 index 0000000..f996acc --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestStart6FND.cpp @@ -0,0 +1,61 @@ +#include "RevisionManifestStart6FND.h" + +namespace libone +{ + +RevisionManifestStart6FND::RevisionManifestStart6FND() : m_rid(), m_ridDependent(), m_revisionRole(), m_odcsDefault() {} + +ExtendedGUID RevisionManifestStart6FND::getRid() const +{ + return m_rid; +} + +void RevisionManifestStart6FND::setRid(const ExtendedGUID &value) +{ + m_rid = value; +} + +ExtendedGUID RevisionManifestStart6FND::getRidDependent() const +{ + return m_ridDependent; +} + +void RevisionManifestStart6FND::setRidDependent(const ExtendedGUID &value) +{ + m_ridDependent = value; +} + +int32_t RevisionManifestStart6FND::getRevisionRole() const +{ + return m_revisionRole; +} + +void RevisionManifestStart6FND::setRevisionRole(const int32_t &value) +{ + m_revisionRole = value; +} + +uint16_t RevisionManifestStart6FND::getOdcsDefault() const +{ + return m_odcsDefault; +} + +void RevisionManifestStart6FND::setOdcsDefault(const uint16_t &value) +{ + m_odcsDefault = value; +} + +void RevisionManifestStart6FND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_rid; + input >> m_ridDependent; + input >> m_revisionRole; + input >> m_odcsDefault; +} + +std::string RevisionManifestStart6FND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RevisionManifestStart6FND.h b/src/lib/FileNodeData/RevisionManifestStart6FND.h new file mode 100644 index 0000000..552b7bb --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestStart6FND.h @@ -0,0 +1,46 @@ +#ifndef REVISIONMANIFESTSTART6FND_H +#define REVISIONMANIFESTSTART6FND_H + +#include "IFileNodeData.h" +#include "../ExtendedGUID.h" + +namespace libone +{ + +class RevisionManifestStart6FND : public IFileNodeData +{ +private: + ExtendedGUID m_rid; + ExtendedGUID m_ridDependent; + + int32_t m_revisionRole; + uint16_t m_odcsDefault; + +public: + RevisionManifestStart6FND(); + + uint16_t getOdcsDefault() const; + void setOdcsDefault(const uint16_t &value); + + int32_t getRevisionRole() const; + void setRevisionRole(const int32_t &value); + + ExtendedGUID getRidDependent() const; + void setRidDependent(const ExtendedGUID &value); + + ExtendedGUID getRid() const; + void setRid(const ExtendedGUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RevisionManifestStart6FND(*this); + } +}; + +} // namespace libone + +#endif // REVISIONMANIFESTSTART6FND_H diff --git a/src/lib/FileNodeData/RevisionManifestStart7FND.cpp b/src/lib/FileNodeData/RevisionManifestStart7FND.cpp new file mode 100644 index 0000000..ac6054e --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestStart7FND.cpp @@ -0,0 +1,39 @@ +#include "RevisionManifestStart7FND.h" + +namespace libone +{ +RevisionManifestStart7FND::RevisionManifestStart7FND() : m_base(), m_gctxid() {} + +ExtendedGUID RevisionManifestStart7FND::getGctxid() const +{ + return m_gctxid; +} + +void RevisionManifestStart7FND::setGctxid(const ExtendedGUID &value) +{ + m_gctxid = value; +} + +RevisionManifestStart6FND RevisionManifestStart7FND::getBase() const +{ + return m_base; +} + +void RevisionManifestStart7FND::setBase( + const RevisionManifestStart6FND &value) +{ + m_base = value; +} + +void RevisionManifestStart7FND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_base; + input >> m_gctxid; +} + +std::string RevisionManifestStart7FND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RevisionManifestStart7FND.h b/src/lib/FileNodeData/RevisionManifestStart7FND.h new file mode 100644 index 0000000..080c7cf --- /dev/null +++ b/src/lib/FileNodeData/RevisionManifestStart7FND.h @@ -0,0 +1,39 @@ +#ifndef REVISIONMANIFESTSTART7FND_H +#define REVISIONMANIFESTSTART7FND_H + +#include "../ExtendedGUID.h" +#include "IFileNodeData.h" +#include "RevisionManifestStart6FND.h" + +namespace libone +{ + +class RevisionManifestStart7FND : public IFileNodeData +{ +private: + RevisionManifestStart6FND m_base; + + ExtendedGUID m_gctxid; + +public: + RevisionManifestStart7FND(); + + RevisionManifestStart6FND getBase() const; + void setBase(const RevisionManifestStart6FND &value); + + ExtendedGUID getGctxid() const; + void setGctxid(const ExtendedGUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RevisionManifestStart7FND(*this); + } +}; + +} // namespace libone + +#endif // REVISIONMANIFESTSTART7FND_H diff --git a/src/lib/FileNodeData/RevisionRoleAndContextDeclarationFND.cpp b/src/lib/FileNodeData/RevisionRoleAndContextDeclarationFND.cpp new file mode 100644 index 0000000..2347e64 --- /dev/null +++ b/src/lib/FileNodeData/RevisionRoleAndContextDeclarationFND.cpp @@ -0,0 +1,42 @@ +#include "RevisionRoleAndContextDeclarationFND.h" + +namespace libone +{ + +RevisionRoleAndContextDeclarationFND::RevisionRoleAndContextDeclarationFND() :m_base(), m_gctxid() {} + +ExtendedGUID RevisionRoleAndContextDeclarationFND::getGctxid() const +{ + return m_gctxid; +} + +void RevisionRoleAndContextDeclarationFND::setGctxid( + const ExtendedGUID &value) +{ + m_gctxid = value; +} + +RevisionRoleDeclarationFND +RevisionRoleAndContextDeclarationFND::getBase() const +{ + return m_base; +} + +void RevisionRoleAndContextDeclarationFND::setBase( + const RevisionRoleDeclarationFND &value) +{ + m_base = value; +} + +void RevisionRoleAndContextDeclarationFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_base; + input >> m_gctxid; +} + +std::string RevisionRoleAndContextDeclarationFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RevisionRoleAndContextDeclarationFND.h b/src/lib/FileNodeData/RevisionRoleAndContextDeclarationFND.h new file mode 100644 index 0000000..a1dc2dc --- /dev/null +++ b/src/lib/FileNodeData/RevisionRoleAndContextDeclarationFND.h @@ -0,0 +1,39 @@ +#ifndef REVISIONROLEANDCONTEXTDECLARATIONFND_H +#define REVISIONROLEANDCONTEXTDECLARATIONFND_H + +#include "../ExtendedGUID.h" +#include "IFileNodeData.h" +#include "RevisionRoleDeclarationFND.h" + +namespace libone +{ + +class RevisionRoleAndContextDeclarationFND : public IFileNodeData +{ +private: + RevisionRoleDeclarationFND m_base; + + ExtendedGUID m_gctxid; + +public: + RevisionRoleAndContextDeclarationFND(); + + RevisionRoleDeclarationFND getBase() const; + void setBase(const RevisionRoleDeclarationFND &value); + + ExtendedGUID getGctxid() const; + void setGctxid(const ExtendedGUID &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RevisionRoleAndContextDeclarationFND(*this); + } +}; + +} // namespace libone + +#endif // REVISIONROLEANDCONTEXTDECLARATIONFND_H diff --git a/src/lib/FileNodeData/RevisionRoleDeclarationFND.cpp b/src/lib/FileNodeData/RevisionRoleDeclarationFND.cpp new file mode 100644 index 0000000..a23689e --- /dev/null +++ b/src/lib/FileNodeData/RevisionRoleDeclarationFND.cpp @@ -0,0 +1,38 @@ +#include "RevisionRoleDeclarationFND.h" + +namespace libone +{ +RevisionRoleDeclarationFND::RevisionRoleDeclarationFND(): m_rid(), m_RevisionRole() {} + +uint32_t RevisionRoleDeclarationFND::getRevisionRole() const +{ + return m_RevisionRole; +} + +void RevisionRoleDeclarationFND::setRevisionRole(const uint32_t &value) +{ + m_RevisionRole = value; +} + +ExtendedGUID RevisionRoleDeclarationFND::getRid() const +{ + return m_rid; +} + +void RevisionRoleDeclarationFND::setRid(const ExtendedGUID &value) +{ + m_rid = value; +} + +void RevisionRoleDeclarationFND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_rid; + input >> m_RevisionRole; +} + +std::string RevisionRoleDeclarationFND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RevisionRoleDeclarationFND.h b/src/lib/FileNodeData/RevisionRoleDeclarationFND.h new file mode 100644 index 0000000..1e662fe --- /dev/null +++ b/src/lib/FileNodeData/RevisionRoleDeclarationFND.h @@ -0,0 +1,37 @@ +#ifndef REVISIONROLEDECLARATIONFND_H +#define REVISIONROLEDECLARATIONFND_H + +#include "../ExtendedGUID.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class RevisionRoleDeclarationFND : public IFileNodeData +{ +private: + ExtendedGUID m_rid; + uint32_t m_RevisionRole; + +public: + RevisionRoleDeclarationFND(); + + ExtendedGUID getRid() const; + void setRid(const ExtendedGUID &value); + + uint32_t getRevisionRole() const; + void setRevisionRole(const uint32_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RevisionRoleDeclarationFND(*this); + } +}; + +} // namespace libone + +#endif // REVISIONROLEDECLARATIONFND_H diff --git a/src/lib/FileNodeData/RootObjectReference2FNDX.cpp b/src/lib/FileNodeData/RootObjectReference2FNDX.cpp new file mode 100644 index 0000000..7260a82 --- /dev/null +++ b/src/lib/FileNodeData/RootObjectReference2FNDX.cpp @@ -0,0 +1,40 @@ +#include "RootObjectReference2FNDX.h" + +namespace libone +{ + +RootObjectReference2FNDX::RootObjectReference2FNDX() : + m_oidRoot(), m_RootRole(0) {} + +CompactID RootObjectReference2FNDX::getOidRoot() const +{ + return m_oidRoot; +} + +void RootObjectReference2FNDX::setOidRoot(const CompactID &value) +{ + m_oidRoot = value; +} + +uint32_t RootObjectReference2FNDX::getRootRole() const +{ + return m_RootRole; +} + +void RootObjectReference2FNDX::setRootRole(const uint32_t &value) +{ + m_RootRole = value; +} + +void RootObjectReference2FNDX::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oidRoot; + input >> m_RootRole; +} + +std::string RootObjectReference2FNDX::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RootObjectReference2FNDX.h b/src/lib/FileNodeData/RootObjectReference2FNDX.h new file mode 100644 index 0000000..516d213 --- /dev/null +++ b/src/lib/FileNodeData/RootObjectReference2FNDX.h @@ -0,0 +1,37 @@ +#ifndef ROOTOBJECTREFERENCE2FNDX_H +#define ROOTOBJECTREFERENCE2FNDX_H + +#include "../CompactID.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class RootObjectReference2FNDX : public IFileNodeData +{ +private: + CompactID m_oidRoot; + uint32_t m_RootRole; + +public: + RootObjectReference2FNDX(); + + CompactID getOidRoot() const; + void setOidRoot(const CompactID &value); + + uint32_t getRootRole() const; + void setRootRole(const uint32_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RootObjectReference2FNDX(*this); + } +}; + +} // namespace libone + +#endif // ROOTOBJECTREFERENCE2FNDX_H diff --git a/src/lib/FileNodeData/RootObjectReference3FND.cpp b/src/lib/FileNodeData/RootObjectReference3FND.cpp new file mode 100644 index 0000000..4f22dd7 --- /dev/null +++ b/src/lib/FileNodeData/RootObjectReference3FND.cpp @@ -0,0 +1,38 @@ +#include "RootObjectReference3FND.h" + +namespace libone +{ +RootObjectReference3FND::RootObjectReference3FND() :m_oidRoot(), m_RootRole(0) {} + +uint32_t RootObjectReference3FND::getRootRole() const +{ + return m_RootRole; +} + +void RootObjectReference3FND::setRootRole(const uint32_t &value) +{ + m_RootRole = value; +} + +ExtendedGUID RootObjectReference3FND::getOidRoot() const +{ + return m_oidRoot; +} + +void RootObjectReference3FND::setOidRoot(const ExtendedGUID &value) +{ + m_oidRoot = value; +} + +void RootObjectReference3FND::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oidRoot; + input >> m_RootRole; +} + +std::string RootObjectReference3FND::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/FileNodeData/RootObjectReference3FND.h b/src/lib/FileNodeData/RootObjectReference3FND.h new file mode 100644 index 0000000..c1ad1b7 --- /dev/null +++ b/src/lib/FileNodeData/RootObjectReference3FND.h @@ -0,0 +1,37 @@ +#ifndef ROOTOBJECTREFERENCE3FND_H +#define ROOTOBJECTREFERENCE3FND_H + +#include "../ExtendedGUID.h" +#include "IFileNodeData.h" + +namespace libone +{ + +class RootObjectReference3FND : public IFileNodeData +{ +private: + ExtendedGUID m_oidRoot; + uint32_t m_RootRole; + +public: + RootObjectReference3FND(); + + ExtendedGUID getOidRoot() const; + void setOidRoot(const ExtendedGUID &value); + + uint32_t getRootRole() const; + void setRootRole(const uint32_t &value); + + void parse(const libone::RVNGInputStreamPtr_t &input) override; + + std::string to_string() const override; + + IFileNodeData *clone() const override + { + return new RootObjectReference3FND(*this); + } +}; + +} // namespace libone + +#endif // ROOTOBJECTREFERENCE3FND_H diff --git a/src/lib/FileNodeData/meson.build b/src/lib/FileNodeData/meson.build new file mode 100644 index 0000000..bacee7f --- /dev/null +++ b/src/lib/FileNodeData/meson.build @@ -0,0 +1,72 @@ +libone_source_files += files( + 'IFileNodeData.h', + 'IFileNodeData.cpp', + 'DataSignatureGroupDefinitionFND.h', + 'DataSignatureGroupDefinitionFND.cpp', + 'FileDataStoreListReferenceFND.h', + 'FileDataStoreListReferenceFND.cpp', + 'FileDataStoreObjectReferenceFND.h', + 'FileDataStoreObjectReferenceFND.cpp', + 'GlobalIdTableEntry2FNDX.h', + 'GlobalIdTableEntry2FNDX.cpp', + 'GlobalIdTableEntry3FNDX.h', + 'GlobalIdTableEntry3FNDX.cpp', + 'GlobalIdTableEntryFNDX.h', + 'GlobalIdTableEntryFNDX.cpp', + 'GlobalIdTableStartFNDX.h', + 'GlobalIdTableStartFNDX.cpp', + 'HashedChunkDescriptor2FND.h', + 'HashedChunkDescriptor2FND.cpp', + 'ObjectDataEncryptionKeyV2FNDX.h', + 'ObjectDataEncryptionKeyV2FNDX.cpp', + 'ObjectDeclaration2LargeRefCountFND.h', + 'ObjectDeclaration2LargeRefCountFND.cpp', + 'ObjectDeclaration2RefCountFND.h', + 'ObjectDeclaration2RefCountFND.cpp', + 'ObjectDeclarationFileData3LargeRefCountFND.h', + 'ObjectDeclarationFileData3LargeRefCountFND.cpp', + 'ObjectDeclarationFileData3RefCountFND.h', + 'ObjectDeclarationFileData3RefCountFND.cpp', + 'ObjectDeclarationWithRefCount2FNDX.h', + 'ObjectDeclarationWithRefCount2FNDX.cpp', + 'ObjectDeclarationWithRefCountFNDX.h', + 'ObjectDeclarationWithRefCountFNDX.cpp', + 'ObjectGroupListReferenceFND.h', + 'ObjectGroupListReferenceFND.cpp', + 'ObjectGroupStartFND.h', + 'ObjectGroupStartFND.cpp', + 'ObjectInfoDependencyOverridesFND.h', + 'ObjectInfoDependencyOverridesFND.cpp', + 'ObjectRevisionWithRefCount2FNDX.h', + 'ObjectRevisionWithRefCount2FNDX.cpp', + 'ObjectRevisionWithRefCountFNDX.h', + 'ObjectRevisionWithRefCountFNDX.cpp', + 'ObjectSpaceManifestListReferenceFND.h', + 'ObjectSpaceManifestListReferenceFND.cpp', + 'ObjectSpaceManifestListStartFND.h', + 'ObjectSpaceManifestListStartFND.cpp', + 'ObjectSpaceManifestRootFND.h', + 'ObjectSpaceManifestRootFND.cpp', + 'ReadOnlyObjectDeclaration2LargeRefCountFND.h', + 'ReadOnlyObjectDeclaration2LargeRefCountFND.cpp', + 'ReadOnlyObjectDeclaration2RefCountFND.h', + 'ReadOnlyObjectDeclaration2RefCountFND.cpp', + 'RevisionManifestListReferenceFND.h', + 'RevisionManifestListReferenceFND.cpp', + 'RevisionManifestListStartFND.h', + 'RevisionManifestListStartFND.cpp', + 'RevisionManifestStart4FND.h', + 'RevisionManifestStart4FND.cpp', + 'RevisionManifestStart6FND.h', + 'RevisionManifestStart6FND.cpp', + 'RevisionManifestStart7FND.h', + 'RevisionManifestStart7FND.cpp', + 'RevisionRoleAndContextDeclarationFND.h', + 'RevisionRoleAndContextDeclarationFND.cpp', + 'RevisionRoleDeclarationFND.h', + 'RevisionRoleDeclarationFND.cpp', + 'RootObjectReference2FNDX.h', + 'RootObjectReference2FNDX.cpp', + 'RootObjectReference3FND.h', + 'RootObjectReference3FND.cpp', +) diff --git a/src/lib/FileNodeList.h b/src/lib/FileNodeList.h index 42847dc..1a80a6b 100644 --- a/src/lib/FileNodeList.h +++ b/src/lib/FileNodeList.h @@ -16,6 +16,7 @@ #include "FileNode.h" #include "FileNodeListFragment.h" +#include "libone_utils.h" #include "libone_utils.h" diff --git a/src/lib/FileNodeListFragment.cpp b/src/lib/FileNodeListFragment.cpp index eaa4a04..e2d05c3 100644 --- a/src/lib/FileNodeListFragment.cpp +++ b/src/lib/FileNodeListFragment.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -51,24 +52,45 @@ void FileNodeListFragment::parse(const libone::RVNGInputStreamPtr_t &input) m_fnd_list_id = readU32(input, false); m_fragment_sequence = readU32(input, false); - FileNode node; - + uint32_t fileNodeCount = 0xFFFFFFFF; + /* TODO: not sure how to satisfy the 'Transaction' requirement */ +// TODO: set the Transaction's count to fileNodeCount, something like: +// +// if (getFileNodeCountMapping().contains(m_fnd_list_id)) { +// fileNodeCount = getFileNodeCountMapping()[m_fnd_list_id]; +// } do { + FileNode node; node.parse(input); DBMSG << "input@" << input->tell() << ", node " << node.to_string() << std::endl; - if (node.get_FileNodeID() != FndId::ChunkTerminatorFND) + if (node.get_FileNodeID() != FndId::fnd_invalid_id) { - m_fnd_list.push_back(node); - DBMSG << "Added node to node list of size " << m_fnd_list.size() << std::endl; + if (node.get_FileNodeID() != FndId::ChunkTerminatorFND) + { + fileNodeCount--; + m_fnd_list.push_back(node); + DBMSG << "Added node to node list of size " << m_fnd_list.size() << std::endl; + } + else + { + DBMSG << "Returning because ChunkTerminatorFND" << std::endl; + break; + } + } + else + { + DBMSG << "Returning because padding found" << std::endl; + break; } - - node.skip_node(input); - skip_padding(input); } - while (!is_end_of_list(node, input->tell())); + while ((m_offset + m_size - input->tell() - 20 > 4) && (fileNodeCount > 0)); + // the footer structure is 20 bytes long (FileChunkReference (12bytes), and magic (8bytes) + + // skip padding and ChunkTerminatorFND + input->seek(m_offset + m_size - 20, librevenge::RVNG_SEEK_SET); m_next_fragment.parse(input); @@ -84,45 +106,41 @@ void FileNodeListFragment::parse(const libone::RVNGInputStreamPtr_t &input) return; } -void FileNodeListFragment::skip_padding(const libone::RVNGInputStreamPtr_t &input) + +std::string FileNodeListFragment::to_string() { - int i; - for (i=0;; i++) - { - if (readU8(input, false) != 0) - { - input->seek(- sizeof(uint8_t), librevenge::RVNG_SEEK_CUR); - break; - } - } - DBMSG << "Skipped " << i << " bytes" << std::endl; + return std::string(); } -/* TODO: not sure how to satisfy the 'Transaction' requirement */ -bool FileNodeListFragment::is_end_of_list(FileNode current_node, long current_offset) +std::vector parseFileNodeListFragments(const libone::RVNGInputStreamPtr_t &input, const FileChunkReference &ref) { - if (current_node.get_FileNodeID() == FndId::ChunkTerminatorFND) - { - DBMSG << "Returning true because ChunkTerminatorFND" << std::endl; - return true; - } + uint64_t originalLocation = input->tell(); + + std::vector fragments {}; + + + input->seek(ref.get_location(), librevenge::RVNG_SEEK_SET); + FileNodeListFragment fragment(ref.get_location(), ref.get_size()); - if (m_next_fragment_offset - current_offset < 4) + fragment.parse(input); + fragments.push_back(fragment); + + + FileChunkReference nextFragmentRef = fragment.get_next_fragment(); + + while (!nextFragmentRef.is_fcrNil() && !nextFragmentRef.is_fcrZero()) { - DBMSG << "Returning true because < 4 bytes" << std::endl; - return true; + FileNodeListFragment nextFragment(nextFragmentRef.get_location(), nextFragmentRef.get_size()); + input->seek(nextFragmentRef.get_location(), librevenge::RVNG_SEEK_SET); + fragment.parse(input); + + nextFragmentRef = nextFragment.get_next_fragment(); + fragments.push_back(fragment); } - DBMSG << "Returning false (current_node " << fnd_id_to_string(current_node.get_FileNodeID()) - << ", current_offset@" << current_offset << ", next_fragment@" << m_next_fragment_offset - << std::endl; - return false; -} -std::string FileNodeListFragment::to_string() -{ - return std::string(); + input->seek(originalLocation, librevenge::RVNG_SEEK_SET); + return fragments; } -} - +} diff --git a/src/lib/FileNodeListFragment.h b/src/lib/FileNodeListFragment.h index 1a617a7..21c3cc1 100644 --- a/src/lib/FileNodeListFragment.h +++ b/src/lib/FileNodeListFragment.h @@ -22,6 +22,7 @@ namespace libone { + class FileNodeListFragment { public: @@ -70,6 +71,7 @@ class FileNodeListFragment const size_t field_size_footer = sizeof(footer_magic_id); }; +std::vector parseFileNodeListFragments(const libone::RVNGInputStreamPtr_t &input, const FileChunkReference &ref); } diff --git a/src/lib/JCID.cpp b/src/lib/JCID.cpp index d38c74b..266b5a2 100644 --- a/src/lib/JCID.cpp +++ b/src/lib/JCID.cpp @@ -16,6 +16,17 @@ namespace libone { +void JCID::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> value; +} + +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, JCID &obj) +{ + obj.parse(input); + return input; +} + std::string JCID::to_string() const { diff --git a/src/lib/JCID.h b/src/lib/JCID.h index b479b71..85b6374 100644 --- a/src/lib/JCID.h +++ b/src/lib/JCID.h @@ -14,16 +14,22 @@ #include #include +#include "libone_utils.h" + namespace libone { class JCID { public: - JCID(const uint32_t val) + JCID(const uint32_t val = 0) { value = val; } + void parse(const libone::RVNGInputStreamPtr_t &input); + + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, JCID &obj); + uint32_t get_value() const { return value; diff --git a/src/lib/ONEDocument.cpp b/src/lib/ONEDocument.cpp index b366b10..94fc9ab 100644 --- a/src/lib/ONEDocument.cpp +++ b/src/lib/ONEDocument.cpp @@ -70,9 +70,10 @@ ONEAPI ONEDocument::Result ONEDocument::parse(librevenge::RVNGInputStream *const ONEAPI ONEDocument::Result ONEDocument::parse(librevenge::RVNGInputStream *const input, librevenge::RVNGDrawingInterface *const document, const ONEDocument::Type type, const char *const) try { - /// \todo parsing the header doesn't seem to do anything here, also needs shared_ptr now -// Header header; -// header.parse(input); + const RVNGInputStreamPtr_t input_(input, ONEDummyDeleter()); + + Header header; + header.parse(input_); (void) document; // sanity check @@ -81,7 +82,6 @@ ONEAPI ONEDocument::Result ONEDocument::parse(librevenge::RVNGInputStream *const if (ONEDocument::TYPE_RESERVED1 <= type) return ONEDocument::RESULT_UNSUPPORTED_FORMAT; - const RVNGInputStreamPtr_t input_(input, ONEDummyDeleter()); OneNoteParser parser = OneNoteParser(input_, document); (void) parser; diff --git a/src/lib/Object.cpp b/src/lib/Object.cpp index 7aadc99..1516b32 100644 --- a/src/lib/Object.cpp +++ b/src/lib/Object.cpp @@ -99,13 +99,13 @@ void Object::parse_list(const libone::RVNGInputStreamPtr_t &input, FileNodeChunk ObjectSpaceStreamOfOIDs oids = ObjectSpaceStreamOfOIDs(guid); ObjectSpaceStreamOfOSIDs osids = ObjectSpaceStreamOfOSIDs(); ObjectSpaceStreamOfContextIDs contexts = ObjectSpaceStreamOfContextIDs(); - FileNodeList list(ref.get_location(), ref.get_size()); + FileNodeList list(ref.stp(), ref.cb()); FileNode node; if (jcid.get_value() == 0) return; long old = input->tell(); - input->seek(ref.get_location(), librevenge::RVNG_SEEK_SET); + input->seek(ref.stp(), librevenge::RVNG_SEEK_SET); object_refs = oids.parse(input); if (!oids.get_B()) diff --git a/src/lib/Object.h b/src/lib/Object.h index 8c65440..0cedd6a 100644 --- a/src/lib/Object.h +++ b/src/lib/Object.h @@ -27,7 +27,7 @@ namespace libone struct object_header { ExtendedGUID guid = ExtendedGUID(); - FileNodeChunkReference body = FileNodeChunkReference(stp_format::stp_invalid, cb_format::cb_invalid, 0); + FileNodeChunkReference body = FileNodeChunkReference(StpFormat::stp_invalid, CbFormat::cb_invalid); JCID jcid = JCID(0); uint32_t ref_count = 0; uint16_t fHasOidReferences = 0; @@ -49,7 +49,7 @@ class Object void parse_list(const libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref); private: - FileNodeChunkReference body = FileNodeChunkReference(stp_format::stp_invalid, cb_format::cb_invalid, 0); + FileNodeChunkReference body = FileNodeChunkReference(StpFormat::stp_invalid, CbFormat::cb_invalid); PropertySet set = PropertySet(); bool read_only = false; diff --git a/src/lib/ObjectDeclaration2Body.cpp b/src/lib/ObjectDeclaration2Body.cpp new file mode 100644 index 0000000..11434d8 --- /dev/null +++ b/src/lib/ObjectDeclaration2Body.cpp @@ -0,0 +1,70 @@ +#include "ObjectDeclaration2Body.h" + +namespace libone +{ + +ObjectDeclaration2Body::ObjectDeclaration2Body() :m_oid(), m_jcid(), m_fHasOidReferences(false), m_fHasOsidReferences(false) {} + +bool ObjectDeclaration2Body::getFHasOsidReferences() const +{ + return m_fHasOsidReferences; +} + +void ObjectDeclaration2Body::setFHasOsidReferences(bool value) +{ + m_fHasOsidReferences = value; +} + +bool ObjectDeclaration2Body::getFHasOidReferences() const +{ + return m_fHasOidReferences; +} + +void ObjectDeclaration2Body::setFHasOidReferences(bool value) +{ + m_fHasOidReferences = value; +} + +JCID ObjectDeclaration2Body::getJcid() const +{ + return m_jcid; +} + +void ObjectDeclaration2Body::setJcid(const JCID &value) +{ + m_jcid = value; +} + +CompactID ObjectDeclaration2Body::getOid() const +{ + return m_oid; +} + +void ObjectDeclaration2Body::setOid(const CompactID &value) +{ + m_oid = value; +} + +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, ObjectDeclaration2Body &obj) +{ + obj.parse(input); + return input; +} + +void ObjectDeclaration2Body::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oid; + input >> m_jcid; + + uint8_t temp; + input >> temp; + m_fHasOidReferences = temp & 0x1; + m_fHasOsidReferences = (temp >> 1) & 0x1; +} + +std::string ObjectDeclaration2Body::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/ObjectDeclaration2Body.h b/src/lib/ObjectDeclaration2Body.h new file mode 100644 index 0000000..20350cc --- /dev/null +++ b/src/lib/ObjectDeclaration2Body.h @@ -0,0 +1,42 @@ +#ifndef OBJECTDECLARATION2BODY_H +#define OBJECTDECLARATION2BODY_H + +#include "CompactID.h" +#include "JCID.h" + +#include "libone_utils.h" + +namespace libone +{ + +class ObjectDeclaration2Body +{ +private: + CompactID m_oid; + JCID m_jcid; + + bool m_fHasOidReferences; + bool m_fHasOsidReferences; + +public: + ObjectDeclaration2Body(); + + CompactID getOid() const; + void setOid(const CompactID &value); + JCID getJcid() const; + void setJcid(const JCID &value); + bool getFHasOidReferences() const; + void setFHasOidReferences(bool value); + bool getFHasOsidReferences() const; + void setFHasOsidReferences(bool value); + + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, ObjectDeclaration2Body &obj); + + void parse(const libone::RVNGInputStreamPtr_t &input); + + std::string to_string() const; +}; + +} // namespace libone + +#endif // OBJECTDECLARATION2BODY_H diff --git a/src/lib/ObjectDeclarationWithRefCountBody.cpp b/src/lib/ObjectDeclarationWithRefCountBody.cpp new file mode 100644 index 0000000..6232286 --- /dev/null +++ b/src/lib/ObjectDeclarationWithRefCountBody.cpp @@ -0,0 +1,82 @@ +#include "ObjectDeclarationWithRefCountBody.h" + +namespace libone +{ + +ObjectDeclarationWithRefCountBody::ObjectDeclarationWithRefCountBody() + : m_oid(), m_jci(), m_odcs(), m_fReserved1(), + m_fHasOidReferences(false), m_fHasOsidReferences(false), m_fReserved2() {} + +bool ObjectDeclarationWithRefCountBody::getFHasOsidReferences() const +{ + return m_fHasOsidReferences; +} + +void ObjectDeclarationWithRefCountBody::setFHasOsidReferences(bool value) +{ + m_fHasOsidReferences = value; +} + +bool ObjectDeclarationWithRefCountBody::getFHasOidReferences() const +{ + return m_fHasOidReferences; +} + +void ObjectDeclarationWithRefCountBody::setFHasOidReferences(bool value) +{ + m_fHasOidReferences = value; +} + +uint8_t ObjectDeclarationWithRefCountBody::getOdc() const +{ + return m_odcs; +} + +void ObjectDeclarationWithRefCountBody::setOdc(const uint8_t &value) +{ + m_odcs = value; +} + +uint8_t ObjectDeclarationWithRefCountBody::getJci() const +{ + return m_jci; +} + +void ObjectDeclarationWithRefCountBody::setJci(const uint8_t &value) +{ + m_jci = value; +} + +CompactID ObjectDeclarationWithRefCountBody::getOid() const +{ + return m_oid; +} + +void ObjectDeclarationWithRefCountBody::setOid(const CompactID &value) +{ + m_oid = value; +} + +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, + ObjectDeclarationWithRefCountBody &obj) +{ + obj.parse(input); + return input; +} + +void ObjectDeclarationWithRefCountBody::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oid; + uint32_t temp; + + input >> temp; + m_jci = temp & 0x3FF; + m_odcs = (temp >> 10) & 0xF; + m_fReserved1 = (temp >> 14) & 0x3; + m_fHasOidReferences = (temp >> 16) & 0x1; + m_fHasOsidReferences = (temp >> 17) & 0x1; + + skip(input, 2u); +} + +} // namespace libone diff --git a/src/lib/ObjectDeclarationWithRefCountBody.h b/src/lib/ObjectDeclarationWithRefCountBody.h new file mode 100644 index 0000000..a12eb21 --- /dev/null +++ b/src/lib/ObjectDeclarationWithRefCountBody.h @@ -0,0 +1,53 @@ +#ifndef OBJECTDECLARATIONWITHREFCOUNTBODY_H +#define OBJECTDECLARATIONWITHREFCOUNTBODY_H + +#include "CompactID.h" + +namespace libone +{ + +class ObjectDeclarationWithRefCountBody +{ +private: + CompactID m_oid; + + uint8_t m_jci; + uint8_t m_odcs; + + uint8_t m_fReserved1; + + bool m_fHasOidReferences; + bool m_fHasOsidReferences; + + uint32_t m_fReserved2; + +public: + ObjectDeclarationWithRefCountBody(); + + + CompactID getOid() const; + void setOid(const CompactID &value); + + uint8_t getJci() const; + void setJci(const uint8_t &value); + + uint8_t getOdc() const; + void setOdc(const uint8_t &value); + + bool getFHasOidReferences() const; + void setFHasOidReferences(bool value); + + bool getFHasOsidReferences() const; + void setFHasOsidReferences(bool value); + + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, + ObjectDeclarationWithRefCountBody &obj); + + void parse(const libone::RVNGInputStreamPtr_t &input); + + std::string to_string() const; +}; + +} // namespace libone + +#endif // OBJECTDECLARATIONWITHREFCOUNTBODY_H diff --git a/src/lib/ObjectGroup.cpp b/src/lib/ObjectGroup.cpp index 0a849c3..d845ab4 100644 --- a/src/lib/ObjectGroup.cpp +++ b/src/lib/ObjectGroup.cpp @@ -13,9 +13,9 @@ namespace libone { -std::unordered_map ObjectGroup::list_parse(libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref) +std::unordered_map ObjectGroup::list_parse(const libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref) { - FileNodeList list(ref.get_location(), ref.get_size()); + FileNodeList list(ref.stp(), ref.cb()); std::unordered_map object_map = std::unordered_map(); GUID temp = GUID(); DBMSG << "GUID " << temp.to_string(); diff --git a/src/lib/ObjectGroup.h b/src/lib/ObjectGroup.h index 0550afd..6b1939f 100644 --- a/src/lib/ObjectGroup.h +++ b/src/lib/ObjectGroup.h @@ -26,7 +26,7 @@ namespace libone class ObjectGroup { public: - std::unordered_map list_parse(libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref); + std::unordered_map list_parse(const libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref); std::string get_guid(); private: diff --git a/src/lib/ObjectInfoDependencyOverride32.cpp b/src/lib/ObjectInfoDependencyOverride32.cpp new file mode 100644 index 0000000..ed67f22 --- /dev/null +++ b/src/lib/ObjectInfoDependencyOverride32.cpp @@ -0,0 +1,46 @@ +#include "ObjectInfoDependencyOverride32.h" + +namespace libone +{ + +ObjectInfoDependencyOverride32::ObjectInfoDependencyOverride32() : m_oid(), m_cRef() {} + + +CompactID ObjectInfoDependencyOverride32::oid() const +{ + return m_oid; +} + +void ObjectInfoDependencyOverride32::setOid(const CompactID &oid) +{ + m_oid = oid; +} + +uint32_t ObjectInfoDependencyOverride32::cRef() const +{ + return m_cRef; +} + +void ObjectInfoDependencyOverride32::setCRef(const uint32_t &cRef) +{ + m_cRef = cRef; +} + +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, ObjectInfoDependencyOverride32 &obj) +{ + obj.parse(input); + return input; +} + +void ObjectInfoDependencyOverride32::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oid; + input >> m_cRef; +} + +std::string ObjectInfoDependencyOverride32::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/ObjectInfoDependencyOverride32.h b/src/lib/ObjectInfoDependencyOverride32.h new file mode 100644 index 0000000..0a4289e --- /dev/null +++ b/src/lib/ObjectInfoDependencyOverride32.h @@ -0,0 +1,34 @@ +#ifndef OBJECTINFODEPENDENCYOVERRIDE32_H +#define OBJECTINFODEPENDENCYOVERRIDE32_H + +#include "CompactID.h" + +namespace libone +{ + +class ObjectInfoDependencyOverride32 +{ +private: + CompactID m_oid; + uint32_t m_cRef; + +public: + ObjectInfoDependencyOverride32(); + + CompactID oid() const; + void setOid(const CompactID &oid); + + uint32_t cRef() const; + void setCRef(const uint32_t &cRef); + + + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, + ObjectInfoDependencyOverride32 &obj); + void parse(const libone::RVNGInputStreamPtr_t &input); + + std::string to_string() const; +}; + +} // namespace libone + +#endif // OBJECTINFODEPENDENCYOVERRIDE32_H diff --git a/src/lib/ObjectInfoDependencyOverride8.cpp b/src/lib/ObjectInfoDependencyOverride8.cpp new file mode 100644 index 0000000..cfe0a46 --- /dev/null +++ b/src/lib/ObjectInfoDependencyOverride8.cpp @@ -0,0 +1,46 @@ +#include "ObjectInfoDependencyOverride8.h" + +namespace libone +{ + +ObjectInfoDependencyOverride8::ObjectInfoDependencyOverride8() : m_oid(), m_cRef() {} + + +CompactID ObjectInfoDependencyOverride8::oid() const +{ + return m_oid; +} + +void ObjectInfoDependencyOverride8::setOid(const CompactID &oid) +{ + m_oid = oid; +} + +uint8_t ObjectInfoDependencyOverride8::cRef() const +{ + return m_cRef; +} + +void ObjectInfoDependencyOverride8::setCRef(const uint8_t &cRef) +{ + m_cRef = cRef; +} + +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, ObjectInfoDependencyOverride8 &obj) +{ + obj.parse(input); + return input; +} + +void ObjectInfoDependencyOverride8::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_oid; + input >> m_cRef; +} + +std::string ObjectInfoDependencyOverride8::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/ObjectInfoDependencyOverride8.h b/src/lib/ObjectInfoDependencyOverride8.h new file mode 100644 index 0000000..1bcc97e --- /dev/null +++ b/src/lib/ObjectInfoDependencyOverride8.h @@ -0,0 +1,33 @@ +#ifndef OBJECTINFODEPENDENCYOVERRIDE8_H +#define OBJECTINFODEPENDENCYOVERRIDE8_H + +#include "CompactID.h" + +namespace libone +{ + +class ObjectInfoDependencyOverride8 +{ +private: + CompactID m_oid; + uint8_t m_cRef; + +public: + ObjectInfoDependencyOverride8(); + + CompactID oid() const; + void setOid(const CompactID &oid); + + uint8_t cRef() const; + void setCRef(const uint8_t &cRef); + + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, + ObjectInfoDependencyOverride8 &obj); + void parse(const libone::RVNGInputStreamPtr_t &input); + + std::string to_string() const; +}; + +} // namespace libone + +#endif // OBJECTINFODEPENDENCYOVERRIDE8_H diff --git a/src/lib/ObjectInfoDependencyOverrideData.cpp b/src/lib/ObjectInfoDependencyOverrideData.cpp new file mode 100644 index 0000000..6756a73 --- /dev/null +++ b/src/lib/ObjectInfoDependencyOverrideData.cpp @@ -0,0 +1,100 @@ +#include "ObjectInfoDependencyOverrideData.h" + +namespace libone +{ + +ObjectInfoDependencyOverrideData::ObjectInfoDependencyOverrideData() + : m_c8BitOverrides(), m_c32BitOverrides(), m_crc(), m_Overrides1{}, m_Overrides2{} {} + + +uint32_t ObjectInfoDependencyOverrideData::c8BitOverrides() const +{ + return m_c8BitOverrides; +} + +void ObjectInfoDependencyOverrideData::setC8BitOverrides( + const uint32_t &c8BitOverrides) +{ + m_c8BitOverrides = c8BitOverrides; +} + +uint32_t ObjectInfoDependencyOverrideData::c32BitOverrides() const +{ + return m_c32BitOverrides; +} + +void ObjectInfoDependencyOverrideData::setC32BitOverrides( + const uint32_t &c32BitOverrides) +{ + m_c32BitOverrides = c32BitOverrides; +} + +uint32_t ObjectInfoDependencyOverrideData::crc() const +{ + return m_crc; +} + +void ObjectInfoDependencyOverrideData::setCrc(const uint32_t &crc) +{ + m_crc = crc; +} + +std::vector +ObjectInfoDependencyOverrideData::Overrides1() const +{ + return m_Overrides1; +} + +void ObjectInfoDependencyOverrideData::setOverrides1( + const std::vector &Overrides1) +{ + m_Overrides1 = Overrides1; +} + +std::vector +ObjectInfoDependencyOverrideData::Overrides2() const +{ + return m_Overrides2; +} + +void ObjectInfoDependencyOverrideData::setOverrides2( + const std::vector &Overrides2) +{ + m_Overrides2 = Overrides2; +} + + +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, + ObjectInfoDependencyOverrideData &obj) +{ + obj.parse(input); + return input; +} + +void ObjectInfoDependencyOverrideData::parse(const libone::RVNGInputStreamPtr_t &input) +{ + input >> m_c8BitOverrides; + input >> m_c32BitOverrides; + input >> m_crc; + + ObjectInfoDependencyOverride8 temp8; + for (size_t i{0}; i < m_c8BitOverrides; i++) + { + input >> temp8; + m_Overrides1.push_back(temp8); + } + + ObjectInfoDependencyOverride32 temp32; + for (size_t i{0}; i < m_c8BitOverrides; i++) + { + input >> temp32; + m_Overrides2.push_back(temp32); + } +} + +std::string ObjectInfoDependencyOverrideData::to_string() const +{ + return ""; +} + +} // namespace libone diff --git a/src/lib/ObjectInfoDependencyOverrideData.h b/src/lib/ObjectInfoDependencyOverrideData.h new file mode 100644 index 0000000..0a74bc9 --- /dev/null +++ b/src/lib/ObjectInfoDependencyOverrideData.h @@ -0,0 +1,54 @@ +#ifndef OBJECTINFODEPENDENCYOVERRIDEDATA_H +#define OBJECTINFODEPENDENCYOVERRIDEDATA_H + +#include + +#include "ObjectInfoDependencyOverride32.h" +#include "ObjectInfoDependencyOverride8.h" + +namespace libone +{ + +class ObjectInfoDependencyOverrideData +{ +private: + uint32_t m_c8BitOverrides; + uint32_t m_c32BitOverrides; + + uint32_t m_crc; + + std::vector m_Overrides1; + std::vector m_Overrides2; + +public: + ObjectInfoDependencyOverrideData(); + + + uint32_t c8BitOverrides() const; + void setC8BitOverrides(const uint32_t &c8BitOverrides); + + uint32_t c32BitOverrides() const; + void setC32BitOverrides(const uint32_t &c32BitOverrides); + + uint32_t crc() const; + void setCrc(const uint32_t &crc); + + std::vector Overrides1() const; + void + setOverrides1(const std::vector &Overrides1); + + std::vector Overrides2() const; + void + setOverrides2(const std::vector &Overrides2); + + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, + ObjectInfoDependencyOverrideData &obj); + + void parse(const libone::RVNGInputStreamPtr_t &input); + + std::string to_string() const; +}; + +} // namespace libone + +#endif // OBJECTINFODEPENDENCYOVERRIDEDATA_H diff --git a/src/lib/ObjectSpace.cpp b/src/lib/ObjectSpace.cpp index 7976381..99746c6 100644 --- a/src/lib/ObjectSpace.cpp +++ b/src/lib/ObjectSpace.cpp @@ -10,6 +10,7 @@ #include "libone_utils.h" #include "ObjectSpace.h" +#include "FileNodeData/FileNodeData.h" namespace libone { @@ -20,9 +21,9 @@ ObjectSpace::ObjectSpace() void ObjectSpace::parse(const libone::RVNGInputStreamPtr_t &input, FileNode &node) { - m_fnd_list_ref = node.get_fnd(); + m_fnd_list_ref = static_cast(node.get_fnd())->getRef(); - FileNodeList list = FileNodeList(m_fnd_list_ref.get_location(), m_fnd_list_ref.get_size()); + FileNodeList list = FileNodeList(m_fnd_list_ref.stp(), m_fnd_list_ref.cb()); // We should then be at the 'gosid' field input->seek(node.get_location() + node.header_size + m_fnd_list_ref.get_size_in_file(), @@ -40,7 +41,7 @@ void ObjectSpace::list_parse(const libone::RVNGInputStreamPtr_t &input, Extended Revision rev; FileNode node; FileNode node2; - FileNodeList list = FileNodeList(ref.get_location(), ref.get_size()); + FileNodeList list = FileNodeList(ref.stp(), ref.cb()); ExtendedGUID temp; temp.zero(); @@ -49,7 +50,7 @@ void ObjectSpace::list_parse(const libone::RVNGInputStreamPtr_t &input, Extended list.parse(input); ONE_DEBUG_MSG(("trying to parse last revision\n")); - rev.list_parse(input, node2.get_fnd()); + rev.list_parse(input, node2.fncr()); revisions.push_back(rev); ONE_DEBUG_MSG(("\n")); } diff --git a/src/lib/ObjectSpace.h b/src/lib/ObjectSpace.h index 29d2c1a..ef1dd63 100644 --- a/src/lib/ObjectSpace.h +++ b/src/lib/ObjectSpace.h @@ -35,7 +35,7 @@ class ObjectSpace private: uint64_t m_offset = 0; - FileNodeChunkReference m_fnd_list_ref = FileNodeChunkReference(stp_format::stp_invalid, cb_format::cb_invalid, 0); + FileNodeChunkReference m_fnd_list_ref = FileNodeChunkReference(StpFormat::stp_invalid, CbFormat::cb_invalid); ExtendedGUID guid = ExtendedGUID(); ExtendedGUID context = ExtendedGUID(); std::vector revisions = std::vector(); diff --git a/src/lib/Revision.cpp b/src/lib/Revision.cpp index d4a4e38..e7a0b1f 100644 --- a/src/lib/Revision.cpp +++ b/src/lib/Revision.cpp @@ -21,12 +21,12 @@ namespace libone void Revision::list_parse(const libone::RVNGInputStreamPtr_t &input, FileNodeChunkReference ref) { - FileNodeList list(ref.get_location(), ref.get_size()); + FileNodeList list(ref.stp(), ref.cb()); FileNode node; // ObjectGroup group; ExtendedGUID temp; // Object object; - input->seek(ref.get_location(), librevenge::RVNG_SEEK_SET); + input->seek(ref.stp(), librevenge::RVNG_SEEK_SET); ONE_DEBUG_MSG(("trying to revision at %lu\n", input->tell())); list.parse(input); @@ -60,11 +60,11 @@ void Revision::parse_dependencies(const libone::RVNGInputStreamPtr_t &input, Fil (void) n_8bitoverrides; (void) n_32bitoverrides; - if (!node.get_fnd().is_fcrNil()) + if (!node.fncr().is_fcrNil()) { ONE_DEBUG_MSG((" for dependencies\n")); old = input->tell(); - input->seek(node.get_fnd().get_location(), librevenge::RVNG_SEEK_SET); + input->seek(node.fncr().stp(), librevenge::RVNG_SEEK_SET); } n_8bitoverrides = readU32(input, false); @@ -82,7 +82,7 @@ void Revision::parse_dependencies(const libone::RVNGInputStreamPtr_t &input, Fil ONE_DEBUG_MSG(("\n")); } */ - if (!node.get_fnd().is_fcrNil()) + if (!node.fncr().is_fcrNil()) input->seek(old, librevenge::RVNG_SEEK_SET); } diff --git a/src/lib/StringInStorageBuffer.cpp b/src/lib/StringInStorageBuffer.cpp index ef88864..4802c55 100644 --- a/src/lib/StringInStorageBuffer.cpp +++ b/src/lib/StringInStorageBuffer.cpp @@ -18,6 +18,12 @@ namespace libone { +const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, StringInStorageBuffer &obj) +{ + obj.parse(input); + return input; +} + void StringInStorageBuffer::parse(const libone::RVNGInputStreamPtr_t &input) { diff --git a/src/lib/StringInStorageBuffer.h b/src/lib/StringInStorageBuffer.h index 90063b4..7606d09 100644 --- a/src/lib/StringInStorageBuffer.h +++ b/src/lib/StringInStorageBuffer.h @@ -23,6 +23,7 @@ namespace libone class StringInStorageBuffer { public: + friend const libone::RVNGInputStreamPtr_t &operator>>(const libone::RVNGInputStreamPtr_t &input, StringInStorageBuffer &obj); void parse(const libone::RVNGInputStreamPtr_t &input); uint32_t length = 0; std::string to_string(); diff --git a/src/lib/meson.build b/src/lib/meson.build index fe68e57..e654956 100644 --- a/src/lib/meson.build +++ b/src/lib/meson.build @@ -33,6 +33,16 @@ libone_source_files = [ 'JCID.cpp', 'OneNoteParser.h', 'OneNoteParser.cpp', + 'ObjectInfoDependencyOverride32.cpp', + 'ObjectInfoDependencyOverride32.h', + 'ObjectInfoDependencyOverride8.cpp', + 'ObjectInfoDependencyOverride8.h', + 'ObjectInfoDependencyOverrideData.cpp', + 'ObjectInfoDependencyOverrideData.h', + 'ObjectDeclaration2Body.cpp', + 'ObjectDeclaration2Body.h', + 'ObjectDeclarationWithRefCountBody.cpp', + 'ObjectDeclarationWithRefCountBody.h', 'PropertySet.h', 'PropertySet.cpp', 'PropertyID.h', @@ -55,6 +65,8 @@ libone_source_files = [ 'libone_utils.h' ] +subdir('FileNodeData') + libone_source_dependencies = [ librevenge_dep, librevenge_stream_dep, @@ -75,4 +87,5 @@ libone_target = library( include_directories : libone_include_directory, ) + ## vim:set shiftwidth=4 tabstop=4 noexpandtab: