本文整理汇总了C++中XNode类的典型用法代码示例。如果您正苦于以下问题:C++ XNode类的具体用法?C++ XNode怎么用?C++ XNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
void TitleSubst::Load(const std::string &filename, const std::string §ion)
{
XNode xml;
if( !XmlFileUtil::LoadFromFileShowErrors(xml,filename) )
{
// LoadFromFile will show its own error
//LOG->Trace("Error opening %s: %s", filename.c_str(), f.GetError().c_str() );
return;
}
XNode *pGroup = xml.GetChild( section );
if( pGroup == nullptr )
{
return;
}
for (auto const *child: *pGroup)
{
if( child == nullptr || child->GetName() != "Translation" )
{
continue;
}
TitleTrans tr;
tr.LoadFromNode( child );
AddTrans(tr);
}
}
示例2:
bool
RouteAddress::XMLStore(XNode *pParentNode, int iOptions)
{
XNode *pNode = pParentNode->AppendChild(_T("RouteAddress"));
pNode->AppendAttr(_T("Name"), m_sAddress);
return true;
}
示例3: XNode
XNode* TapNote::CreateNode() const
{
XNode *p = new XNode( "TapNote" );
p->AppendChild( result.CreateNode() );
p->AppendChild( HoldResult.CreateNode() );
return p;
}
示例4: CreateNode
XNode* SongID::CreateNode() const
{
XNode* pNode = new XNode;
pNode->name = "Song";
pNode->AppendAttr( "Dir", sDir );
return pNode;
}
示例5: XNode
XNode* TrailID::CreateNode() const
{
XNode* pNode = new XNode( "Trail" );
pNode->AppendAttr( "StepsType", GAMEMAN->GetStepsTypeInfo(st).szName );
pNode->AppendAttr( "CourseDifficulty", DifficultyToString(cd) );
return pNode;
}
示例6:
bool
FetchAccountUID::XMLStore(XNode *pUIDsNode, int iOptions)
{
XNode *pUIDNode = pUIDsNode->AppendChild(_T("UID"));
pUIDNode->AppendAttr(_T("UID"), uid_);
pUIDNode->AppendAttr(_T("Date"), date_);
return true;
}
示例7:
bool
BlockedAttachment::XMLStore(XNode *pParentNode, int iOptions)
{
XNode *pNode = pParentNode->AppendChild(_T("BlockedAttachment"));
pNode->AppendAttr(_T("Name"), m_sWildcard);
pNode->AppendAttr(_T("Description"), m_sDescription);
return true;
}
示例8: GetName
bool
TCPIPPort::XMLStore(XNode *pParentNode, int iOptions)
{
XNode *pNode = pParentNode->AppendChild(_T("TCPIPPort"));
pNode->AppendAttr(_T("Name"), GetName());
pNode->AppendAttr(_T("PortProtocol"), StringParser::IntToString(m_iPortProtocol));
pNode->AppendAttr(_T("PortNumber"), StringParser::IntToString(m_iPortNumber));
//JDR: added the following code to set if we are using a StartTLS connection.
if (m_bUseSSL == true){
pNode->AppendAttr(_T("UseSSL"), _T("1"));
} else if (m_bUseSTARTTLS == true){
LOG_DEBUG("Set UseSTARTLS");
pNode->AppendAttr(_T("UseSSL"), _T("2"));
} else {
pNode->AppendAttr(_T("UseSSL"), _T("0"));
}
pNode->AppendAttr(_T("Address"), String(_address.ToString()));
if (m_iSSLCertificateID > 0)
{
pNode->AppendAttr(_T("SSLCertificateName"), _GetSSLCertificateName(m_iSSLCertificateID));
}
return true;
}
示例9:
bool
SSLCertificate::XMLStore(XNode *pParentNode, int iOptions)
{
XNode *pNode = pParentNode->AppendChild(_T("SSLCertificate"));
pNode->AppendAttr(_T("Name"), m_sName);
pNode->AppendAttr(_T("CertificateFile"), m_sCertificateFile);
pNode->AppendAttr(_T("PrivateKeyFile"), m_sPrivateKeyFile);
return true;
}
示例10:
bool
SSLCertificate::XMLStore(XNode *pParentNode, int iOptions)
{
XNode *pNode = pParentNode->AppendChild(_T("SSLCertificate"));
pNode->AppendAttr(_T("Name"), name_);
pNode->AppendAttr(_T("CertificateFile"), certificate_file_);
pNode->AppendAttr(_T("PrivateKeyFile"), private_key_file_);
return true;
}
示例11:
bool
ACLPermission::XMLStore(XNode *pParentNode, int iOptions)
{
XNode *pNode = pParentNode->AppendChild(_T("Permission"));
pNode->AppendAttr(_T("Type"), StringParser::IntToString(m_iPermissionType));
pNode->AppendAttr(_T("Rights"), StringParser::IntToString(m_iValue));
pNode->AppendAttr(_T("Holder"), _GetPermissionHolderName(this));
return true;
}
示例12: CreateNode
XNode* CourseID::CreateNode() const
{
XNode* pNode = new XNode;
pNode->name = "Course";
if( !sPath.empty() )
pNode->AppendAttr( "Path", sPath );
if( !sFullTitle.empty() )
pNode->AppendAttr( "FullTitle", sFullTitle );
return pNode;
}
示例13: SaveEditableDataToDir
bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const
{
m_sLastPlayedMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
m_LastPlayedDate = DateTime::GetNowDate();
// Save editable.xml
SaveEditableDataToDir( sDir );
// Save stats.xml
CString fn = sDir + STATS_XML;
XNode xml;
xml.name = "Stats";
xml.AppendChild( SaveGeneralDataCreateNode() );
xml.AppendChild( SaveSongScoresCreateNode() );
xml.AppendChild( SaveCourseScoresCreateNode() );
xml.AppendChild( SaveCategoryScoresCreateNode() );
xml.AppendChild( SaveScreenshotDataCreateNode() );
xml.AppendChild( SaveCalorieDataCreateNode() );
xml.AppendChild( SaveRecentSongScoresCreateNode() );
xml.AppendChild( SaveRecentCourseScoresCreateNode() );
if( IsMachine() )
xml.AppendChild( SaveCoinDataCreateNode() );
DISP_OPT opts = optDefault;
opts.stylesheet = STATS_XSL;
opts.write_tabs = false;
bool bSaved = xml.SaveToFile(fn, &opts);
// Update file cache, or else IsAFile in CryptManager won't see this new file.
FILEMAN->FlushDirCache( sDir );
if( bSaved && bSignData )
{
CString sStatsXmlSigFile = fn+SIGNATURE_APPEND;
CryptManager::SignFileToFile(fn, sStatsXmlSigFile);
// Update file cache, or else IsAFile in CryptManager won't see sStatsXmlSigFile.
FILEMAN->FlushDirCache( sDir );
// Save the "don't share" file
CString sDontShareFile = sDir + DONT_SHARE_SIG;
CryptManager::SignFileToFile(sStatsXmlSigFile, sDontShareFile);
}
SaveStatsWebPageToDir( sDir );
// Empty directories if none exist.
FILEMAN->CreateDir( sDir + EDITS_SUBDIR );
FILEMAN->CreateDir( sDir + SCREENSHOTS_SUBDIR );
return bSaved;
}
示例14:
void
BackupExecuter::_RestoreDataDirectory(shared_ptr<Backup> pBackup, XNode *pBackupNode)
{
XNode *pBackupInfoNode = pBackupNode->GetChild(_T("BackupInformation"));
// Create the path to the zip file.
String sBackupFile = pBackup->GetBackupFile();
String sPath = sBackupFile.Mid(0, sBackupFile.ReverseFind(_T("\\")));
String sDirContainingDataFiles;
String sDataFileFormat = pBackupInfoNode->GetChildAttr(_T("DataFiles"), _T("Format"))->value;
String sExtractedFilesDirectory;
if (sDataFileFormat.CompareNoCase(_T("7Z")) == 0)
{
// Create the path to the directory that will contain the extracted files.
// This directory is temporary and will be removed when we're done.
sExtractedFilesDirectory = Utilities::GetUniqueTempDirectory();
// Extract the files to this directory.
Compression oComp;
oComp.Uncompress(sBackupFile, sExtractedFilesDirectory);
// The data files in the zip file are stored in
// a directory called DataBackup.
sDirContainingDataFiles = sExtractedFilesDirectory + "\\DataBackup";
}
else
{
// Fetch the path to the data files.
String sFolderName = pBackupInfoNode->GetChildAttr(_T("DataFiles"), _T("FolderName"))->value;
sDirContainingDataFiles = sPath + "\\" + sFolderName;
}
// Delete all directories from the data directory
// so that we're sure that we're doing a clean restore
String sDataDirectory = IniFileSettings::Instance()->GetDataDirectory();
std::set<String> vecExcludes;
FileUtilities::DeleteFilesInDirectory(sDataDirectory);
FileUtilities::DeleteDirectoriesInDirectory(sDataDirectory, vecExcludes);
String errorMessage;
FileUtilities::CopyDirectory(sDirContainingDataFiles, sDataDirectory, errorMessage);
if (sDataFileFormat.CompareNoCase(_T("7z")) == 0)
{
// The temporary directory we created while
// unzipping should be deleted now.
FileUtilities::DeleteDirectory(sExtractedFilesDirectory);
}
}
示例15: XNode
XNode* StepsID::CreateNode() const
{
XNode* pNode = new XNode( "Steps" );
pNode->AppendAttr( "StepsType", GAMEMAN->GetStepsTypeInfo(st).szName );
pNode->AppendAttr( "Difficulty", DifficultyToString(dc) );
if( dc == Difficulty_Edit )
{
pNode->AppendAttr( "Description", sDescription );
pNode->AppendAttr( "Hash", uHash );
}
return pNode;
}