Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
CacheSystemAngelscriptGeneric.cpp
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-2023 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#include "../../autowrapper/aswrappedcall.h"
23#include "Actor.h"
24#include "AngelScriptBindings.h"
25#include "CacheSystem.h"
26#include "ScriptEngine.h"
27#include "ScriptUtils.h"
29
30#include <angelscript.h>
31
32using namespace AngelScript;
33using namespace RoR;
34using namespace CacheSystemAngelscriptWrappers;
35
36void RoR::RegisterCacheSystemGeneric(asIScriptEngine *engine)
37{
38 CacheEntry::RegisterRefCountingObjectGeneric(engine, "CacheEntryClass");
39 CacheEntryPtr::RegisterRefCountingObjectPtrGeneric(engine, "CacheEntryClassPtr", "CacheEntryClass");
40
41 int result;
42
43 // NOTE: enum LoaderType and object type CacheSystemClass are registered in RegisterCacheSystemCommon()
44
45 // class CacheEntry, with read-only property access
46 // (Please maintain the same order as in 'CacheSystem.h' and 'doc/*/CacheEntryClass.h')
47
48 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_fpath() const property", WRAP_OBJ_FIRST(CacheEntry_get_fpath), asCALL_GENERIC); ROR_ASSERT(result>=0);
49 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_fname() const property", WRAP_OBJ_FIRST(CacheEntry_get_fname), asCALL_GENERIC); ROR_ASSERT(result>=0);
50 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_fext() const property", WRAP_OBJ_FIRST(CacheEntry_get_fext), asCALL_GENERIC); ROR_ASSERT(result>=0);
51 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_dname() const property", WRAP_OBJ_FIRST(CacheEntry_get_dname), asCALL_GENERIC); ROR_ASSERT(result>=0);
52 result = engine->RegisterObjectMethod("CacheEntryClass", "int get_categoryid() const property", WRAP_OBJ_FIRST(CacheEntry_get_categoryid), asCALL_GENERIC); ROR_ASSERT(result>=0);
53 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_categoryname() const property", WRAP_OBJ_FIRST(CacheEntry_get_categoryname), asCALL_GENERIC); ROR_ASSERT(result>=0);
54 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_resource_bundle_type() const property", WRAP_OBJ_FIRST(CacheEntry_get_resource_bundle_type), asCALL_GENERIC); ROR_ASSERT(result>=0);
55 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_resource_bundle_path() const property", WRAP_OBJ_FIRST(CacheEntry_get_resource_bundle_path), asCALL_GENERIC); ROR_ASSERT(result>=0);
56 result = engine->RegisterObjectMethod("CacheEntryClass", "int get_number() const property", WRAP_OBJ_FIRST(CacheEntry_get_number), asCALL_GENERIC); ROR_ASSERT(result>=0);
57 result = engine->RegisterObjectMethod("CacheEntryClass", "bool get_deleted() const property", WRAP_OBJ_FIRST(CacheEntry_get_deleted), asCALL_GENERIC); ROR_ASSERT(result>=0);
58 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_filecachename() const property", WRAP_OBJ_FIRST(CacheEntry_get_filecachename), asCALL_GENERIC); ROR_ASSERT(result>=0);
59 result = engine->RegisterObjectMethod("CacheEntryClass", "const string& get_resource_group() const property", WRAP_OBJ_FIRST(CacheEntry_get_resource_group), asCALL_GENERIC); ROR_ASSERT(result>=0);
60
61 // class CacheSystem
62 result = engine->RegisterObjectMethod("CacheSystemClass", "CacheEntryClassPtr @findEntryByFilename(LoaderType, bool, const string &in)", WRAP_MFN(CacheSystem, FindEntryByFilename), asCALL_GENERIC); ROR_ASSERT(result>=0);
63 result = engine->RegisterObjectMethod("CacheSystemClass", "CacheEntryClassPtr @getEntryByNumber(int)", WRAP_MFN(CacheSystem, GetEntryByNumber), asCALL_GENERIC); ROR_ASSERT(result>=0);
64 result = engine->RegisterObjectMethod("CacheSystemClass", "dictionary@ query(dictionary@)", WRAP_OBJ_FIRST(CacheSystemQueryWrapper), asCALL_GENERIC); ROR_ASSERT(result>=0);
65
66}
#define ROR_ASSERT(_EXPR)
Definition Application.h:40
A database of user-installed content alias 'mods' (vehicles, terrains...)
Helper/wrapper functions shared by native (CacheSystemAngelscript.cpp) and generic (CacheSystemAngels...
#define WRAP_MFN(ClassType, name)
#define WRAP_OBJ_FIRST(name)
static void RegisterRefCountingObjectPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptEngine *engine, const char *handle_name, const char *obj_name)
Same as RegisterRefCountingObjectPtr() but uses the generic calling convention (for platforms with AS...
A content database MOTIVATION: RoR users usually have A LOT of content installed.
void RegisterCacheSystemGeneric(AngelScript::asIScriptEngine *engine)
static int CacheEntry_get_number(CacheEntry *self)
static const std::string & CacheEntry_get_filecachename(CacheEntry *self)
static const std::string & CacheEntry_get_resource_bundle_type(CacheEntry *self)
static bool CacheEntry_get_deleted(CacheEntry *self)
static const std::string & CacheEntry_get_fpath(CacheEntry *self)
static const std::string & CacheEntry_get_fname(CacheEntry *self)
static const std::string & CacheEntry_get_categoryname(CacheEntry *self)
static CScriptDictionary * CacheSystemQueryWrapper(CacheSystem *self, CScriptDictionary *dict)
static int CacheEntry_get_categoryid(CacheEntry *self)
static const std::string & CacheEntry_get_fext(CacheEntry *self)
static const std::string & CacheEntry_get_dname(CacheEntry *self)
static const std::string & CacheEntry_get_resource_bundle_path(CacheEntry *self)
static const std::string & CacheEntry_get_resource_group(CacheEntry *self)