| 288 | } |
| 289 | |
| 290 | std::pair<std::string, std::string> decomposeQuantityString(const std::string& s) { |
| 291 | |
| 292 | std::pair<std::string, std::string> result; |
| 293 | boost::match_results<std::string::const_iterator> match; |
| 294 | if (!boost::regex_match(s, match, regexQuantity())) { |
| 295 | LOG_FREE_AND_THROW("openstudio.QuantityRegex", "Cannot decompose " << s << " into (value,unit) because it is not a quantity."); |
| 296 | } |
| 297 | // pull out number |
| 298 | result.first = std::string(match[1].first, match[1].second); |
| 299 | // see if there is / between number and unit |
| 300 | std::string temp(match[2].first, match[2].second); |
| 301 | if (temp == "/") { |
| 302 | result.second = "1/"; |
| 303 | } |
| 304 | // pull out unit |
| 305 | result.second += std::string(match[3].first, match[3].second); |
| 306 | |
| 307 | return result; |
| 308 | } |
| 309 | |
| 310 | std::pair<std::string, std::string> decomposeScaledUnitString(const std::string& s) { |
| 311 | if (!isScaledUnit(s)) { |
no outgoing calls