Blame view

stim/parser/parser.h 551 Bytes
8157c392   David Mayerich   added parser and ...
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
  #ifndef STIM_PARSER_H

  #define STIM_PARSER_H

  

  namespace stim{

  

  class parser{

  

  public:

  

  	static std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {

  		std::stringstream ss(s);

  		std::string item;

  		while (std::getline(ss, item, delim)) {

  			elems.push_back(item);

  		}

  		return elems;

  	}

  

  	static std::vector<std::string> split(const std::string &s, char delim) {

  		std::vector<std::string> elems;

  		split(s, delim, elems);

  		return elems;

  	}

  

  };

  

  }	//end namespace stim

  

  #endif