当前位置: 首页>>代码示例>>C++>>正文


C++ CXmlNode::SetType方法代码示例

本文整理汇总了C++中CXmlNode::SetType方法的典型用法代码示例。如果您正苦于以下问题:C++ CXmlNode::SetType方法的具体用法?C++ CXmlNode::SetType怎么用?C++ CXmlNode::SetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CXmlNode的用法示例。


在下文中一共展示了CXmlNode::SetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PopulateXmlNode

void CSite::PopulateXmlNode(CXmlTree& Tree, CTreeElement< CXmlNode > * pXmlNode) const {
  CXmlNode ConfigNode;
  ConfigNode.SetType(xmlnOpen);
  CString RConfigPath(m_ConfigPath);  
  RConfigPath.Replace('/', '\\');
  RConfigPath.Replace("\\", "%5C");
  RConfigPath.Replace(":", "%3A");
  
  ConfigNode.SetData(RConfigPath);
  
  CTreeElement< CXmlNode > * NewXmlNodePtr = Tree.AddChildLast(pXmlNode, ConfigNode);
    
  static CString SiteXml(
    "<path></path>"                             \
    "<vsize></vsize>"                           \
    "<alias></alias>"                           \
    "<processed>"                               \
    " <size></size>"                            \
    " <modified></modified>"                    \
    " <words></words>"                          \
    " <urls></urls>"                            \
    " <last>N/A</last>"                         \
    "</processed>"                              \
	"<threads>"                                 \
	" <max></max>"                              \
	" <rampup></rampup>"                        \
	" <maxqueue></maxqueue>"                    \
	" <maxidle></maxidle>"                      \
	" <jobs></jobs>"                            \
	" <threads></threads>"                      \
	" <waiting></waiting>"                      \
    "</threads>"                                \
    "<cnf>"                                     \
    "</cnf>"                                    \
    "<search>"                                  \
    "</search>");
  
  CXmlTree XmlTree;
  XmlTree.SetXml(SiteXml);
  
  m_IndexMutex.StartReading();
  XmlTree.SetValue("/path", RConfigPath);
  XmlTree.SetValue("/vsize", CString::IntToStr(m_SiteConfigs.GetSize()));
  XmlTree.SetValue("/alias", m_Alias);
  XmlTree.SetValue("/processed/size", CString::IntToStr(m_ProcessedFiles.Get()));
  if (m_LastProcessedUrl.GetLength()) {
    XmlTree.SetValue("/processed/last", m_LastProcessedUrl);
  }
  
  XmlTree.SetValue("/threads/max", CString::IntToStr(m_IndexPool.GetMaxThreads()));
  XmlTree.SetValue("/threads/rampup", CString::IntToStr(m_IndexPool.GetRampupThreads()));
  XmlTree.SetValue("/threads/maxqueue", CString::IntToStr(m_IndexPool.GetMaxQueueSize()));
  XmlTree.SetValue("/threads/maxidle", CString::IntToStr(m_IndexPool.GetMaxThreadIdle()) + " seconds");
  XmlTree.SetValue("/threads/jobs", CString::IntToStr(m_IndexPool.GetJobsList().GetSize()));
  XmlTree.SetValue("/threads/threads", CString::IntToStr(m_IndexPool.GetThreads().GetSize()));
  XmlTree.SetValue("/threads/waiting", CString::IntToStr(m_IndexPool.GetWaitingThreads().Get()));

  CTreeElement< CXmlNode > * XmlCnfNodePtr = XmlTree.XmlFind("/cnf");
  for (int i=0;i<(int) m_SiteConfigs.GetSize();i++) {
    CXmlNode ConfigNode;
    ConfigNode.SetType(xmlnOpen);
    ConfigNode.SetData("vcnf-" + CString::IntToStr(i));  
    m_SiteConfigs[i].PopulateXmlNode(XmlTree, XmlTree.AddChildLast(XmlCnfNodePtr, ConfigNode)); 
    ConfigNode.SetType(xmlnClose);
    XmlTree.AddChildLast(XmlCnfNodePtr, ConfigNode);
  }

  m_SiteIndex.PopulateXmlNode(XmlTree, XmlTree.XmlFind("/search")); 

  // move the full tree
  Tree.MoveAsChildLast(XmlTree, XmlTree.GetHead(), NewXmlNodePtr);
  
  m_IndexMutex.StopReading();
  
  ConfigNode.SetType(xmlnClose);
  XmlTree.AddChildLast(pXmlNode, ConfigNode);  
}
开发者ID:dblock,项目名称:alkaline,代码行数:77,代码来源:Site.cpp


注:本文中的CXmlNode::SetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。