refactor: IKeyState: directly make string when spilting as arg to emplace
This commit is contained in:
@ -134,7 +134,7 @@ void IKeyState::KeyInfo::split(const char *screens, std::set<std::string> &dst)
|
||||
const char *i = screens + 1;
|
||||
while (*i != '\0') {
|
||||
const char *j = strchr(i, ':');
|
||||
dst.emplace(std::string(i, j - i));
|
||||
dst.emplace(i, j - i);
|
||||
i = j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,15 +247,13 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
|
||||
outStream << "section: links" << Qt::endl;
|
||||
|
||||
for (int i = 0; const auto &screen : config.screens()) {
|
||||
if (screen.isNull()) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
outStream << "\t" << screen.name() << ":\n";
|
||||
for (const auto &neighbour : std::as_const(neighbourDirs)) {
|
||||
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;
|
||||
if (!screen.isNull()) {
|
||||
outStream << "\t" << screen.name() << ":\n";
|
||||
for (const auto &neighbour : std::as_const(neighbourDirs)) {
|
||||
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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user