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

Method loadComponent

src/osversion/VersionTranslator.cpp:219–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217 }
218
219 boost::optional<model::Component> VersionTranslator::loadComponent(const openstudio::path& pathToOldOsc, ProgressBar* progressBar) {
220 LOG(Trace, "Loading component from " << toString(pathToOldOsc) << ".");
221 if (getFileExtension(pathToOldOsc) != componentFileExtension()) {
222 LOG(Error, "Cannot loadComponent for path'" << toString(pathToOldOsc) << "'. Extension must be '" << componentFileExtension() << "'. For '"
223 << modelFileExtension() << "'s use loadModel.");
224 return boost::none;
225 }
226 path wp = completePathToFile(pathToOldOsc, path(), componentFileExtension(), false);
227 openstudio::filesystem::ifstream inFile(wp);
228 if (inFile) {
229 return loadComponent(inFile, progressBar);
230 }
231
232 return boost::none;
233 }
234
235 boost::optional<model::Component> VersionTranslator::loadComponent(std::istream& is, ProgressBar* progressBar) {
236 model::OptionalModel result = updateVersion(is, true, progressBar);

Callers 2

testExampleComponentFunction · 0.80
TEST_FFunction · 0.80

Calls 5

getFileExtensionFunction · 0.85
componentFileExtensionFunction · 0.85
modelFileExtensionFunction · 0.85
completePathToFileFunction · 0.85
toStringFunction · 0.50

Tested by 2

testExampleComponentFunction · 0.64
TEST_FFunction · 0.64