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

Method lines

src/model/EnergyManagementSystemProgram.cpp:225–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223 }
224
225 std::vector<std::string> EnergyManagementSystemProgram_Impl::lines() const {
226 //return vector of lines from body
227 std::vector<std::string> result;
228 boost::optional<std::string> comment;
229 std::string whole_line;
230
231 // loop through extensible groups and add ProgramLine to vector result.
232 auto groups = extensibleGroups();
233
234 for (auto group = groups.begin(); group != groups.end(); ++group) {
235 //clear out whole_line
236 whole_line.clear();
237 //get program line content
238 const auto& line = group->getString(OS_EnergyManagementSystem_ProgramExtensibleFields::ProgramLine, true);
239 OS_ASSERT(line);
240 //add programLine to whole_line
241 whole_line += line.get();
242 //get non-default comments if they exist
243 comment = group->fieldComment(OS_EnergyManagementSystem_ProgramExtensibleFields::ProgramLine, false);
244 if (comment.is_initialized()) {
245 //remove space after !
246 boost::erase_first(comment.get(), " ");
247 //add space between end of program line and comment
248 if (!comment.get().empty()) {
249 whole_line += " " + comment.get();
250 }
251 }
252 //add newline character
253 whole_line += '\n';
254 //add whole_line to vector
255 result.push_back(whole_line);
256 }
257 return result;
258 }
259
260 bool EnergyManagementSystemProgram_Impl::setLines(const std::vector<std::string>& lines) {
261 //set body of program to input vector of strings

Callers 7

referencedObjectsMethod · 0.95
TEST_FFunction · 0.45
TEST_FFunction · 0.45
prepareProgram_EMSFunction · 0.45
prepareSubroutine_EMSFunction · 0.45
TEST_FFunction · 0.45

Calls 8

beginMethod · 0.80
endMethod · 0.45
clearMethod · 0.45
getStringMethod · 0.45
getMethod · 0.45
fieldCommentMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by 5

TEST_FFunction · 0.36
TEST_FFunction · 0.36
prepareProgram_EMSFunction · 0.36
prepareSubroutine_EMSFunction · 0.36
TEST_FFunction · 0.36