* @brief Parse a comma-separated string into a vector of trimmed values. * * @param input The comma-separated string. * @return Vector of trimmed non-empty values. */
| 108 | * @return Vector of trimmed non-empty values. |
| 109 | */ |
| 110 | std::vector<std::string> ParseCommaSeparatedList(const std::string& input) |
| 111 | { |
| 112 | std::vector<std::string> result; |
| 113 | std::istringstream stream(input); |
| 114 | std::string item; |
| 115 | |
| 116 | while (std::getline(stream, item, ',')) |
| 117 | { |
| 118 | // Trim leading whitespace |
| 119 | auto start = item.find_first_not_of(" \t"); |
| 120 | if (start == std::string::npos) |
| 121 | { |
| 122 | continue; // Skip empty or whitespace-only items |
| 123 | } |
| 124 | |
| 125 | // Trim trailing whitespace |
| 126 | auto end = item.find_last_not_of(" \t"); |
| 127 | item = item.substr(start, end - start + 1); |
| 128 | |
| 129 | if (!item.empty()) |
| 130 | { |
| 131 | result.push_back(item); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | return result; |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * @brief Build pagination links from request and query result. |
no test coverage detected