refactor: IKeyState: directly make string when spilting as arg to emplace
This commit is contained in:
parent
048ce47008
commit
3b2b8a9ebe
2 changed files with 8 additions and 10 deletions
|
|
@ -134,7 +134,7 @@ void IKeyState::KeyInfo::split(const char *screens, std::set<std::string> &dst)
|
||||||
const char *i = screens + 1;
|
const char *i = screens + 1;
|
||||||
while (*i != '\0') {
|
while (*i != '\0') {
|
||||||
const char *j = strchr(i, ':');
|
const char *j = strchr(i, ':');
|
||||||
dst.emplace(std::string(i, j - i));
|
dst.emplace(i, j - i);
|
||||||
i = j + 1;
|
i = j + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -247,15 +247,13 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
||||||
outStream << "section: links" << Qt::endl;
|
outStream << "section: links" << Qt::endl;
|
||||||
|
|
||||||
for (int i = 0; const auto &screen : config.screens()) {
|
for (int i = 0; const auto &screen : config.screens()) {
|
||||||
if (screen.isNull()) {
|
if (!screen.isNull()) {
|
||||||
i++;
|
outStream << "\t" << screen.name() << ":\n";
|
||||||
continue;
|
for (const auto &neighbour : std::as_const(neighbourDirs)) {
|
||||||
}
|
int idx = config.adjacentScreenIndex(i, neighbour.x, neighbour.y);
|
||||||
outStream << "\t" << screen.name() << ":\n";
|
if (idx != -1 && !config.screens()[idx].isNull())
|
||||||
for (const auto &neighbour : std::as_const(neighbourDirs)) {
|
outStream << "\t\t" << neighbour.name << " = " << config.screens()[idx].name() << Qt::endl;
|
||||||
int idx = config.adjacentScreenIndex(i, neighbour.x, neighbour.y);
|
}
|
||||||
if (idx != -1 && !config.screens()[idx].isNull())
|
|
||||||
outStream << "\t\t" << neighbour.name << " = " << config.screens()[idx].name() << Qt::endl;
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue