From aad9f75239777353257b44a44a7c13238f06831d Mon Sep 17 00:00:00 2001 From: jakcron Date: Sun, 27 May 2018 20:33:21 +0800 Subject: [PATCH] [nx] Add stubbed NsoHeader --- lib/libnx/include/nx/NsoHeader.h | 46 ++++++++++++++++++++++ lib/libnx/source/NsoHeader.cpp | 65 ++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 lib/libnx/include/nx/NsoHeader.h create mode 100644 lib/libnx/source/NsoHeader.cpp diff --git a/lib/libnx/include/nx/NsoHeader.h b/lib/libnx/include/nx/NsoHeader.h new file mode 100644 index 0000000..07d5e81 --- /dev/null +++ b/lib/libnx/include/nx/NsoHeader.h @@ -0,0 +1,46 @@ +#pragma once +#include +#include +#include +#include + +namespace nx +{ + class NsoHeader : + public fnd::ISerialiseableBinary + { + public: + NsoHeader(); + NsoHeader(const NsoHeader& other); + NsoHeader(const byte_t* bytes, size_t len); + + bool operator==(const NsoHeader& other) const; + bool operator!=(const NsoHeader& other) const; + void operator=(const NsoHeader& other); + + // to be used after export + const byte_t* getBytes() const; + size_t getSize() const; + + // export/import binary + void exportBinary(); + void importBinary(const byte_t* bytes, size_t len); + + // variables + void clear(); + + + private: + const std::string kModuleName = "NSO_HEADER"; + + // binary + fnd::MemoryBlob mBinaryBlob; + + // data + + // helpers + bool isEqual(const NsoHeader& other) const; + void copyFrom(const NsoHeader& other); + }; + +} \ No newline at end of file diff --git a/lib/libnx/source/NsoHeader.cpp b/lib/libnx/source/NsoHeader.cpp new file mode 100644 index 0000000..6aa0ad9 --- /dev/null +++ b/lib/libnx/source/NsoHeader.cpp @@ -0,0 +1,65 @@ +#include + +nx::NsoHeader::NsoHeader() +{ + +} + +nx::NsoHeader::NsoHeader(const NsoHeader& other) +{ + copyFrom(other); +} + +nx::NsoHeader::NsoHeader(const byte_t* bytes, size_t len) +{ + importBinary(bytes, len); +} + +bool nx::NsoHeader::operator==(const NsoHeader& other) const +{ + return isEqual(other); +} + +bool nx::NsoHeader::operator!=(const NsoHeader& other) const +{ + return !(*this == other); +} + +void nx::NsoHeader::operator=(const NsoHeader& other) +{ + copyFrom(other); +} + +const byte_t* nx::NsoHeader::getBytes() const +{ + return mBinaryBlob.getBytes(); +} + +size_t nx::NsoHeader::getSize() const +{ + return mBinaryBlob.getSize(); +} + +void nx::NsoHeader::exportBinary() +{ + throw fnd::Exception(kModuleName, "exportBinary() not implemented"); +} + +void nx::NsoHeader::importBinary(const byte_t* bytes, size_t len) +{ + throw fnd::Exception(kModuleName, "importBinary() not implemented"); +} + +void nx::NsoHeader::clear() +{ + +} + +bool nx::NsoHeader::isEqual(const NsoHeader& other) const +{ + return false; +} +void nx::NsoHeader::copyFrom(const NsoHeader& other) +{ + +} \ No newline at end of file