]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/datasource.qc
Backport DataSource
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / datasource.qc
1 #ifndef DATASOURCE_H
2 #define DATASOURCE_H
3 CLASS(DataSource, Object)
4     /**
5      * get entry `i` passing `name` and `icon` through `returns` if it is not null
6      * returns `DataSource_false` if out of bounds
7      * otherwise returns an entity or `DataSource_true`
8      */
9     METHOD(DataSource, getEntry, entity(int i, void(string name, string icon) returns));
10     /** return the index of the first match for `find`. optional */
11     METHOD(DataSource, indexOf, int(string find));
12     /** reload all entries matching `filter` returning how many matches were found */
13     METHOD(DataSource, reload, int(string filter));
14     /** cleanup on shutdown. optional */
15     METHOD(DataSource, destroy, void(entity));
16     entity DataSource_true;
17     entity DataSource_false;
18     INIT_STATIC(DataSource) {
19         DataSource_true = NEW(Object);
20         DataSource_false = NULL;
21     }
22 ENDCLASS(DataSource)
23 #endif