本文整理汇总了C++中AccountHandler::getStorageType方法的典型用法代码示例。如果您正苦于以下问题:C++ AccountHandler::getStorageType方法的具体用法?C++ AccountHandler::getStorageType怎么用?C++ AccountHandler::getStorageType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccountHandler
的用法示例。
在下文中一共展示了AccountHandler::getStorageType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: storeProfile
void AbiCollabSessionManager::storeProfile()
{
UT_DEBUGMSG(("AbiCollabSessionManager::storeProfile()\n"));
xmlBufferPtr doc = xmlBufferCreate();
if (doc)
{
xmlTextWriterPtr writer = xmlNewTextWriterMemory(doc, 0);
if (writer)
{
int rc = xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);
if (rc >= 0)
{
// TODO: one could check every return value here, but I'm lazy right now
xmlTextWriterStartElement(writer, reinterpret_cast<const xmlChar*>("AbiCollabProfile"));
for (UT_uint32 i = 0; i < m_vecAccounts.size(); i++)
{
AccountHandler* pHandler = m_vecAccounts[i];
UT_continue_if_fail(pHandler);
xmlTextWriterStartElement(writer, reinterpret_cast<const xmlChar*>("AccountHandler"));
// write out the account handler type
xmlTextWriterWriteAttribute(writer, reinterpret_cast<const xmlChar*>("type"), BAD_CAST pHandler->getStorageType().utf8_str());
// write out the account handler properties
for (PropertyMap::const_iterator cit = pHandler->getProperties().begin(); cit != pHandler->getProperties().end(); cit++)
{
xmlTextWriterWriteElement(writer, BAD_CAST cit->first.c_str(), BAD_CAST BAD_CAST cit->second.c_str());
}
// write out the account handler buddies
xmlTextWriterStartElement(writer, reinterpret_cast<const xmlChar*>("buddies"));
for (UT_uint32 j = 0; j < pHandler->getBuddies().size(); j++)
{
BuddyPtr pBuddy = pHandler->getBuddies()[j];
UT_continue_if_fail(pBuddy);
if (!pBuddy->isVolatile())
{
// we need to be able to store buddy properties
UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED);
/*xmlTextWriterStartElement(writer, reinterpret_cast<const xmlChar*>("buddy"));
// write out the buddy properties
// TODO: for now, the only useful property a buddy has is its "name";
// However in the future we really should write out a generic property list
xmlTextWriterWriteElement(
writer,
reinterpret_cast<const xmlChar*>("name"),
reinterpret_cast<const xmlChar*>(pBuddy->getName().utf8_str())
);
xmlTextWriterEndElement(writer);*/ /* end buddy */
}
}
xmlTextWriterEndElement(writer); /* end buddies */
xmlTextWriterEndElement(writer); /* end AccountHandler */
}
xmlTextWriterEndElement(writer); /* end AbiCollabProfile */
}
xmlTextWriterEndDocument(writer);
xmlFreeTextWriter(writer);
gchar * s = g_build_filename(XAP_App::getApp()->getUserPrivateDirectory(),
"AbiCollab.Profile",NULL);
UT_UTF8String profile(s);
FREEP(s);
char *uri = UT_go_filename_to_uri(profile.utf8_str());
GError* error = 0;
GsfOutput* out = UT_go_file_create (uri, &error);
if (out)
{
gsf_output_write(out,
strlen(reinterpret_cast<const char*>(const_cast<const xmlChar*>(doc->content))),
reinterpret_cast<const guint8*>(const_cast<const xmlChar*>(doc->content))
);
gsf_output_close(out);
g_object_unref(G_OBJECT(out));
}
else
{
UT_DEBUGMSG(("Error creating AbiCollab Profile %s: %s!\n", profile.utf8_str(), error ? error->message : "unknown error"));
}
FREEP(uri);
}
else
{
UT_DEBUGMSG(("Error creating XML output writer\n"));
}
xmlBufferFree(doc);
}
else
{
UT_DEBUGMSG(("Error creating XML output buffer\n"));
}
}