SerializableAttribute.h 850 B

1234567891011121314151617181920212223242526
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Jolt/ObjectStream/ObjectStreamIn.h>
  5. #include <Jolt/ObjectStream/ObjectStreamOut.h>
  6. JPH_NAMESPACE_BEGIN
  7. /// Attributes are members of classes that need to be serialized. This extends the
  8. /// basic attribute defined in RTTI.h
  9. class SerializableAttribute : public RTTIAttribute
  10. {
  11. public:
  12. /// Constructor
  13. using RTTIAttribute::RTTIAttribute;
  14. ///@name Serialization operations
  15. virtual bool IsType(int inArrayDepth, ObjectStream::EDataType inDataType, const char *inClassName) const = 0;
  16. virtual bool ReadData(ObjectStreamIn &ioStream, void *inObject) const = 0;
  17. virtual void WriteData(ObjectStreamOut &ioStream, const void *inObject) const = 0;
  18. virtual void WriteDataType(ObjectStreamOut &ioStream) const = 0;
  19. };
  20. JPH_NAMESPACE_END