return true;
}
+bool CAddonMgr::LoadAddonDescriptionFromMemory(const TiXmlElement *root, AddonPtr &addon)
+{
+ // create a context for these addons
+ cp_status_t status;
+ cp_context_t *context = m_cpluff->create_context(&status);
+ if (!root || !context)
+ return false;
+
+ // dump the XML back to text
+ std::string xml;
+ xml << TiXmlDeclaration("1.0", "UTF-8", "");
+ xml << *root;
+ cp_plugin_info_t *info = m_cpluff->load_plugin_descriptor_from_memory(context, xml.c_str(), xml.size(), &status);
+ if (info)
+ {
+ addon = GetAddonFromDescriptor(info);
+ m_cpluff->release_info(context, info);
+ }
+ m_cpluff->destroy_context(context);
+ return addon != NULL;
+}
+
int cp_to_clog(cp_log_severity_t lvl)
{
if (lvl >= CP_LOG_ERROR)
*/
bool LoadAddonDescription(const CStdString &path, AddonPtr &addon);
+ /*! \brief Load the addon in the given in-memory xml
+ This loads the addon using c-pluff which parses the addon descriptor file.
+ \param root Root element of an XML document.
+ \param addon [out] returned addon.
+ \return true if addon is set, false otherwise.
+ */
+ bool LoadAddonDescriptionFromMemory(const TiXmlElement *root, AddonPtr &addon);
+
/*! \brief Parse a repository XML file for addons and load their descriptors
A repository XML is essentially a concatenated list of addon descriptors.
\param root Root element of an XML document.