Oliver Smith | 8d9a05c | 2018-12-12 16:03:38 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 sysmocom - s.f.m.c. GmbH |
| 3 | * |
Pau Espin Pedrol | 21d03d3 | 2019-07-22 12:05:52 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: LGPL-2.1+ |
| 5 | * |
Oliver Smith | 8d9a05c | 2018-12-12 16:03:38 +0100 | [diff] [blame] | 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
Oliver Smith | 8d9a05c | 2018-12-12 16:03:38 +0100 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <vector> |
| 18 | #include <string> |
| 19 | #include <sstream> |
| 20 | |
| 21 | std::vector<std::string> comma_delimited_to_vector(const char* opt) |
| 22 | { |
| 23 | std::string str = std::string(opt); |
| 24 | std::vector<std::string> result; |
| 25 | std::stringstream ss(str); |
| 26 | |
| 27 | while( ss.good() ) |
| 28 | { |
| 29 | std::string substr; |
| 30 | getline(ss, substr, ','); |
| 31 | result.push_back(substr); |
| 32 | } |
| 33 | return result; |
| 34 | } |