2019-06-04 13:54:27 +03:00
|
|
|
#include <Kernel/KParams.h>
|
|
|
|
|
|
|
|
static KParams* s_the;
|
|
|
|
|
|
|
|
KParams& KParams::the()
|
|
|
|
{
|
|
|
|
return *s_the;
|
|
|
|
}
|
|
|
|
|
|
|
|
KParams::KParams(const String& cmdline)
|
|
|
|
: m_cmdline(cmdline)
|
|
|
|
{
|
|
|
|
s_the = this;
|
|
|
|
|
|
|
|
for (auto str : m_cmdline.split(' ')) {
|
2019-06-04 14:55:52 +03:00
|
|
|
if (str == "") {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2019-06-04 13:54:27 +03:00
|
|
|
auto pair = str.split_limit('=', 2);
|
|
|
|
|
|
|
|
if (pair.size() == 1) {
|
|
|
|
m_params.set(pair[0], "");
|
|
|
|
} else {
|
|
|
|
m_params.set(pair[0], pair[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String KParams::get(const String& key) const
|
|
|
|
{
|
|
|
|
return m_params.get(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KParams::has(const String& key) const
|
|
|
|
{
|
|
|
|
return m_params.contains(key);
|
|
|
|
}
|