MCPcopy Create free account
hub / github.com/GENIVI/CANdevStudio / genGuiComponentHdr

Function genGuiComponentHdr

tools/templategen/main.cpp:324–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324std::string genGuiComponentHdr(const std::string& name)
325{
326 using namespace fmt::literals;
327
328 return fmt::format(R"(#ifndef {nameUpper}_H
329#define {nameUpper}_H
330
331#include <QWidget>
332#include <QtCore/QScopedPointer>
333#include <componentinterface.h>
334#include <context.h>
335#include <memory>
336
337class {name}Private;
338class QWidget;
339struct {name}GuiInt;
340typedef Context<{name}GuiInt> {name}Ctx;
341
342class {name} : public QObject, public ComponentInterface {{
343 Q_OBJECT
344 Q_DECLARE_PRIVATE({name})
345
346public:
347 {name}();
348 explicit {name}({name}Ctx&& ctx);
349 ~{name}();
350
351 QWidget* mainWidget() override;
352 void setConfig(const QJsonObject& json) override;
353 void setConfig(const QWidget& qobject) override;
354 QJsonObject getConfig() const override;
355 std::shared_ptr<QWidget> getQConfig() const override;
356 void configChanged() override;
357 bool mainWidgetDocked() const override;
358 ComponentInterface::ComponentProperties getSupportedProperties() const override;
359
360signals:
361 void mainWidgetDockToggled(QWidget* widget) override;
362 void simBcastSnd(const QJsonObject &msg, const QVariant &param = QVariant()) override;
363
364public slots:
365 void stopSimulation() override;
366 void startSimulation() override;
367 void simBcastRcv(const QJsonObject &msg, const QVariant &param) override;
368
369private:
370 QScopedPointer<{name}Private> d_ptr;
371}};
372
373#endif //{nameUpper}_H
374)",
375 "name"_a = name, "nameUpper"_a = str_toupper(name));
376}
377
378std::string genGuiComponentSrc(const std::string& name)
379{

Callers 1

mainFunction · 0.85

Calls 1

str_toupperFunction · 0.85

Tested by

no test coverage detected