Reference.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef REFERENCE_H_
  2. #define REFERENCE_H_
  3. #include "Object.h"
  4. namespace gameplay
  5. {
  6. class Reference : public Object
  7. {
  8. public:
  9. /**
  10. * Constructor.
  11. */
  12. Reference(void);
  13. Reference(std::string _xref, Object* _ref);
  14. /**
  15. * Destructor.
  16. */
  17. virtual ~Reference(void);
  18. virtual const char* getElementName(void) const;
  19. virtual void writeBinary(FILE* file);
  20. virtual void writeText(FILE* file);
  21. /**
  22. * Updates the offset of this Reference object if it has already need written to file.
  23. * @param file The file stream.
  24. *
  25. * @return True if the offset was updates, false otherwise.
  26. */
  27. bool updateOffset(FILE* file);
  28. /**
  29. * Updates the offset of this Reference object if it has already need written to file.
  30. * @param file The file stream.
  31. * @param newOffset The new file offset.
  32. *
  33. * @return True if the offset in the binary file was updated. False if this ref hasn't been written to file yet.
  34. */
  35. bool updateOffset(FILE* file, long newOffset);
  36. Object* getObj();
  37. private:
  38. std::string _xref;
  39. unsigned int _type;
  40. unsigned int _offset;
  41. Object* _ref;
  42. };
  43. }
  44. #endif