file_node_iterator.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef FILE_NODE_ITERATOR_H
  2. #define FILE_NODE_ITERATOR_H
  3. #include "file_node_visitor.h"
  4. namespace binom {
  5. class FileNodeVisitor::NodeIterator {
  6. ui64 index = 0;
  7. ObjectDescriptor obj_descriptor = {};
  8. real_index name_block_index = 0;
  9. real_index name_shift = 0;
  10. real_index name_index = 0;
  11. ObjectNameLength name_block_descriptor = {};
  12. VarType container_type;
  13. FileNodeVisitor& node_visitor;
  14. friend class FileNodeVisitor;
  15. NodeIterator(FileNodeVisitor& node_visitor, bool is_end = false);
  16. NodeIterator(FileNodeVisitor& node_visitor, ObjectElementPosition pos);
  17. NodeIterator(FileNodeVisitor& node_visitor, ui64 index);
  18. public:
  19. NodeIterator(const NodeIterator& other);
  20. NodeIterator(const NodeIterator&& other);
  21. inline bool isBegin() { return !index; }
  22. bool isEnd();
  23. NodeIterator& operator--();
  24. NodeIterator& operator++();
  25. inline NodeIterator& operator++(int) {return ++*this;}
  26. std::optional<BufferArray> getName();
  27. bool operator==(NodeIterator iterator) const;
  28. bool operator!=(NodeIterator iterator) const;
  29. inline FileNodeVisitor getParent() {return node_visitor;}
  30. FileNodeVisitor operator*();
  31. };
  32. }
  33. #endif // FILE_NODE_ITERATOR_H