MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / validPluginClassNamesInFile

Method validPluginClassNamesInFile

src/model/PythonPluginInstance.cpp:131–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

TEST_FFunction · 0.80

Calls 1

filePathMethod · 0.80

Tested by 1

TEST_FFunction · 0.64