Resource.pkg 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. $#include "Resource/Resource.h"
  2. class Resource
  3. {
  4. bool Load(Deserializer& source);
  5. bool Save(Serializer& dest) const;
  6. tolua_outside bool ResourceLoad @ Load(const String& fileName);
  7. tolua_outside bool ResourceSave @ Save(const String& fileName) const;
  8. const String GetName() const;
  9. StringHash GetNameHash() const;
  10. unsigned GetMemoryUse() const;
  11. tolua_readonly tolua_property__get_set String name;
  12. tolua_readonly tolua_property__get_set StringHash nameHash;
  13. tolua_readonly tolua_property__get_set unsigned memoryUse;
  14. };
  15. class ResourceWithMetadata : public Resource
  16. {
  17. void AddMetadata(const String& name, const Variant& value);
  18. void RemoveMetadata(const String& name);
  19. void RemoveAllMetadata();
  20. const Variant& GetMetadata(const String& name) const;
  21. bool HasMetadata() const;
  22. }
  23. ${
  24. static bool ResourceLoad(Resource* resource, const String& fileName)
  25. {
  26. return resource->LoadFile(fileName);
  27. }
  28. static bool ResourceSave(const Resource* resource, const String& fileName)
  29. {
  30. return resource->SaveFile(fileName);
  31. }
  32. $}