| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- $#include "IO/PackageFile.h"
- struct PackageEntry
- {
- unsigned offset_ @ offset;
- unsigned size_ @ size;
- unsigned checksum_ @ checksum;
- };
- class PackageFile : public Object
- {
- PackageFile();
- PackageFile(const String fileName, unsigned startOffset = 0);
- ~PackageFile();
- bool Open(const String fileName, unsigned startOffset = 0);
- bool Exists(const String fileName) const;
- const PackageEntry* GetEntry(const String fileName) const;
- const HashMap<String, PackageEntry>& GetEntries() const;
- const String GetName() const;
- StringHash GetNameHash() const;
- unsigned GetNumFiles() const;
- unsigned GetTotalSize() const;
- unsigned GetTotalDataSize() const;
- unsigned GetChecksum() const;
- bool IsCompressed() const;
- tolua_readonly tolua_property__get_set String name;
- tolua_readonly tolua_property__get_set StringHash nameHash;
- tolua_readonly tolua_property__get_set unsigned numFiles;
- tolua_readonly tolua_property__get_set unsigned totalSize;
- tolua_readonly tolua_property__get_set unsigned totalDataSize;
- tolua_readonly tolua_property__get_set unsigned checksum;
- tolua_readonly tolua_property__is_set bool compressed;
- };
- ${
- #define TOLUA_DISABLE_tolua_IOLuaAPI_PackageFile_new00
- static int tolua_IOLuaAPI_PackageFile_new00(lua_State* tolua_S)
- {
- return ToluaNewObject<PackageFile>(tolua_S);
- }
- #define TOLUA_DISABLE_tolua_IOLuaAPI_PackageFile_new00_local
- static int tolua_IOLuaAPI_PackageFile_new00_local(lua_State* tolua_S)
- {
- return ToluaNewObjectGC<PackageFile>(tolua_S);
- }
- /* method: new of class PackageFile */
- #define TOLUA_DISABLE_tolua_IOLuaAPI_PackageFile_new01
- static int tolua_IOLuaAPI_PackageFile_new01(lua_State* tolua_S)
- {
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"PackageFile",0,&tolua_err) ||
- !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isnumber(tolua_S,3,1,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
- {
- const String fileName = ((const String) tolua_tourho3dstring(tolua_S,2,0));
- unsigned startOffset = ((unsigned) tolua_tonumber(tolua_S,3,0));
- {
- PackageFile* tolua_ret = (PackageFile*) Mtolua_new((PackageFile)(GetContext(tolua_S),fileName,startOffset));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"PackageFile");
- }
- }
- return 1;
- tolua_lerror:
- return tolua_IOLuaAPI_PackageFile_new00(tolua_S);
- }
- /* method: new_local of class PackageFile */
- #define TOLUA_DISABLE_tolua_IOLuaAPI_PackageFile_new01_local
- static int tolua_IOLuaAPI_PackageFile_new01_local(lua_State* tolua_S)
- {
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"PackageFile",0,&tolua_err) ||
- !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isnumber(tolua_S,3,1,&tolua_err) ||
- !tolua_isnoobj(tolua_S,4,&tolua_err)
- )
- goto tolua_lerror;
- else
- {
- const String fileName = ((const String) tolua_tourho3dstring(tolua_S,2,0));
- unsigned startOffset = ((unsigned) tolua_tonumber(tolua_S,3,0));
- {
- PackageFile* tolua_ret = (PackageFile*) Mtolua_new((PackageFile)(GetContext(tolua_S),fileName,startOffset));
- tolua_pushusertype(tolua_S,(void*)tolua_ret,"PackageFile");
- tolua_register_gc(tolua_S,lua_gettop(tolua_S));
- }
- }
- return 1;
- tolua_lerror:
- return tolua_IOLuaAPI_PackageFile_new00_local(tolua_S);
- }
- $}
|