Exemplo n.º 1
0
OsStatus
PluginXmlParser::loadPlugin (
    TiXmlElement& pluginElement,
    Notifier* notifier,
	SubscribeServerPluginBase** plugin)
{
	OsStatus status = OS_SUCCESS;

	UtlString dllTagName = "load-library";
	TiXmlElement* dllElem = requireElement(pluginElement, dllTagName, &status);
	if (status != OS_SUCCESS)
		return status;
	TiXmlText* dllTxt = requireText(*dllElem, &status);
	if (status != OS_SUCCESS)
		return status;

	// Dynamically load a library
	//OsSharedLibMgr* mgr = OsSharedLibMgr::getOsSharedLibMgr();
	OsSharedLibMgrBase* mgr = OsSharedLibMgr::getOsSharedLibMgr();
	if (!mgr)
		return OS_FAILED;
	OsStatus dllStatus = mgr->loadSharedLib(dllTxt->Value());
	if (dllStatus != OS_SUCCESS)
		return dllStatus;


	// Find the entry point in the library for the factory
	UtlString entryTagName = "plugin-factory";
	TiXmlElement* entryElem = requireElement(pluginElement, entryTagName, &status);
	if (status != OS_SUCCESS)
		return status;
	TiXmlText* entryTxt = requireText(*entryElem, &status);
	if (status != OS_SUCCESS)
		return status;

	OsStatus entryStatus = mgr->getSharedLibSymbol(dllTxt->Value(), entryTxt->Value(),
		    (void*&)PluginFactoryProc);

	if (entryStatus != OS_SUCCESS)
		return entryStatus;

	// Call the factory to construct the plugin
	*plugin = PluginFactoryProc(pluginElement, notifier);
	if (*plugin == NULL)
	{
		OsSysLog::add(FAC_SIP, PRI_ERR, "PluginXmlParser::loadPlugin return null "
	        "SubscribeServerPluginBasemissing %s ", entryTxt->Value());
		return OS_FAILED;
	}


    return OS_SUCCESS;
}
Exemplo n.º 2
0
void LoaderXml::root()
{
    auto doc = requireElement(xml,"document");
    builder.beginDocument();
    id(doc);
    document_ = builder.currentDocument();
    /// \todo file format version
    document_->setImageSize(QSize(
        doc.attribute("width","32").toInt(),
        doc.attribute("height","32").toInt()
                            ));
    metadata(doc.firstChildElement("metadata"));
    animations(doc.firstChildElement("animations"));
    formats(doc.firstChildElement("formats"));
    layers(doc);
    builder.endDocument();
}