AbstractFile.h 809 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2008-2022 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "../IO/Serializer.h"
  5. #include "../IO/Deserializer.h"
  6. namespace Urho3D
  7. {
  8. /// A common root class for objects that implement both Serializer and Deserializer.
  9. class URHO3D_API AbstractFile : public Deserializer, public Serializer
  10. {
  11. public:
  12. /// Construct.
  13. AbstractFile() : Deserializer() { }
  14. /// Construct.
  15. explicit AbstractFile(i64 size) : Deserializer(size) { }
  16. /// Destruct.
  17. ~AbstractFile() override = default;
  18. /// Change the file name. Used by the resource system.
  19. /// @property
  20. virtual void SetName(const String& name) { name_ = name; }
  21. /// Return the file name.
  22. const String& GetName() const override { return name_; }
  23. protected:
  24. /// File name.
  25. String name_;
  26. };
  27. }