本文整理汇总了C++中TiXmlElement::SetUnsignedIntAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::SetUnsignedIntAttribute方法的具体用法?C++ TiXmlElement::SetUnsignedIntAttribute怎么用?C++ TiXmlElement::SetUnsignedIntAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlElement
的用法示例。
在下文中一共展示了TiXmlElement::SetUnsignedIntAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SavePrefs
/****************************************************************************
* Save Preferences
***************************************************************************/
bool SavePrefs(bool silent)
{
char filepath[MAXPATHLEN];
FixInvalidSettings();
sprintf(filepath, "%s/%s", MPLAYER_DATADIR, PREF_FILE_NAME);
TiXmlDocument doc;
TiXmlDeclaration * decl = new TiXmlDeclaration("1.0", "", "");
doc.LinkEndChild(decl);
TiXmlElement* settings = new TiXmlElement("settings");
doc.LinkEndChild(settings);
TiXmlElement* file = new TiXmlElement("file");
settings->LinkEndChild(file);
file->SetAttribute("app", APPNAME);
file->SetAttribute("version", APPVERSION);
//Global
TiXmlElement* global = new TiXmlElement("global");
settings->LinkEndChild(global);
TiXmlElement* exit = new TiXmlElement("exit");
global->LinkEndChild(exit);
exit->SetAttribute("value", XMPlayerCfg.exit_action);
TiXmlElement* language = new TiXmlElement("language");
global->LinkEndChild(language);
language->SetAttribute("value", XMPlayerCfg.language);
//File browser
TiXmlElement* filebrowser = new TiXmlElement("filebrowser");
settings->LinkEndChild(filebrowser);
TiXmlElement* sort = new TiXmlElement("sort");
filebrowser->LinkEndChild(sort);
sort->SetAttribute("value", XMPlayerCfg.sort_order);
//Audio
TiXmlElement* audio = new TiXmlElement("audio");
settings->LinkEndChild(audio);
TiXmlElement* alang = new TiXmlElement("language");
audio->LinkEndChild(alang);
alang->SetAttribute("value", XMPlayerCfg.alang);
alang->SetAttribute("desc", XMPlayerCfg.alang_desc);
TiXmlElement* volume = new TiXmlElement("volume");
audio->LinkEndChild(volume);
volume->SetAttribute("value", XMPlayerCfg.volume);
TiXmlElement* softvol = new TiXmlElement("softvol");
audio->LinkEndChild(softvol);
softvol->SetAttribute("value", XMPlayerCfg.softvol);
//Video
TiXmlElement* video = new TiXmlElement("video");
settings->LinkEndChild(video);
TiXmlElement* framedrop = new TiXmlElement("framedrop");
video->LinkEndChild(framedrop);
framedrop->SetAttribute("value", XMPlayerCfg.framedrop);
TiXmlElement* vsync = new TiXmlElement("vsync");
video->LinkEndChild(vsync);
vsync->SetAttribute("value", XMPlayerCfg.vsync);
//Subtitles
TiXmlElement* subtitles = new TiXmlElement("subtitles");
settings->LinkEndChild(subtitles);
TiXmlElement* subcolor = new TiXmlElement("sub_color");
subtitles->LinkEndChild(subcolor);
subcolor->SetUnsignedIntAttribute("value", XMPlayerCfg.subcolor);
TiXmlElement* border_color = new TiXmlElement("border_color");
subtitles->LinkEndChild(border_color);
border_color->SetUnsignedIntAttribute("value", XMPlayerCfg.border_color);
TiXmlElement* subcp = new TiXmlElement("codepage");
subtitles->LinkEndChild(subcp);
subcp->SetAttribute("value", XMPlayerCfg.subcp);
subcp->SetAttribute("desc", XMPlayerCfg.subcp_desc);
TiXmlElement* sublang = new TiXmlElement("language");
subtitles->LinkEndChild(sublang);
sublang->SetAttribute("value", XMPlayerCfg.sublang);
sublang->SetAttribute("desc", XMPlayerCfg.sublang_desc);
bool success = doc.SaveFile(filepath);
doc.Clear();
if (success)
return true;
else
return false;
}