protobuf_factory.h
Go to the documentation of this file.
1 #ifndef PROTOBUF_FACTORY_H
2 #define PROTOBUF_FACTORY_H
3 
5 
6 #include "protobuf_parser.h"
7 #include "ui_protobuf_parser.h"
8 
10 {
11  Q_OBJECT
12  Q_PLUGIN_METADATA(IID "facontidavide.PlotJuggler3.ParserFactoryPlugin")
13  Q_INTERFACES(PJ::ParserFactoryPlugin)
14 
15 public:
17 
18  ~ParserFactoryProtobuf() override;
19 
20  const char* name() const override
21  {
22  return "ParserFactoryProtobuf";
23  }
24  const char* encoding() const override
25  {
26  return "protobuf";
27  }
28 
29  MessageParserPtr createParser(const std::string& topic_name,
30  const std::string& type_name, const std::string& schema,
31  PlotDataMapRef& data) override;
32 
33  QWidget* optionsWidget() override
34  {
35  return _widget;
36  }
37 
38 protected:
39  Ui::ProtobufLoader* ui;
40  QWidget* _widget;
41 
42  google::protobuf::compiler::DiskSourceTree _source_tree;
43  std::unique_ptr<google::protobuf::compiler::Importer> _importer;
44 
45  struct FileInfo
46  {
47  QString file_path;
48  QByteArray proto_text;
49  const google::protobuf::FileDescriptor* file_descriptor = nullptr;
50  std::map<QString, const google::protobuf::Descriptor*> descriptors;
51  };
53 
54  bool updateUI();
55 
56  void loadSettings();
57 
58  void saveSettings();
59 
60  void importFile(QString filename);
61 
62 private slots:
63 
64  void onIncludeDirectory();
65 
66  void onLoadFile();
67 
68  void onRemoveInclude();
69 
70  void onComboChanged(const QString& text);
71 };
72 
73 #endif // PROTOBUF_FACTORY_H
ParserFactoryProtobuf::loadSettings
void loadSettings()
Definition: protobuf_factory.cpp:95
ParserFactoryProtobuf::FileInfo
Definition: protobuf_factory.h:45
ParserFactoryProtobuf::saveSettings
void saveSettings()
Definition: protobuf_factory.cpp:121
ParserFactoryProtobuf::_widget
QWidget * _widget
Definition: protobuf_factory.h:40
PJ::MessageParserPtr
std::shared_ptr< MessageParser > MessageParserPtr
Definition: messageparser_base.h:136
ParserFactoryProtobuf::_importer
std::unique_ptr< google::protobuf::compiler::Importer > _importer
Definition: protobuf_factory.h:43
ParserFactoryProtobuf::FileInfo::file_descriptor
const google::protobuf::FileDescriptor * file_descriptor
Definition: protobuf_factory.h:49
ParserFactoryProtobuf::importFile
void importFile(QString filename)
Definition: protobuf_factory.cpp:45
protobuf_parser.h
ParserFactoryProtobuf::encoding
const char * encoding() const override
Definition: protobuf_factory.h:24
sol::type_name
std::string type_name(lua_State *L, type t)
Definition: sol.hpp:8079
ParserFactoryProtobuf::updateUI
bool updateUI()
ParserFactoryProtobuf::name
const char * name() const override
Name of the plugin type, NOT the particular instance.
Definition: protobuf_factory.h:20
ParserFactoryProtobuf::~ParserFactoryProtobuf
~ParserFactoryProtobuf() override
Definition: protobuf_factory.cpp:133
ParserFactoryProtobuf::FileInfo::proto_text
QByteArray proto_text
Definition: protobuf_factory.h:48
PJ::ParserFactoryPlugin
Definition: messageparser_base.h:139
ParserFactoryProtobuf::FileInfo::file_path
QString file_path
Definition: protobuf_factory.h:47
ParserFactoryProtobuf::onRemoveInclude
void onRemoveInclude()
Definition: protobuf_factory.cpp:211
ParserFactoryProtobuf::onComboChanged
void onComboChanged(const QString &text)
Definition: protobuf_factory.cpp:225
ParserFactoryProtobuf::onIncludeDirectory
void onIncludeDirectory()
Definition: protobuf_factory.cpp:167
ParserFactoryProtobuf::_source_tree
google::protobuf::compiler::DiskSourceTree _source_tree
Definition: protobuf_factory.h:42
ParserFactoryProtobuf::FileInfo::descriptors
std::map< QString, const google::protobuf::Descriptor * > descriptors
Definition: protobuf_factory.h:50
ParserFactoryProtobuf::createParser
MessageParserPtr createParser(const std::string &topic_name, const std::string &type_name, const std::string &schema, PlotDataMapRef &data) override
Definition: protobuf_factory.cpp:138
ParserFactoryProtobuf::onLoadFile
void onLoadFile()
Definition: protobuf_factory.cpp:188
ParserFactoryProtobuf::_loaded_file
FileInfo _loaded_file
Definition: protobuf_factory.h:52
ParserFactoryProtobuf
Definition: protobuf_factory.h:9
mqtt_test.data
dictionary data
Definition: mqtt_test.py:22
PJ::PlotDataMapRef
Definition: plotdata.h:34
ParserFactoryProtobuf::optionsWidget
QWidget * optionsWidget() override
optionsWidget pointer to a persistent widget used to set the plugin options .
Definition: protobuf_factory.h:33
ParserFactoryProtobuf::ParserFactoryProtobuf
ParserFactoryProtobuf()
Definition: protobuf_factory.cpp:11
messageparser_base.h
ParserFactoryProtobuf::ui
Ui::ProtobufLoader * ui
Definition: protobuf_factory.h:39


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45