| 1234567891011121314151617181920212223242526272829303132333435363738 |
- $#include "File.h"
- $#include "Resource.h"
- class Resource
- {
- bool Load(Deserializer& source);
- bool Save(Serializer& dest) const;
- tolua_outside bool ResourceLoad @ Load(const String fileName);
- tolua_outside bool ResourceSave @ Save(const String fileName) const;
-
- const String GetName() const;
- StringHash GetNameHash() const;
- unsigned GetMemoryUse() const;
-
- tolua_readonly tolua_property__get_set String name;
- tolua_readonly tolua_property__get_set StringHash nameHash;
- tolua_readonly tolua_property__get_set unsigned memoryUse;
- };
- ${
- static bool ResourceLoad(Resource* resource, const String& fileName)
- {
- if (!resource)
- return false;
- File file(resource->GetContext());
- return file.Open(fileName, FILE_READ) && resource->Load(file);
- }
- static bool ResourceSave(const Resource* resource, const String& fileName)
- {
- if (!resource)
- return false;
- File file(resource->GetContext());
- return file.Open(fileName, FILE_WRITE) && resource->Save(file);
- }
- $}
|