44 std::string&
trim(std::string& str,
const std::string& toTrim =
" ") {
45 std::string::size_type pos = str.find_last_not_of(toTrim);
46 if (pos == std::string::npos) {
50 str.erase(0, str.find_first_not_of(toTrim));
55 std::vector<std::string>&
split(
const std::string &s,
char delim, std::vector<std::string> &elems) {
56 std::stringstream ss(s);
58 while (std::getline(ss, item, delim)) {
59 elems.push_back(item);
64 std::vector<std::string>
split(
const std::string &s,
char delim) {
65 std::vector<std::string> elems;
66 split(s, delim, elems);
72 std::getline(in, line);
73 if (!line.empty() && *line.rbegin() ==
'\r') {
74 line.erase(line.length() - 1, 1);
77 in.setstate(std::ios_base::failbit);
82 std::istringstream sstream(line);
85 if (preamble !=
"SG_") {
86 in.setstate(std::ios_base::failbit);
105 std::istringstream multstream(multi);
106 multstream.ignore(1);
107 unsigned short multiNum;
108 multstream >> multiNum;
138 sstream.ignore(std::numeric_limits<std::streamsize>::max(),
'(');
145 sstream.ignore(std::numeric_limits<std::streamsize>::max(),
'[');
159 std::vector<std::string> toStrings =
split(to,
',');
160 for (
size_t i = 0; i < toStrings.size(); i++) {
161 sig.
to.insert(sig.
to.end(), toStrings[i]);
std::string & trim(std::string &str, const std::string &toTrim=" ")
std::istream & operator>>(std::istream &in, Signal &sig)
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
unsigned short multiplexNum