MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / readCode

Method readCode

app/src/DataModel/Scripting/FrameParser.cpp:619–648  ·  view source on GitHub ↗

* @brief Loads the code stored in the project model into all engines. */

Source from the content-addressed store, hash-verified

617 * @brief Loads the code stored in the project model into all engines.
618 */
619void DataModel::FrameParser::readCode()
620{
621 for (auto it = m_engines.begin(); it != m_engines.end();)
622 if (it->first != 0)
623 it = m_engines.erase(it);
624 else
625 ++it;
626
627 auto it0 = m_engines.find(0);
628 if (it0 != m_engines.end() && it0->second->language() != languageForSource(0))
629 m_engines.erase(it0);
630
631 refreshEngineCaches();
632
633 const auto& model = ProjectModel::instance();
634 const auto& sources = model.sources();
635 const bool suppress = m_suppressMessageBoxes || model.suppressMessageBoxes();
636 const QString code = sources.empty() ? QString() : scriptForSource(sources[0]);
637
638 if (!code.isEmpty())
639 (void)loadScript(0, code, !suppress);
640
641 for (const auto& src : sources) {
642 const QString script = (src.sourceId > 0) ? scriptForSource(src) : QString();
643 if (!script.isEmpty())
644 (void)loadScript(src.sourceId, script, false);
645 }
646
647 Q_EMIT modifiedChanged();
648}
649
650/**
651 * @brief Resets the execution context by re-loading all current code.

Callers

nothing calls this directly

Calls 6

beginMethod · 0.80
findMethod · 0.80
suppressMessageBoxesMethod · 0.80
emptyMethod · 0.80
isEmptyMethod · 0.80
languageMethod · 0.45

Tested by

no test coverage detected