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