-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSDDLParser.cpp
More file actions
35 lines (32 loc) · 756 Bytes
/
Copy pathSDDLParser.cpp
File metadata and controls
35 lines (32 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// Created by Sankalp Bhamare on 04/09/21.
//
#include "SDDLParser.h"
pair<vector<string>,vector<string>> breakPorts(const string &str){
istringstream is(str+",");
char c;
string token = "";
vector<string> inres;
vector<string> ores;
bool flip = false;
while (is >> c){
if(c == ',' || c == ' ' || c == '-'){
if(!token.empty()){
if(!flip)
inres.push_back(token);
else
ores.push_back(token);
}
token ="";
}else{
token += c;
}
if(c == '-'){
is >> c;
if(c == '>'){
flip = true;
}
}
}
return {inres,ores};
}