35#include <angelscript.h>
39using namespace AngelScript;
61 std::string log_msg =
"modcache.query(): ";
62 std::string search_expr;
67 int64_t i64_filter_category_id;
74 if (search_expr.find(
":") == std::string::npos)
81 Ogre::StringVector v = Ogre::StringUtil::split(search_expr,
":");
87 else if (v[0] ==
"guid")
92 else if (v[0] ==
"author")
97 else if (v[0] ==
"wheels")
102 else if (v[0] ==
"file")
115 size_t results_count = self->
Query(query);
120 CScriptArray* results_entries = CScriptArray::Create(typeinfo_array_entries);
121 CScriptArray* results_scores = CScriptArray::Create(typeinfo_array_scores);
124 CacheEntry* entry_ptr = result.cqr_entry.GetRef();
125 results_entries->InsertLast(&entry_ptr);
126 results_scores->InsertLast(&result.cqr_score);
129 CScriptDictionary* results_dict = CScriptDictionary::Create(
App::GetScriptEngine()->getEngine());
130 results_dict->Set(
"count", (asINT64)results_count);
131 results_dict->Set(
"entries", results_entries, typeinfo_array_entries->GetTypeId());
132 results_dict->Set(
"scores", results_scores, typeinfo_array_scores->GetTypeId());
A database of user-installed content alias 'mods' (vehicles, terrains...)
CacheEntryID_t number
Sequential number, assigned internally, used by Selector-GUI.
Ogre::String fname
filename
Ogre::String fext
file's extension
Ogre::String fpath
filepath relative to the .zip file
int categoryid
category id
Ogre::String dname
name parsed from the file
Ogre::String resource_group
Resource group of the loaded bundle. Empty if not loaded yet.
std::string resource_bundle_type
Archive type recognized by OGRE resource system: 'FileSystem' or 'Zip'.
std::string resource_bundle_path
Path of ZIP or directory which contains the media. Shared between CacheEntries, loaded only once.
bool deleted
is this mod deleted?
Ogre::String categoryname
category name
Ogre::String filecachename
preview image filename
A content database MOTIVATION: RoR users usually have A LOT of content installed.
size_t Query(CacheQuery &query)
AngelScript::asIScriptEngine * getEngine()
bool GetValueFromScriptDict(const std::string &log_msg, AngelScript::CScriptDictionary *dict, bool required, std::string const &key, const char *decl, T &out_value)
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)
ScriptEngine * GetScriptEngine()
int cqy_filter_category_id
std::string cqy_filter_guid
Exact match (case-insensitive); leave empty to disable.
std::string cqy_search_string
CacheSearchMethod cqy_search_method
std::vector< CacheQueryResult > cqy_results
RoR::LoaderType cqy_filter_type