59 const char* usage =
"Usage: sc_filter compose baseId filterId maskfilterId";
77 int argc,
const char** argv) {
78 const char* usage =
"Usage: sc_filter remove baseId filterId gnumber [<+|-> sortCrit]";
82 if (gNum == 0 || gNum > dbase.
numGames())
86 filter.
erase(gNum - 1);
88 const char* crit = argv[6];
107 count = dbase.
listGames(crit, start, count, filter, idxList);
108 for (
size_t i = 0; i < count; ++i) {
109 filter.
erase(idxList[i]);
123 const char* usage =
"Usage: sc_filter reset baseId filterId <full|empty>";
126 if (strcmp(
"full", argv[4]) == 0) {
128 }
else if (strcmp(
"empty", argv[4]) == 0) {
146 int argc,
const char** argv) {
147 const char* usage =
"Usage: sc_filter sizes baseId filterId";
155 res.push_back(filter.
size());
157 res.push_back(unmasked.
size());
163 int sc_filter_old(ClientData cd, Tcl_Interp* ti,
int argc,
const char** argv);
166 const char* usage =
"Usage: sc_filter <cmd> baseId filterId [args]";
169 static const char* options[] = {
"compose",
"remove",
"reset",
"sizes", NULL};
181 if (filter ==
nullptr)
184 const char*
cmd = argv[1];
185 if (strcmp(
"compose", cmd) == 0)
186 return sc_filter_compose(ti, *dbase, argc, argv);
187 if (strcmp(
"remove", cmd) == 0)
188 return sc_filter_remove(ti, *dbase, filter, argc, argv);
189 if (strcmp(
"reset", cmd) == 0)
190 return sc_filter_reset(ti, filter, argc, argv);
191 if (strcmp(
"sizes", cmd) == 0)
192 return sc_filter_sizes(ti, *dbase, filter, argc, argv);
194 std::string err =
"sc_filter\nInvalid minor command: ";
const errorT ERROR_BadArg
HFilter getMainFilter(const std::string &filterId) const
void erase(gamenumT gnum)
int strUniqueMatch(const char *keyStr, const char **strTable)
const gamenumT INVALID_GAMEID
scidBaseT * getBase(int baseHandle)
getBase() - get a database from the pool.
size_t sortedPosition(const char *criteria, const HFilter &filter, gamenumT gameId)
Get the sorted position of a game.
uint32_t strGetUnsigned(const char *str)
std::string composeFilter(const std::string &mainFilter, const std::string &maskFilter) const
UI_res_t UI_Result(UI_handle_t ti, errorT res)
UI_Result() - pass the result of an operation from c++ to UI.
gamenumT numGames() const
An heterogeneous container used to pass a list of values from c++ to UI.
UI_res_t sc_filter(UI_extra_t cd, UI_handle_t ti, int argc, const char **argv)
HFilter getFilter(const std::string &filterId) const
int sc_filter_old(ClientData cd, Tcl_Interp *ti, int argc, const char **argv)
FILTER functions.
size_t listGames(const char *criteria, size_t start, size_t count, const HFilter &filter, gamenumT *destCont)
Retrieve a list of ordered game indexes sorted by criteria.