#include #include #include #include std::string Strip(std::string s) { while (!s.empty() && std::isspace(s.back())) { s.pop_back(); } std::reverse(s.begin(), s.end()); while (!s.empty() && std::isspace(s.back())) { s.pop_back(); } std::reverse(s.begin(), s.end()); return s; } std::unique_ptr Config::GetTarget( const std::string& target) { std::ifstream in(path_); std::string current; std::vector target_commands; bool target_begin = false; while (std::getline(in, current)) { if (current == target + ":") { target_begin = true; continue; } if (current.empty()) { continue; } if (!std::isspace(current[0]) && target_begin) { break; } if (target_begin) { target_commands.emplace_back(Strip(std::move(current))); } } if (!target_begin) { return nullptr; } return std::make_unique( std::move(target_commands)); }