| 36 | #include <set> |
| 37 | |
| 38 | class AdaptorGenerator : public BaseGenerator |
| 39 | { |
| 40 | protected: |
| 41 | /** |
| 42 | * Transform xml to adaptor code |
| 43 | * @param doc |
| 44 | * @param filename |
| 45 | * @return 0 if ok |
| 46 | */ |
| 47 | int transformXmlToFileImpl(const sdbuscpp::xml::Document& doc, const char* filename) const override; |
| 48 | |
| 49 | private: |
| 50 | /** |
| 51 | * Generate source code for interface |
| 52 | * @param interface |
| 53 | * @return source code |
| 54 | */ |
| 55 | std::string processInterface(sdbuscpp::xml::Node& interface) const; |
| 56 | |
| 57 | /** |
| 58 | * Generate source code for methods |
| 59 | * @param methods |
| 60 | * @return tuple: registration of methods, declaration of abstract methods |
| 61 | */ |
| 62 | std::tuple<std::vector<std::string>, std::string> processMethods(const sdbuscpp::xml::Nodes& methods) const; |
| 63 | |
| 64 | /** |
| 65 | * Generate source code for signals |
| 66 | * @param signals |
| 67 | * @return tuple: registration of signals, definition of signal methods |
| 68 | */ |
| 69 | std::tuple<std::vector<std::string>, std::string> processSignals(const sdbuscpp::xml::Nodes& signals) const; |
| 70 | |
| 71 | /** |
| 72 | * Generate source code for properties |
| 73 | * @param properties |
| 74 | * @return tuple: registration of properties, declaration of property accessor virtual methods |
| 75 | */ |
| 76 | std::tuple<std::vector<std::string>, std::string> processProperties(const sdbuscpp::xml::Nodes& properties) const; |
| 77 | |
| 78 | std::string createVTableRegistration(const std::string& annotationRegistration, |
| 79 | const std::vector<std::string>& methodRegistrations, |
| 80 | const std::vector<std::string>& signalRegistrations, |
| 81 | const std::vector<std::string>& propertyRegistrations) const; |
| 82 | |
| 83 | /** |
| 84 | * Get annotations listed for a given node |
| 85 | * @param node |
| 86 | * @return map of annotation names to their values |
| 87 | */ |
| 88 | std::map<std::string, std::string> getAnnotations(sdbuscpp::xml::Node& node) const; |
| 89 | |
| 90 | /** |
| 91 | * Get flag for property update behavior annotation value |
| 92 | * @param annotationValue |
| 93 | * @return flag |
| 94 | */ |
| 95 | std::string propertyAnnotationToFlag(const std::string& annotationValue) const; |
nothing calls this directly
no outgoing calls
no test coverage detected