mirror of
https://github.com/matrix-construct/construct
synced 2024-09-26 02:18:53 +02:00
modules/console: Add event refs count cmd.
This commit is contained in:
parent
42f7b05775
commit
c8ab0ce239
1 changed files with 44 additions and 0 deletions
|
@ -8423,6 +8423,50 @@ console_cmd__event__refs(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__event__refs__count(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
const params param{line, " ",
|
||||||
|
{
|
||||||
|
"event_id", "type"
|
||||||
|
}};
|
||||||
|
|
||||||
|
const m::event::id &event_id
|
||||||
|
{
|
||||||
|
param.at("event_id")
|
||||||
|
};
|
||||||
|
|
||||||
|
const m::event::refs refs
|
||||||
|
{
|
||||||
|
index(event_id)
|
||||||
|
};
|
||||||
|
|
||||||
|
const string_view &typestr
|
||||||
|
{
|
||||||
|
param["type"]
|
||||||
|
};
|
||||||
|
|
||||||
|
m::dbs::ref type
|
||||||
|
{
|
||||||
|
empty(typestr)?
|
||||||
|
m::dbs::ref(-1):
|
||||||
|
m::dbs::ref(0)
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!empty(typestr))
|
||||||
|
for(; uint8_t(type) < sizeof(m::dbs::ref) * 256; type = m::dbs::ref(uint8_t(type) + 1))
|
||||||
|
if(reflect(type) == typestr)
|
||||||
|
break;
|
||||||
|
|
||||||
|
const auto count
|
||||||
|
{
|
||||||
|
refs.count(type)
|
||||||
|
};
|
||||||
|
|
||||||
|
out << count << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__event__refs__next(opt &out, const string_view &line)
|
console_cmd__event__refs__next(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue