73 if (!xml_file.isEmpty())
76 tinyxml2::XMLDocument document;
77 document.LoadFile(xml_file.toStdString().c_str());
78 tinyxml2::XMLElement*
config = document.RootElement();
79 if (config ==
nullptr)
81 ROS_ERROR(
"Skipping XML Document \"%s\" which had no Root Element. This likely means the XML is " 82 "malformed or missing.",
83 xml_file.toStdString().c_str());
84 return QSet<QString>();
86 if (std::string(config->Name()) !=
"library" && std::string(config->Name()) !=
"class_libraries")
88 ROS_ERROR(
"The XML document \"%s\" given to add must have either \"library\" or \ 89 \"class_libraries\" as the root tag",
90 xml_file.toStdString().c_str());
91 return QSet<QString>();
94 if (std::string(config->Name()) ==
"class_libraries")
96 config = config->FirstChildElement(
"library");
99 tinyxml2::XMLElement*
library = config;
100 while (library !=
nullptr)
102 tinyxml2::XMLElement* class_element = library->FirstChildElement(
"class");
103 while (class_element)
105 std::string derived_class = class_element->Attribute(
"type");
107 std::string current_class_id;
108 if (class_element->Attribute(
"name") !=
nullptr)
110 current_class_id = class_element->Attribute(
"name");
111 ROS_DEBUG(
"XML file specifies lookup name (i.e. magic name) = %s.", current_class_id.c_str());
115 ROS_DEBUG(
"XML file has no lookup name (i.e. magic name) for class %s, assuming class_id == " 117 derived_class.c_str());
118 current_class_id = derived_class;
121 QSet<QString> message_types;
122 tinyxml2::XMLElement* message_type = class_element->FirstChildElement(
"message_type");
126 if (message_type->GetText())
128 const char* message_type_str = message_type->GetText();
129 ROS_DEBUG_STREAM(current_class_id <<
" supports message type " << message_type_str);
130 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 131 message_types.insert(QString::fromAscii(message_type_str));
133 message_types.insert(QString(message_type_str));
136 message_type = message_type->NextSiblingElement(
"message_type");
142 class_element = class_element->NextSiblingElement(
"class");
144 library = library->NextSiblingElement(
"library");
154 return QSet<QString>();
Display * makeRaw(const QString &class_id, QString *error_return=nullptr) override
Overridden from PluginlibFactory<Display> to set the icon of the Display.
virtual void addBuiltInClass(const QString &package, const QString &name, const QString &description, Display *(*factory_function)())
virtual QSet< QString > getMessageTypes(const QString &class_id)
Get all supported message types for the given class id.
virtual QString getPluginManifestPath(const QString &class_id) const
A Display object which stores other Displays as children.
#define ROS_DEBUG_STREAM(args)
QMap< QString, QSet< QString > > message_type_cache_
Type * makeRaw(const QString &class_id, QString *error_return=nullptr) override
Instantiate and return a instance of a subclass of Type using our pluginlib::ClassLoader.
static Display * newDisplayGroup()
QIcon getIcon(const QString &class_id) const override
void setIcon(const QIcon &icon) override
Set the Display's icon.