header.h 751 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include "foundation/types.h"
  3. #include "nu/ByteWriter.h"
  4. class nstest;
  5. namespace APEv2
  6. {
  7. class Header
  8. {
  9. friend class ::nstest;
  10. public:
  11. Header();
  12. Header(const void *data);
  13. void SetSize(uint32_t size) { this->size = size; }
  14. void SetFlags(uint32_t flags) { this->flags = flags; }
  15. void SetItems(uint32_t items) { this->items = items; }
  16. bool Valid() const;
  17. uint32_t TagSize() const;
  18. bool HasHeader() const;
  19. bool HasFooter() const;
  20. bool IsFooter() const;
  21. bool IsHeader() const;
  22. int Encode(bytewriter_t byte_writer) const;
  23. uint32_t GetFlags() const;
  24. enum
  25. {
  26. SIZE=32,
  27. };
  28. private:
  29. uint8_t preamble[8];
  30. uint32_t version;
  31. uint32_t size;
  32. uint32_t items;
  33. uint32_t flags;
  34. uint64_t reserved;
  35. };
  36. }