27 #ifndef ANTIOCH_STRING_UTILS_H
28 #define ANTIOCH_STRING_UTILS_H
46 const std::string& delimiter,
47 std::vector<std::string>& results );
59 std::istringstream converter(input);
61 converter >> returnval;
67 template <
typename Type>
71 std::pair<std::string, Type> ret = std::make_pair(std::string(), 0);
72 std::string::size_type colon_position = token.find(
":");
74 ret.first = token.substr(0, colon_position);
75 ret.second = string_to_T<Type>(token.substr(colon_position + 1));
84 const std::string& delimiter,
85 std::vector<std::string>& results,
86 bool includeEmpties =
true)
93 int sizeS2 = (
int)delimiter.size();
94 int isize = (
int)input.size();
105 vector<int> positions;
107 newPos = input.find (delimiter, 0);
116 while( newPos >= iPos )
119 positions.push_back(newPos);
121 newPos = input.find (delimiter, iPos+sizeS2);
129 for(
int i=0; i <= static_cast<int>(positions.size()); ++i )
134 s = input.substr( i, positions[i] );
138 int offset = positions[i-1] + sizeS2;
141 if( i == static_cast<int>(positions.size()) )
143 s = input.substr(offset);
147 s = input.substr( positions[i-1] + sizeS2,
148 positions[i] - positions[i-1] - sizeS2 );
152 if( includeEmpties || ( s.size() > 0 ) )
154 results.push_back(s);
176 if(c ==
'\n' || c ==
'\r')
break;
185 if((c ==
'\n' && n ==
'\r') ||
186 (n ==
'\n' && c ==
'\r'))c = buf.get();
207 }
else if(str ==
"Tref")
210 }
else if(str ==
"Rscale")
213 }
else if(str ==
"sigma")
216 }
else if(str ==
"lambda")
222 }
else if(str ==
"inf")
235 if(str ==
"efficiencies")
238 }
else if(str ==
"alpha")
241 }
else if(str ==
"T1")
244 }
else if(str ==
"T2")
247 }
else if(str ==
"T3")
258 #endif // ANTIOCH_STRING_UTILS_H
void remove_newline_from_strings(std::vector< std::string > &strings)
Strips newline characters from strings in the input vector, strings.
#define antioch_assert(asserted)
void split_string(const std::string &input, const std::string &delimiter, std::vector< std::string > &results)
All characters in delimiter will be treated as a delimiter.
std::pair< std::string, Type > split_string_on_colon(const std::string &token)
T string_to_T(const std::string &input)
int ascii_getline(std::istream &buf, std::string &line)
adapted getline, never believe ascii file for the formatting of end-of-line.
KineticsModel::Parameters string_to_kin_enum(const std::string &str)
int SplitString(const std::string &input, const std::string &delimiter, std::vector< std::string > &results, bool includeEmpties=true)
Taken from FIN-S for XML parsing.
The parameters are reduced parameters.
ReactionType::Parameters string_to_chem_enum(const std::string &str)