3 CLASS(DataSource, Object)
4 STATIC_ATTRIB(DataSource, true, entity, NEW(Object));
5 STATIC_ATTRIB(DataSource, false, entity, NULL);
7 * get entry `i` passing `name` and `icon` through `returns` if it is not null
8 * returns `DataSource_false` if out of bounds
9 * otherwise returns an entity or `DataSource_true`
11 METHOD(DataSource, getEntry, entity(entity this, int i, void(string name, string icon) returns)) { return DataSource_false; }
12 /** return the index of the first match for `find`. optional */
13 METHOD(DataSource, indexOf, int(entity this, string find)) { return -1; }
14 /** reload all entries matching `filter` returning how many matches were found */
15 METHOD(DataSource, reload, int(entity this, string filter)) { return 0; }
16 /** cleanup on shutdown. optional */
17 METHOD(DataSource, destroy, void(entity this)) { }
21 CLASS(StringSource, DataSource)
22 ATTRIB(StringSource, StringSource_str, string);
23 ATTRIB(StringSource, StringSource_sep, string);
24 CONSTRUCTOR(StringSource, string str, string sep);
25 METHOD(StringSource, getEntry, entity(entity this, int i, void(string name, string icon) returns));
26 METHOD(StringSource, reload, int(entity this, string filter));
27 ENDCLASS(StringSource)
29 CLASS(CvarStringSource, StringSource)
30 ATTRIB(CvarStringSource, CvarStringSource_cvar, string);
31 CONSTRUCTOR(CvarStringSource, string cv, string sep);
32 METHOD(CvarStringSource, getEntry, entity(entity this, int i, void(string name, string icon) returns));
33 METHOD(CvarStringSource, reload, int(entity this, string filter));
34 ENDCLASS(CvarStringSource)