// // Created by bbr on 27.05.22.. // #ifndef SCHEMEEDITOR_APPLICATION_H #define SCHEMEEDITOR_APPLICATION_H #include #include "comdel/domain/library.h" #include "comdel/domain/schema.h" #include "comdel/domain/comdel_validator.h" class Application { private: std::string libraryPath; std::optional library = std::nullopt; domain::Schema* schema = nullptr; std::vector validators = domain::getSupportedValidators(); std::string generateName(std::set& names, std::string instanceName); domain::ComponentInstance *findComponentByName(std::string componentName); domain::BusInstance *findBusByName(std::string busName); public: std::optional getLibrary(); domain::Schema* getSchema(); void clear(); bool loadLibrary(std::string& filename, std::ostream& errorOutput); std::pair> loadSchema(std::string& filename, std::ostream& errorOutput); static Application* instance(); bool generateSchema(std::ostringstream &output); std::vector validateSchema(); std::vector generateComdel(std::ostringstream &output); std::shared_ptr addComponent(domain::Component component, std::vector attributes, int x, int y); bool removeComponent(std::string component); std::shared_ptr addBus(domain::Bus bus, int x, int y); bool removeBus(std::string bus); static bool hasErrors(std::vector empty); ~Application() = default; void renameComponent(std::string currentName, std::string newName); void renameBus(std::string currentName, std::string newName); void removeConnection(domain::ConnectionInstance *pInstance); }; #endif //SCHEMEEDITOR_APPLICATION_H