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


C++ TiXmlNode::NextSiblingElement方法代码示例

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


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

示例1: Recurse

void Recurse(TiXmlNode * pParentNode, CCObject * pParentObj)
{
  std::string keyValue;
  for (TiXmlNode * pNode = pParentNode->FirstChild(); pNode; pNode = pNode->NextSiblingElement())
  {
    TiXmlElement * pNodeNE = pNode->ToElement();
    if (pNodeNE == NULL) continue;
    const char * szValue = pNodeNE->Value();
    const char * szText = pNodeNE->GetText();
    if (_stricmp(szValue, "key") == 0)
    {
      keyValue = szText;
    }
    else if (_stricmp(szValue, "dict") == 0)
    {
      CCDictionary * pNewDict = new CCDictionary;
      addObject(pParentObj, keyValue, pNewDict);
        
      Recurse(pNode, pNewDict);
    }
    else if (_stricmp(szValue, "array") == 0)
    {
      CCArray * pNewArray = new CCArray();
      addObject(pParentObj, keyValue, pNewArray);
        
      Recurse(pNode, pNewArray);
    }
    else if (_stricmp(szValue, "string") == 0)
    {
      const char * szIn = szText == NULL ? "" : szText;
      std::wstring ret = ConvertToWString(szIn);
      CCString * pString = new CCString(ret.c_str());
      addObject(pParentObj, keyValue, pString);
    }
    else if (_stricmp(szValue, "false") == 0 || _stricmp(szValue, "true") == 0)
    {
      CCBool * pBool = new CCBool(_stricmp(szValue, "true") == 0);
      addObject(pParentObj, keyValue, pBool);
    }
    else if (_stricmp(szValue, "integer") == 0)
    {
      CCInteger * pInt = new CCInteger(atoi(szText));
      addObject(pParentObj, keyValue, pInt);
    }
    else if (_stricmp(szValue, "real") == 0)
    {
      CCReal * pReal = new CCReal(atof(szText));
      addObject(pParentObj, keyValue, pReal);
    }
    else if (_stricmp(szValue, "date") == 0)
    {
      CCDate * pDate = new CCDate(getTimeFromString(szText));
      addObject(pParentObj, keyValue, pDate);
    }
    else
    {
      assert(!"unknown value");
    }
  }
}
开发者ID:nkligang,项目名称:ccbi2ccb,代码行数:60,代码来源:plistHelper.cpp

示例2: _parse

bool html_parse::_parse(TiXmlDocument& doc)
{
    TiXmlElement* rootElement = doc.RootElement();
    if (!rootElement)
    {
        return false;
    }

    std::string rootName = rootElement->ValueStr();
    if (rootName.empty()
        || rootName != "html")
    {
        return false;
    }

    for (TiXmlNode* nodeRoot = rootElement->FirstChildElement();
        nodeRoot != nullptr;
        nodeRoot = nodeRoot->NextSiblingElement())
    {
        html_object* object = new html_object;
        if (!object)
        {
            continue;
        }

        if (object->parse(nodeRoot))
        {
            m_htmlElement.push_back(object);
        }
    }
    return true;
}
开发者ID:Sumxx,项目名称:gogame,代码行数:32,代码来源:html_parse.cpp

示例3: next

  XML_Element_c XML_Element_c::next() const {
    if(!m_handle.ToNode()) {
      std::cerr << "Bad XML_Element_c attempted to access next field\n";
      throw XML_Element_Ungood();
    }

    TiXmlNode * node = m_handle.ToNode();
    return XML_Element_c(node ? node->NextSiblingElement() : 0);
  }
开发者ID:Sonophoto,项目名称:Soar-SC,代码行数:9,代码来源:XML.cpp

示例4: readComment

const char* SimXMLDocument::readComment( S32 index )
{
   // Clear the current attribute pointer
   m_CurrentAttribute = 0;

   // Push the first element found under the current element of the given name
   if(!m_paNode.empty())
   {
      const int iLastElement = m_paNode.size() - 1;
      TiXmlElement* pNode = m_paNode[iLastElement];
      if(!pNode)
      {
         return "";
      }
      TiXmlNode* node = pNode->FirstChild();
      for( S32 i = 0; i < index; i++ )
      {
         if( !node )
            return "";

         node = node->NextSiblingElement();
      }

      if( node )
      {
         TiXmlComment* comment = node->ToComment();
         if( comment )
            return comment->Value();
      }
   }
   else
   {
      if(!m_qDocument)
      {
         return "";
      }
      TiXmlNode* node = m_qDocument->FirstChild();
      for( S32 i = 0; i < index; i++ )
      {
         if( !node )
            return "";

         node = node->NextSibling();
      }

      if( node )
      {
         TiXmlComment* comment = node->ToComment();
         if( comment )
            return comment->Value();
      }
   }
   return "";
}
开发者ID:greenfire27,项目名称:Torque2D,代码行数:54,代码来源:SimXMLDocument.cpp

示例5: selectChildNode

TiXmlNode * readXMLConfig::SelectSingleNodeByRootEle(TiXmlElement* RootElement,string & nodeName,string nodeAttrName,string nodeAttrValue)  
{  
	//加载一个XML的文档对象。  
	 
	//  TiXmlDocument *xmlDoc = new TiXmlDocument(cXmlName);  
	//  if(!xmlDoc->LoadFile())  //是tinyXml会自动处理文档的BOM  
	//  {  
	//      return NULL;  
	//  }  
	//    
	//    
	//  if(xmlDoc == NULL)  
	//  {  
	//      return NULL;  
	//  }  
	 
	//获得根元素  
	//TiXmlElement *RootElement = xmlDoc->RootElement();  
    if(RootElement == NULL)  
    {  
        // cout << "parse error,can't get root element" << endl;
        dzlog_error("parse error,can't get root element.");  
        return NULL;  
    }  
     
    TiXmlNode * pNode  = NULL;  
    TiXmlNode * pSelectNode = NULL;  
    string msg = "";  
     
    for(pNode=RootElement->FirstChildElement();pNode;pNode=pNode->NextSiblingElement())  
    {  
         
        pSelectNode = selectChildNode(pNode,nodeName,nodeAttrName,nodeAttrValue);  
        if(pSelectNode)  
        {  
            break;  
        }  
    }  
     
    if(pSelectNode)  
    {  
        //cout << "解析成功" << endl;  
        //cout << pSelectNode->Value() << endl;  
        return pSelectNode;  
    }  
    else  
    {  
        // cout << "parse error,can't get node" << endl;  
        dzlog_error("parse error,can't get node.");  
        return NULL;  
    }  
     
}
开发者ID:uglychen,项目名称:chenxun,代码行数:53,代码来源:readXMLConfig.cpp

示例6: ResolveParametersForNode

void CGUIIncludes::ResolveParametersForNode(TiXmlElement *node, const Params& params)
{
  if (!node)
    return;
  std::string newValue;
  // run through this element's attributes, resolving any parameters
  TiXmlAttribute *attribute = node->FirstAttribute();
  while (attribute)
  {
    ResolveParamsResult result = ResolveParameters(attribute->ValueStr(), newValue, params);
    if (result == SINGLE_UNDEFINED_PARAM_RESOLVED && strcmp(node->Value(), "param") == 0 &&
        strcmp(attribute->Name(), "value") == 0 && node->Parent() && strcmp(node->Parent()->Value(), "include") == 0)
    {
      // special case: passing <param name="someName" value="$PARAM[undefinedParam]" /> to the nested include
      // this usually happens when trying to forward a missing parameter from the enclosing include to the nested include
      // problem: since 'undefinedParam' is not defined, it expands to <param name="someName" value="" /> and overrides any default value set with <param name="someName" default="someValue" /> in the nested include
      // to prevent this, we'll completely remove this parameter from the nested include call so that the default value can be correctly picked up later
      node->Parent()->RemoveChild(node);
      return;
    }
    else if (result != NO_PARAMS_FOUND)
      attribute->SetValue(newValue);
    attribute = attribute->Next();
  }
  // run through this element's value and children, resolving any parameters
  TiXmlNode *child = node->FirstChild();
  if (child)
  {
    if (child->Type() == TiXmlNode::TINYXML_TEXT)
    {
      ResolveParamsResult result = ResolveParameters(child->ValueStr(), newValue, params);
      if (result == SINGLE_UNDEFINED_PARAM_RESOLVED && strcmp(node->Value(), "param") == 0 &&
          node->Parent() && strcmp(node->Parent()->Value(), "include") == 0)
      {
        // special case: passing <param name="someName">$PARAM[undefinedParam]</param> to the nested include
        // we'll remove the offending param tag same as above
        node->Parent()->RemoveChild(node);
      }
      else if (result != NO_PARAMS_FOUND)
        child->SetValue(newValue);
    }
    else if (child->Type() == TiXmlNode::TINYXML_ELEMENT)
    {
      do
      {
        TiXmlElement *next = child->NextSiblingElement();   // save next as current child might be removed from the tree
        ResolveParametersForNode(static_cast<TiXmlElement *>(child), params);
        child = next;
      }
      while (child);
    }
  }
}
开发者ID:AchimTuran,项目名称:xbmc,代码行数:53,代码来源:GUIIncludes.cpp

示例7: Parse_XML_define_File

bool CXmlOpeation::Parse_XML_define_File(char* pFileName, _Proc_Define_Info& obj_Proc_Define_Info)
{
	Close();
	m_pTiXmlDocument = new TiXmlDocument(pFileName);
	if(NULL == m_pTiXmlDocument)
	{
		return false;
	}

	if(false == m_pTiXmlDocument->LoadFile())
	{
		return false;
	}

	TiXmlNode* pMainNode     = NULL;

	//获得根元素
	m_pRootElement = m_pTiXmlDocument->RootElement();

	if(NULL == m_pRootElement)
	{
		return false;
	}

	//获得工程名称
	sprintf_safe(obj_Proc_Define_Info.m_szProcName, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("ProcName"));

	//循环获取预定义信息
	for(pMainNode = m_pRootElement->FirstChildElement();pMainNode;pMainNode = pMainNode->NextSiblingElement())
	{
		_Define_Info obj_Define_Info;

		//获得Lua文件信息
		int nMainType = pMainNode->Type();

		if(nMainType != TiXmlText::TINYXML_ELEMENT)
		{
			continue;
		}

		TiXmlElement* pMainElement = pMainNode->ToElement();
		sprintf_safe(obj_Define_Info.m_szSrcType, MAX_BUFF_50, "%s", pMainElement->Attribute("srcType"));
		sprintf_safe(obj_Define_Info.m_szTagType, MAX_BUFF_50, "%s", pMainElement->Attribute("tagType"));
		sprintf_safe(obj_Define_Info.m_szDesc, MAX_BUFF_100, "%s", pMainElement->Attribute("desc"));
		obj_Proc_Define_Info.obj_vec_Define_Info.push_back(obj_Define_Info);
	}

	delete m_pTiXmlDocument;
	m_pTiXmlDocument = NULL;

	return true;
}
开发者ID:lc412,项目名称:XML2DataBase,代码行数:52,代码来源:XmlOpeation.cpp

示例8: getElementSum

	int getElementSum(TiXmlNode *node, const char * name)
	{
		int ret = 0;
		if (node == NULL || name == NULL) return ret;
		TiXmlNode *keyNode = node->FirstChildElement(name);
		if (keyNode == NULL) return ret;
		while (keyNode != NULL)
		{
			++ret;
			keyNode = keyNode->NextSiblingElement(name);
		}
		return ret;
	}
开发者ID:xiajiaonly,项目名称:XEffect2D,代码行数:13,代码来源:XXml.cpp

示例9: MoveNext

void CXmlSiblingElemIter::MoveNext()
{
	if (m_pCurNode)
	{
		TiXmlNode* pNode = m_pCurNode;
		while ((pNode = pNode->NextSiblingElement()))
		{
			if (pNode->Value() == m_strSiblingName)
			{
				break;
			}
		}
		m_pCurNode = pNode;
	}
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:15,代码来源:CXmlConfig.cpp

示例10: ReadFromXML

bool ParameterSet::ReadFromXML(TiXmlNode &root)
{
	TiXmlNode* paraNode = root.FirstChild("Parameter");
	while (paraNode!=NULL)
	{
		TiXmlElement *elem = paraNode->ToElement();
		if (elem!=NULL)
		{
			const char* att=elem->Attribute("Type");
			if (att!=NULL)
			{
				Parameter* newPara=NULL;
				if (strcmp(att,"Const")==0) newPara = new Parameter();
				else if (strcmp(att,"Linear")==0) newPara = new LinearParameter();
				if (newPara!=NULL)
				{
					if (newPara->ReadFromXML(*elem)==true) this->InsertParameter(newPara);
				}
			}
		}
        paraNode=paraNode->NextSiblingElement("Parameter");
	};
	return true;
}
开发者ID:koendv,项目名称:CSXCAD,代码行数:24,代码来源:ParameterObjects.cpp

示例11: _Parse

bool CStageXMLParse::_Parse(TiXmlDocument& TinyXML)
{
    TiXmlElement* tiRoot = TinyXML.RootElement();
    if (!tiRoot)
    {
        return false;
    }
    std::string sRootName = tiRoot->Value();
    if (sRootName != STAGE_ROOT_GAME)
    {
        return false;
    }

    TiXmlNode* tiFirst = tiRoot->FirstChild(STAGE_GAME);
    if (tiFirst == NULL)
    {
        return false;
    }

    for (TiXmlElement* tiStage = tiFirst->ToElement();
            tiStage != NULL;
            tiStage = tiStage->NextSiblingElement())
    {
        CStageXMLStage* pStage = new CStageXMLStage;
        if (tiStage->Attribute(ID_OBJECT) != NULL)
        {
            pStage->SetId(tiStage->Attribute(ID_OBJECT));
        }
        if (tiStage->Attribute(NAME_OBJECT) != NULL)
        {
            pStage->SetName(tiStage->Attribute(NAME_OBJECT));
        }
        if (tiStage->Attribute(STAGE_MAP_OBJECT) != NULL)
        {
            pStage->SetMap(tiStage->Attribute(STAGE_MAP_OBJECT));
        }
        if (tiStage->Attribute(STAGE_CHAT) != NULL)
        {
            pStage->SetChat(tiStage->Attribute(STAGE_CHAT));
        }
        if (tiStage->Attribute(STAGE_DIFFICULTY_OBJECT) != NULL)
        {
            pStage->SetDifficulty(::atol(tiStage->Attribute(STAGE_DIFFICULTY_OBJECT)));
        }

        if (tiStage->Attribute(TYPE_OBJECT) != NULL)
        {
            pStage->SetType(tiStage->Attribute(TYPE_OBJECT));
        }

        TiXmlNode* tiEnemyItem = tiFirst->FirstChild(ITEM_GAME);
        if (tiEnemyItem != NULL)
        {
            for (TiXmlElement* tiItem = tiEnemyItem->FirstChildElement();
                    tiItem != NULL;
                    tiItem = tiItem->NextSiblingElement())
            {
                CStageXMLItem* pItem = new CStageXMLItem(tiItem->Attribute(ITEM_WAY_OBJECT));
                if (tiItem->Attribute(ID_OBJECT) != NULL)
                {
                    pItem->SetId(tiItem->Attribute(ID_OBJECT));
                }
                if (tiItem->Attribute(TYPE_OBJECT) != NULL)
                {
                    pItem->SetType(tiItem->Attribute(TYPE_OBJECT));
                }
                if (tiItem->Attribute(ITEM_NUMBER_OBJECT) != NULL)
                {
                    pItem->SetNumber(atol(tiItem->Attribute(ITEM_NUMBER_OBJECT)));
                }
                int PosX = 0, PosY = 0;
                if (tiItem->Attribute(POSX_OBJECT) != NULL)
                {
                    PosX = atoi(tiItem->Attribute(POSX_OBJECT));
                }
                if (tiItem->Attribute(POSY_OBJECT) != NULL)
                {
                    PosY = atoi(tiItem->Attribute(POSY_OBJECT));
                }
                pItem->SetPoint(PosX, PosY);
                pStage->PushItem(pItem);
            }
        }

        TiXmlNode* tiEnemy = tiStage->FirstChild(ENEMY_GAME);
        if (tiEnemy == NULL)
        {
            return false;
        }
        for (TiXmlElement* tiElementEnemy = tiEnemy->ToElement();
                tiElementEnemy != NULL;
                tiElementEnemy = tiElementEnemy->NextSiblingElement())
        {
            CStageXMLEnemy* pEnemy = new CStageXMLEnemy;
            if (tiElementEnemy->Attribute(ID_OBJECT) != NULL)
            {
                pEnemy->SetId(tiElementEnemy->Attribute(ID_OBJECT));
            }
            if (tiElementEnemy->Attribute(NAME_OBJECT) != NULL)
            {
//.........这里部分代码省略.........
开发者ID:vnoc-YeZi,项目名称:AV-GSG,代码行数:101,代码来源:StageXMLParser.cpp

示例12: Parse_XML_Test_Assemble

bool CXmlOpeation::Parse_XML_Test_Assemble(const char* pFileName, _Test_Assemble& obj_Test_Assemble)
{
        Close();
        m_pTiXmlDocument = new TiXmlDocument(pFileName);
        if(NULL == m_pTiXmlDocument)
        {
                return false;
        }

        if(false == m_pTiXmlDocument->LoadFile())
        {
                return false;
        }

        TiXmlNode* pMainNode     = NULL;
        TiXmlNode* pSecondNode   = NULL;
        TiXmlNode* pThreeNode    = NULL;
        TiXmlNode* pColumnNode   = NULL;

        //获得根元素
        m_pRootElement = m_pTiXmlDocument->RootElement();

        if(NULL == m_pRootElement)
        {
                return false;
        }

        //获得测试集信息
        sprintf_safe(obj_Test_Assemble.m_szTestAssembleName, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("Name"));
        sprintf_safe(obj_Test_Assemble.m_szDesc, MAX_BUFF_100, "%s", (char* )m_pRootElement->Attribute("desc"));
        sprintf_safe(obj_Test_Assemble.m_szIP, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("IP"));
        sprintf_safe(obj_Test_Assemble.m_szOrder, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("ORDER"));
        obj_Test_Assemble.m_nPort = atoi((char* )m_pRootElement->Attribute("Port"));

        //循环获取预定义信息
        for(pMainNode = m_pRootElement->FirstChildElement();pMainNode;pMainNode = pMainNode->NextSiblingElement())
        {
                _Command_Info obj_Command_Info;

                int nMainType = pMainNode->Type();

                if(nMainType != TiXmlText::TINYXML_ELEMENT)
                {
                        continue;
                }

                TiXmlElement* pMainElement = pMainNode->ToElement();
                sprintf_safe(obj_Command_Info.m_szCommandName, MAX_BUFF_50, "%s", (char* )pMainElement->Attribute("CommandName"));
                obj_Command_Info.m_nCount    = atoi((char* )pMainElement->Attribute("Count"));
                obj_Command_Info.m_nTimeCost = atoi((char* )pMainElement->Attribute("TimeCost"));
                if(pMainElement->Attribute("ThreadCount") != NULL)
                {
                        obj_Command_Info.m_nThreadCount = atoi((char* )pMainElement->Attribute("ThreadCount"));
                }

                for(pSecondNode = pMainElement->FirstChildElement();pSecondNode;pSecondNode = pSecondNode->NextSiblingElement())
                {
                        int nMainType = pMainNode->Type();

                        if(nMainType != TiXmlText::TINYXML_ELEMENT)
                        {
                                continue;
                        }

                        TiXmlElement* pSecondElement = pSecondNode->ToElement();
                        if(strcmp("Packet_Send", pSecondElement->Value()) == 0)
                        {
                                //获得所有元素信息
                                for(pThreeNode = pSecondElement->FirstChildElement();pThreeNode;pThreeNode = pThreeNode->NextSiblingElement())
                                {
                                        TiXmlElement* pThreeElement = pThreeNode->ToElement();
                                        _Data_Info obj_Data_Info;
                                        sprintf_safe(obj_Data_Info.m_szDataType, MAX_BUFF_50, "%s", (char* )pThreeElement->Value());
                                        sprintf_safe(obj_Data_Info.m_szDataName, MAX_BUFF_50, "%s", (char* )pThreeElement->Attribute("name"));
                                        if(NULL != pThreeElement->Attribute("length"))
                                        {
                                                obj_Data_Info.m_nLength =  atoi((char* )pThreeElement->Attribute("length"));
                                        }
                                        if(NULL != pThreeElement->Attribute("IsString"))
                                        {
                                                if(strcmp("1", pThreeElement->Attribute("IsString")) == 0)
                                                {
                                                        obj_Data_Info.m_blIsString = true;
                                                }
                                                else
                                                {
                                                        obj_Data_Info.m_blIsString = false;
                                                }
                                        }
                                        if(NULL != (char* )pThreeElement->GetText())
                                        {
                                                obj_Data_Info.m_strValue = (string)pThreeElement->GetText();
                                        }
                                        obj_Command_Info.m_obj_Packet_Send.m_obj_Data_Info_List.push_back(obj_Data_Info);
                                }
                        }
                        else if(strcmp("Packet_Recv", pSecondElement->Value()) == 0)
                        {
                                //获得所有元素信息
                                for(pThreeNode = pSecondElement->FirstChildElement();pThreeNode;pThreeNode = pThreeNode->NextSiblingElement())
//.........这里部分代码省略.........
开发者ID:freeeyes,项目名称:PSS,代码行数:101,代码来源:XmlOpeation.cpp

示例13: Load


//.........这里部分代码省略.........
    m_pathSubstitutions.clear();
    CLog::Log(LOGDEBUG,"Configuring path substitutions");
    TiXmlNode* pSubstitute = pPathSubstitution->FirstChildElement("substitute");
    while (pSubstitute)
    {
      CStdString strFrom, strTo;
      TiXmlNode* pFrom = pSubstitute->FirstChild("from");
      if (pFrom)
        strFrom = pFrom->FirstChild()->Value();
      TiXmlNode* pTo = pSubstitute->FirstChild("to");
      if (pTo)
        strTo = pTo->FirstChild()->Value();

      if (!strFrom.IsEmpty() && !strTo.IsEmpty())
      {
        CLog::Log(LOGDEBUG,"  Registering substition pair:");
        CLog::Log(LOGDEBUG,"    From: [%s]", strFrom.c_str());
        CLog::Log(LOGDEBUG,"    To:   [%s]", strTo.c_str());
        // keep literal commas since we use comma as a seperator
        strFrom.Replace(",",",,");
        strTo.Replace(",",",,");
        m_pathSubstitutions.push_back(strFrom + " , " + strTo);
      }
      else
      {
        // error message about missing tag
        if (strFrom.IsEmpty())
          CLog::Log(LOGERROR,"  Missing <from> tag");
        else
          CLog::Log(LOGERROR,"  Missing <to> tag");
      }

      // get next one
      pSubstitute = pSubstitute->NextSiblingElement("substitute");
    }
  }

  XMLUtils::GetInt(pRootElement, "remoterepeat", m_remoteRepeat, 1, INT_MAX);
  XMLUtils::GetFloat(pRootElement, "controllerdeadzone", m_controllerDeadzone, 0.0f, 1.0f);
  XMLUtils::GetInt(pRootElement, "thumbsize", m_thumbSize, 0, 1024);
  XMLUtils::GetInt(pRootElement, "fanartheight", m_fanartHeight, 0, 1080);
  //dds support
  XMLUtils::GetBoolean(pRootElement, "useddsfanart", m_useddsfanart);


  XMLUtils::GetBoolean(pRootElement, "playlistasfolders", m_playlistAsFolders);
  XMLUtils::GetBoolean(pRootElement, "detectasudf", m_detectAsUdf);

  // music thumbs
  CStdString extraThumbs;
  TiXmlElement* pThumbs = pRootElement->FirstChildElement("musicthumbs");
  if (pThumbs)
  {
    // remove before add so that the defaults can be restored after user defined ones
    // (ie, the list can be:cover.jpg|cover.png|folder.jpg)
    CSettings::GetString(pThumbs, "remove", extraThumbs, "");
    if (extraThumbs != "")
    {
      CStdStringArray thumbs;
      StringUtils::SplitString(extraThumbs, "|", thumbs);
      for (unsigned int i = 0; i < thumbs.size(); ++i)
      {
        int iPos = m_musicThumbs.Find(thumbs[i]);
        if (iPos == -1)
          continue;
        m_musicThumbs.erase(iPos, thumbs[i].size() + 1);
开发者ID:Rocky5,项目名称:XBMC4Kids,代码行数:67,代码来源:AdvancedSettings.cpp

示例14: Load


//.........这里部分代码省略.........
    m_pathSubstitutions.clear();
    CLog::Log(LOGDEBUG,"Configuring path substitutions");
    TiXmlNode* pSubstitute = pPathSubstitution->FirstChildElement("substitute");
    while (pSubstitute)
    {
      CStdString strFrom, strTo;
      TiXmlNode* pFrom = pSubstitute->FirstChild("from");
      if (pFrom)
        strFrom = pFrom->FirstChild()->Value();
      TiXmlNode* pTo = pSubstitute->FirstChild("to");
      if (pTo)
        strTo = pTo->FirstChild()->Value();

      if (!strFrom.IsEmpty() && !strTo.IsEmpty())
      {
        CLog::Log(LOGDEBUG,"  Registering substition pair:");
        CLog::Log(LOGDEBUG,"    From: [%s]", strFrom.c_str());
        CLog::Log(LOGDEBUG,"    To:   [%s]", strTo.c_str());
        // keep literal commas since we use comma as a seperator
        strFrom.Replace(",",",,");
        strTo.Replace(",",",,");
        m_pathSubstitutions.push_back(strFrom + " , " + strTo);
      }
      else
      {
        // error message about missing tag
        if (strFrom.IsEmpty())
          CLog::Log(LOGERROR,"  Missing <from> tag");
        else
          CLog::Log(LOGERROR,"  Missing <to> tag");
      }

      // get next one
      pSubstitute = pSubstitute->NextSiblingElement("substitute");
    }
  }

  XMLUtils::GetInt(pRootElement, "remotedelay", m_remoteDelay, 1, 20);
  XMLUtils::GetFloat(pRootElement, "controllerdeadzone", m_controllerDeadzone, 0.0f, 1.0f);
  XMLUtils::GetInt(pRootElement, "thumbsize", m_thumbSize, 64, 1024);
  XMLUtils::GetBoolean(pRootElement, "useddsfanart", m_useDDSFanart);

  XMLUtils::GetBoolean(pRootElement, "playlistasfolders", m_playlistAsFolders);
  XMLUtils::GetBoolean(pRootElement, "detectasudf", m_detectAsUdf);

  // music thumbs
  CStdString extraThumbs;
  TiXmlElement* pThumbs = pRootElement->FirstChildElement("musicthumbs");
  if (pThumbs)
    GetCustomExtensions(pThumbs,m_musicThumbs);

  // dvd thumbs
  pThumbs = pRootElement->FirstChildElement("dvdthumbs");
  if (pThumbs)
    GetCustomExtensions(pThumbs,m_dvdThumbs);

  // movie fanarts
  TiXmlElement* pFanart = pRootElement->FirstChildElement("fanart");
  if (pFanart)
    GetCustomExtensions(pFanart,m_fanartImages);

  // music filename->tag filters
  TiXmlElement* filters = pRootElement->FirstChildElement("musicfilenamefilters");
  if (filters)
  {
    TiXmlNode* filter = filters->FirstChild("filter");
开发者ID:Kr0nZ,项目名称:boxee,代码行数:67,代码来源:AdvancedSettings.cpp

示例15: Parse_Class_File

bool CXmlOpeation::Parse_Class_File(const char* pFileName, vecClassInfo& objvecClassInfo)
{
	Close();
	m_pTiXmlDocument = new TiXmlDocument(pFileName);
	if(NULL == m_pTiXmlDocument)
	{
		return false;
	}

	if(false == m_pTiXmlDocument->LoadFile())
	{
		Close();
		return false;
	}

	TiXmlNode* pMainNode = NULL;
	//获得根元素
	m_pRootElement = m_pTiXmlDocument->RootElement();

	//循环打印出每一个变量
	if(NULL == m_pRootElement)
	{
		return false;
	}

	//获得根元素的子元素
	for(pMainNode = m_pRootElement->FirstChildElement();pMainNode;pMainNode=pMainNode->NextSiblingElement())
	{
		_Class_Info objClassInfo;

		int nMainType = pMainNode->Type();

		if(nMainType != TiXmlText::TINYXML_ELEMENT)
		{
			continue;
		}

		TiXmlElement* pMainElement = pMainNode->ToElement();

		//获得元素的名称
		sprintf_safe(objClassInfo.m_szXMLName, 60, pMainElement->Value());
		sprintf_safe(objClassInfo.m_szDesc, 100, "%s", pMainElement->Attribute("desc"));

		//printf("Root=%s.\n", m_pRootElement->Value());

		TiXmlNode* pNode = NULL;

		for(pNode = pMainElement->FirstChildElement();pNode;pNode=pNode->NextSiblingElement())
		{
			int nType = pNode->Type();
			if(nType == TiXmlText::TINYXML_ELEMENT)
			{
				//printf("Name=%s,Values=%s.\n", pNode->Value(), pNode->ToElement()->GetText());
				_Property objProperty;
				sprintf_safe(objProperty.m_szPropertyName, 50, "%s", pNode->Value());
				if(strcmp(pNode->ToElement()->GetText(), "char") == 0)
				{
					objProperty.m_emType = PROPERTY_CHAR;

					//同时获得字符串最大长度
					char* pLength = (char* )pNode->ToElement()->Attribute("length");
					if(NULL != pLength)
					{
						objProperty.m_nLength = (int)atoi(pLength);
					}

					//获得Stream的指定长度
					char* pStreamLength = (char* )pNode->ToElement()->Attribute("StreamLength");
					if(NULL != pStreamLength)
					{
						sprintf_safe(objProperty.m_szStreamLength, 10, "%s", pStreamLength);
					}
				}
				else if(strcmp(pNode->ToElement()->GetText(), "string") == 0)
				{
					objProperty.m_emType = PROPERTY_STRING;
				}
				else if(strcmp(pNode->ToElement()->GetText(), "uint8") == 0)
				{
					objProperty.m_emType = PROPERTY_UINT8;
				}
				else if(strcmp(pNode->ToElement()->GetText(), "uint16") == 0)
				{
					objProperty.m_emType = PROPERTY_UINT16;
				}
				else if(strcmp(pNode->ToElement()->GetText(), "uint32") == 0)
				{
					objProperty.m_emType = PROPERTY_UINT32;
				}
				else if(strcmp(pNode->ToElement()->GetText(), "uint64") == 0)
				{
					objProperty.m_emType = PROPERTY_UINT64;
				}
				else if(strcmp(pNode->ToElement()->GetText(), "int8") == 0)
				{
					objProperty.m_emType = PROPERTY_INT8;
				}
				else if(strcmp(pNode->ToElement()->GetText(), "int16") == 0)
				{
					objProperty.m_emType = PROPERTY_INT16;
//.........这里部分代码省略.........
开发者ID:freeeyes,项目名称:PSS,代码行数:101,代码来源:XmlOpeation.cpp


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