| 129 | } |
| 130 | |
| 131 | std::vector<std::string> PythonPluginInstance_Impl::validPluginClassNamesInFile() const { |
| 132 | std::vector<std::string> result; |
| 133 | |
| 134 | // Regexes are expensive, so static duration makes sense |
| 135 | static const boost::regex re(R"(^class\s+(\w+)\s*\(\s*EnergyPlusPlugin)"); |
| 136 | boost::smatch matches; |
| 137 | |
| 138 | auto filePath = openstudio::filesystem::system_complete(externalFile().filePath()); |
| 139 | openstudio::filesystem::ifstream ifs(filePath); |
| 140 | std::string line; |
| 141 | while (std::getline(ifs, line)) { |
| 142 | if (boost::regex_search(line, matches, re)) { |
| 143 | result.emplace_back(matches[1].first, matches[1].second); |
| 144 | } |
| 145 | } |
| 146 | return result; |
| 147 | } |
| 148 | |
| 149 | } // namespace detail |
| 150 | |