• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TiXmlComment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: TiXmlDocument

bool cSubMenu::SaveXml(char *fname )
{

    if (_fname)
    {
        TiXmlDocument xml = TiXmlDocument(fname );
        TiXmlComment  comment;
        comment.SetValue(
            " Mini-VDR cSetupConfiguration File\n"
            " (c) Ralf Dotzert\n"
            "\n\n"
            " for Example see vdr-menu.xml.example\n\n"
        );

        TiXmlElement root("menus");
        root.SetAttribute("suffix",   _menuSuffix);
        for (cSubMenuNode *node = _menuTree.First(); node; node = _menuTree.Next(node))
            node->SaveXml(&root);

        if (xml.InsertEndChild(comment) != NULL &&
                xml.InsertEndChild(root) != NULL)
        {
            return xml.SaveFile(fname);
        }
    }
    else
    {
        return false;
    }

    return true;
}
开发者ID:signal2noise,项目名称:vdr-mirror,代码行数:32,代码来源:submenu.c


示例2: TiXmlDeclaration

void kore::ProjectLoader::saveProject(const std::string& path) const {
  ResourceManager* ResMgr = ResourceManager::getInstance();

  TiXmlDocument doc;
  TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", "yes");
  doc.LinkEndChild(decl);

  TiXmlComment * comment = new TiXmlComment();
  time_t rawtime;
  time(&rawtime);
  comment->SetValue(ctime(&rawtime));
  doc.LinkEndChild(comment);

  // Resources
  TiXmlElement* resources = new TiXmlElement("Resources");
  doc.LinkEndChild(resources);

  // Textures
  TiXmlElement* texture;
  std::map<std::string, TexturePtr>::iterator texIt;
  for(texIt = ResMgr->_textures.begin();
      texIt != ResMgr->_textures.end();
      texIt++) {
    texture = new TiXmlElement("Texture");
    STextureProperties prop = texIt->second->getProperties();
    texture->SetAttribute("name", texIt->second->getName().c_str());
    texture->SetAttribute("width", prop.width);
    texture->SetAttribute("height", prop.height);
    resources->LinkEndChild(texture);
  }

  // TODO(dospelt) the rest

  TiXmlElement* scene = new TiXmlElement("Scene");
  doc.LinkEndChild(scene);
  kore::SceneNodePtr root = kore::SceneManager::getInstance()->getRootNode();

  //saveSceneNode(scene, root);

  

  // finally, save to file
  if(doc.SaveFile(path.c_str())) {
    kore::Log::getInstance()->write("[DEBUG] writing file '%s'\n",
                                    path.c_str());
  } else {
    kore::Log::getInstance()->write("[ERROR] could not write file '%s'\n",
                                    path.c_str());
  }

  // TODO(dospelt) runtime error when deleting created pointers.
  // it seems they get automatically deleted when saving File -> tinyxmlDoku?

  // delete resources;
  // delete comment;
}
开发者ID:duglah,项目名称:KoRE,代码行数:56,代码来源:ProjectLoader.cpp


示例3: TiXmlDeclaration

/* Method save_xml */
void ClusterSettings::save_xml (const Glib::ustring& filename)
{
  /* Create xml document */
  TiXmlDocument doc;

  /* XML Declaration */
  TiXmlDeclaration *decl = new TiXmlDeclaration ("0.0", "", "");
  doc.LinkEndChild (decl);

  /* Root element */
  TiXmlElement *root = new TiXmlElement ("SensorsClusterSettings");
  doc.LinkEndChild (root);

  /* Comment */
  Glib::ustring message;
  message.assign (" File created by ComLibSim at [");
  message.append (filename);
  message.append ("] ");
  TiXmlComment *comment = new TiXmlComment ();
  comment->SetValue (message.c_str ());
  root->LinkEndChild (comment);

  /* Cluster element */
  TiXmlElement *cluster = new TiXmlElement ("Cluster");
  root->LinkEndChild (cluster);

  /* Set cluster attribute */
  cluster->SetAttribute ("name", m_Name.c_str ());

  /* Sensors element */
  TiXmlElement *sensorsNode = new TiXmlElement ("Sensors");
  root->LinkEndChild (sensorsNode);

  /* Set sensor element and attributes */
  std::list<SensorSettings>::iterator iter;
  for (iter=m_Sensors.begin (); iter != m_Sensors.end (); iter++)
  {
    const SensorSettings& sensor_iter = *iter;

    /* Sensor element */
    TiXmlElement *sensor = new TiXmlElement ("Sensor");
    sensorsNode->LinkEndChild (sensor);

    /* Set sensor attributes */
    sensor->SetAttribute ("tag", iter->get_tag ().c_str ());
    sensor->SetAttribute ("online", iter->get_online ());
    sensor->SetDoubleAttribute ("x", iter->get_x_coord ());
    sensor->SetDoubleAttribute ("y", iter->get_y_coord ());
    sensor->SetAttribute ("adata", iter->get_amount_data ());
    sensor->SetAttribute ("type", iter->get_type ().c_str ());
  }

  /* Save xml to file */
  doc.SaveFile (filename.c_str ());
}
开发者ID:moyeah,项目名称:comlibsim_gui,代码行数:56,代码来源:clustersettings_old.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: assert

BOOL __stdcall DefaultLaserPen::save(LPCTSTR lpszFileName)
{
    assert( lpszFileName);
    FILE* stream = _tfopen(lpszFileName, _T("wb"));
    if (NULL == stream)
        return FALSE;	

	//tinyxml lib
	TiXmlDocument doc;
	TiXmlDeclaration* pDecl = new TiXmlDeclaration("1.0", "euc-kr", "");  
	doc.LinkEndChild(pDecl);

	TiXmlElement* pRoot = new TiXmlElement("laserpen");
	pRoot->SetAttribute("version", DA0LIB_VERSION);
	pRoot->SetAttribute("count", this->size() );
	doc.LinkEndChild(pRoot);

	TiXmlComment * pComment = new TiXmlComment();
	pComment->SetValue("2014 copyright to KOSES. all rights reserved. created by da0lib." );  
	pRoot->LinkEndChild( pComment );  

	CONTAINER_IT it = _pPimpl->container.begin();
	for (; it != _pPimpl->container.end(); it++)
    {
		LASERPEN* pPen = it->second;
		assert(pPen);

		TiXmlElement* p = new TiXmlElement("pen");
		p->SetAttribute("id", pPen->penid);
		p->SetAttribute("frequency", pPen->frequency);		
		p->SetDoubleAttribute("pulsewidth", pPen->pulsewidth);
		p->SetDoubleAttribute("output", pPen->output);

		p->SetDoubleAttribute("speedmark" , pPen->speedmark);
		p->SetDoubleAttribute("speedjump" , pPen->speedjump);
		p->SetDoubleAttribute("delayoff" , pPen->delayoff);
		p->SetDoubleAttribute("delayon" , pPen->delayon);

		p->SetDoubleAttribute("delayjump" , pPen->delayjump);
		p->SetDoubleAttribute("delaymark" , pPen->delaymark);		
		p->SetDoubleAttribute("delaypolygon" , pPen->delaypolygon);

		p->SetAttribute("wobbelfrequency" , pPen->wobbelfrequency);
		p->SetDoubleAttribute("wobbelamplitude" , pPen->wobbelamplitude);

		pRoot->LinkEndChild(p);
    }
	
	doc.SaveFile(stream);
    fclose( stream );
    return TRUE;
}
开发者ID:japgo,项目名称:mygithub,代码行数:52,代码来源:da0defaultlaserpen.cpp


示例6: TiXmlDeclaration

/*
 * Generates setting placeholders for any missing sections
 * ** Plugins should verify that their settings exist and
 * ** create new placeholders if they do not exist!
 */
void Configuration::generateConfig()
{
	TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", "");
	configs.LinkEndChild(decl);

	TiXmlElement* root = new TiXmlElement("osdb");
	configs.LinkEndChild(root);

	TiXmlComment* comment = new TiXmlComment();
	comment->SetValue(" Settings for OSDB ");
	root->LinkEndChild(comment);

	setConfigSetting("main", "logFilePath", "osdb.log");
	setConfigSetting("main", "useStdOut", "true");
}
开发者ID:ButtaKnife,项目名称:osdb,代码行数:20,代码来源:Configuration.cpp


示例7: Visit

bool TiXmlPrinter::Visit( const TiXmlComment& comment )
{
	DoIndent();
	buffer += "<!--";
	buffer += comment.Value();
	buffer += "-->";
	DoLineBreak();
	return true;
}
开发者ID:Joooo,项目名称:pseudoform,代码行数:9,代码来源:tinyxml.cpp


示例8: addComment

void SimXMLDocument::addComment(const char* comment)
{
   TiXmlComment cComment;
   cComment.SetValue(comment);

   if(m_paNode.empty()) 
   {
       Con::warnf("Cannot add comment without any elements: '%s'", comment);
       return;
   }

    const int iFinalElement = m_paNode.size() - 1;
    TiXmlElement* pNode = m_paNode[iFinalElement];
    if(!pNode)
    {
        return;
    }
    pNode->InsertEndChild( cComment );
}
开发者ID:greenfire27,项目名称:Torque2D,代码行数:19,代码来源:SimXMLDocument.cpp


示例9: main


//.........这里部分代码省略.........
	}
	
	{
		const char* str =	"\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n"
							"  <!-- Silly example -->\n"
							"    <door wall='north'>A great door!</door>\n"
							"\t<door wall='east'/>"
							"</room>";

		TiXmlDocument doc;
		doc.Parse( str );

		TiXmlHandle docHandle( &doc );
		TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" );
		TiXmlHandle commentHandle = docHandle.FirstChildElement( "room" ).FirstChild();
		TiXmlHandle textHandle = docHandle.FirstChildElement( "room" ).ChildElement( "door", 0 ).FirstChild();
		TiXmlHandle door0Handle = docHandle.FirstChildElement( "room" ).ChildElement( 0 );
		TiXmlHandle door1Handle = docHandle.FirstChildElement( "room" ).ChildElement( 1 );

		assert( docHandle.Node() );
		assert( roomHandle.Element() );
		assert( commentHandle.Node() );
		assert( textHandle.Text() );
		assert( door0Handle.Element() );
		assert( door1Handle.Element() );

		TiXmlDeclaration* declaration = doc.FirstChild()->ToDeclaration();
		assert( declaration );
		TiXmlElement* room = roomHandle.Element();
		assert( room );
		TiXmlAttribute* doors = room->FirstAttribute();
		assert( doors );
		TiXmlText* text = textHandle.Text();
		TiXmlComment* comment = commentHandle.Node()->ToComment();
		assert( comment );
		TiXmlElement* door0 = door0Handle.Element();
		TiXmlElement* door1 = door1Handle.Element();

		XmlTest( "Location tracking: Declaration row", declaration->Row(), 1 );
		XmlTest( "Location tracking: Declaration col", declaration->Column(), 5 );
		XmlTest( "Location tracking: room row", room->Row(), 1 );
		XmlTest( "Location tracking: room col", room->Column(), 45 );
		XmlTest( "Location tracking: doors row", doors->Row(), 1 );
		XmlTest( "Location tracking: doors col", doors->Column(), 51 );
		XmlTest( "Location tracking: Comment row", comment->Row(), 2 );
		XmlTest( "Location tracking: Comment col", comment->Column(), 3 );
		XmlTest( "Location tracking: text row", text->Row(), 3 ); 
		XmlTest( "Location tracking: text col", text->Column(), 24 );
		XmlTest( "Location tracking: door0 row", door0->Row(), 3 );
		XmlTest( "Location tracking: door0 col", door0->Column(), 5 );
		XmlTest( "Location tracking: door1 row", door1->Row(), 4 );
		XmlTest( "Location tracking: door1 col", door1->Column(), 5 );
	}


	// --------------------------------------------------------
	// UTF-8 testing. It is important to test:
	//	1. Making sure name, value, and text read correctly
	//	2. Row, Col functionality
	//	3. Correct output
	// --------------------------------------------------------
	printf ("\n** UTF-8 **\n");
	{
		TiXmlDocument doc( "utf8test.xml" );
		doc.LoadFile();
		if ( doc.Error() && doc.ErrorId() == TiXmlBase::TIXML_ERROR_OPENING_FILE ) {
开发者ID:huntriver,项目名称:TankVSBugs-CSE380-,代码行数:67,代码来源:xmltest.cpp


示例10: TiXmlDeclaration

void COptions::WriteXMLData()
{
    // Create document
    TiXmlDocument newConfig;
    TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "UTF-8", "" );
    newConfig.LinkEndChild( decl );

    // Root node
    TiXmlElement * root = new TiXmlElement( "Bombermaaan" );
    newConfig.LinkEndChild( root );

    // Comment
    TiXmlComment * comment = new TiXmlComment();
    comment->SetValue(" Configuration settings for the Bombermaaan game (http://bombermaaan.sf.net/) " );
    root->LinkEndChild( comment );

    // Configuration tree node - all options have this node as parent
    TiXmlElement * config = new TiXmlElement( "Configuration" );
    root->LinkEndChild( config );

    //! The revision number is currently 1
    TiXmlElement* configRev = new TiXmlElement( "ConfigRevision" );
    configRev->SetAttribute( "value", 1 );
    config->LinkEndChild( configRev );

    // TimeUp (when will arena close begin)
    TiXmlElement* configTimeUp = new TiXmlElement( "TimeUp" );
    configTimeUp->SetAttribute( "minutes", m_TimeUpMinutes );
    configTimeUp->SetAttribute( "seconds", m_TimeUpSeconds );
    config->LinkEndChild( configTimeUp );

    // TimeStart (the duration of a match)
    TiXmlElement* configTimeStart = new TiXmlElement( "TimeStart" );
    configTimeStart->SetAttribute( "minutes", m_TimeStartMinutes );
    configTimeStart->SetAttribute( "seconds", m_TimeStartSeconds );
    config->LinkEndChild( configTimeStart );

    // BattleMode
    TiXmlElement* configBattleMode = new TiXmlElement("BattleMode");
    configBattleMode->SetAttribute("value", m_BattleMode);
    config->LinkEndChild(configBattleMode);

    // BattleCount
    TiXmlElement* configBattleCount = new TiXmlElement( "BattleCount" );
    configBattleCount->SetAttribute( "value", m_BattleCount );
    config->LinkEndChild( configBattleCount );

    // LevelFileNumber
    TiXmlElement* configLevel = new TiXmlElement( "LevelFileNumber" );
    configLevel->SetAttribute( "value", m_Level );
    config->LinkEndChild( configLevel );

    // DisplayMode
    TiXmlElement* configDisplayMode = new TiXmlElement( "DisplayMode" );
    configDisplayMode->SetAttribute( "value", (int) m_DisplayMode );
    config->LinkEndChild( configDisplayMode );

    int i;

    // BomberTypes
    TiXmlElement* configBomberTypes = new TiXmlElement( "BomberTypes" );
    for ( i = 0; i < MAX_PLAYERS; i++ ) {
        std::ostringstream oss;
        oss << "bomber" << i;
        std::string attributeName = oss.str();
        configBomberTypes->SetAttribute( attributeName, (int) m_BomberType[i] );
    }
    config->LinkEndChild( configBomberTypes );

    // BomberTeams
    TiXmlElement* configBomberTeams = new TiXmlElement("BomberTeams");
    for (i = 0; i < MAX_PLAYERS; i++) {
        std::ostringstream oss;
        oss << "bomber" << i;
        std::string attributeName = oss.str();
        configBomberTeams->SetAttribute(attributeName, (int)m_BomberTeam[i]);
    }
    config->LinkEndChild(configBomberTeams);

    // PlayerInputs
    TiXmlElement* configPlayerInputs = new TiXmlElement( "PlayerInputs" );
    for ( i = 0; i < MAX_PLAYERS; i++ ) {
        std::ostringstream oss;
        oss << "bomber" << i;
        std::string attributeName = oss.str();
        configPlayerInputs->SetAttribute( attributeName, (int) m_PlayerInput[i] );
    }
    config->LinkEndChild( configPlayerInputs );

    // ControlList
    TiXmlElement* configControlList = new TiXmlElement( "ControlList" );
    for ( unsigned int j = 0; j < MAX_PLAYER_INPUT; j++ )
    {
        TiXmlElement* configControl = new TiXmlElement( "Control" );
        configControl->SetAttribute( "id", j );
        for ( unsigned int ctrl = 0; ctrl < NUM_CONTROLS; ctrl++ )
        {
            std::ostringstream oss;
            oss << "control" << ctrl;
            std::string attributeName = oss.str();
//.........这里部分代码省略.........
开发者ID:aprams,项目名称:Bombermaaan,代码行数:101,代码来源:COptions.cpp


示例11: TiXmlDocument

void CfgMgrBldr::SwitchTo(const wxString& fileName)
{
    doc = new TiXmlDocument();

    if (!TinyXML::LoadDocument(fileName, doc))
    {
        doc->InsertEndChild(TiXmlDeclaration("1.0", "UTF-8", "yes"));
        doc->InsertEndChild(TiXmlElement("CodeBlocksConfig"));
        doc->FirstChildElement("CodeBlocksConfig")->SetAttribute("version", CfgMgrConsts::version);
    }

    if (doc->ErrorId())
        cbThrow(wxString::Format(_T("TinyXML error: %s\nIn file: %s\nAt row %d, column: %d."), cbC2U(doc->ErrorDesc()).c_str(), fileName.c_str(), doc->ErrorRow(), doc->ErrorCol()));

    TiXmlElement* docroot = doc->FirstChildElement("CodeBlocksConfig");

    if (doc->ErrorId())
        cbThrow(wxString::Format(_T("TinyXML error: %s\nIn file: %s\nAt row %d, column: %d."), cbC2U(doc->ErrorDesc()).c_str(), fileName.c_str(), doc->ErrorRow(), doc->ErrorCol()));

    const char *vers = docroot->Attribute("version");
    if (!vers || atoi(vers) != 1)
        cbMessageBox(_("ConfigManager encountered an unknown config file version. Continuing happily."), _("Warning"), wxICON_WARNING);

    doc->ClearError();

    wxString info;
#ifndef __GNUC__
    info.Printf(_T( " application info:\n"
                    "\t svn_revision:\t%u\n"
                    "\t build_date:\t%s, %s "), ConfigManager::GetRevisionNumber(), wxT(__DATE__), wxT(__TIME__));
#else
    info.Printf(_T( " application info:\n"
                    "\t svn_revision:\t%u\n"
                    "\t build_date:\t%s, %s\n"
                    "\t gcc_version:\t%d.%d.%d "), ConfigManager::GetRevisionNumber(), wxT(__DATE__), wxT(__TIME__),
                __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif

    if (platform::windows)
        info.append(_T("\n\t Windows "));
    if (platform::linux)
        info.append(_T("\n\t Linux "));
    if (platform::macosx)
        info.append(_T("\n\t Mac OS X "));
    if (platform::unix)
        info.append(_T("\n\t Unix "));

    info.append(platform::unicode ? _T("Unicode ") : _T("ANSI "));

    TiXmlComment c;
    c.SetValue((const char*) info.mb_str());

    TiXmlNode *firstchild = docroot->FirstChild();
    if (firstchild && firstchild->ToComment())
    {
        docroot->RemoveChild(firstchild);
        firstchild = docroot->FirstChild();
    }

    if (firstchild)
        docroot->InsertBeforeChild(firstchild, c);
    else
        docroot->InsertEndChild(c);
}
开发者ID:alpha0010,项目名称:codeblocks_sf,代码行数:64,代码来源:configmanager.cpp


示例12: TiXmlDeclaration

void input::saveKeys()
{
//	printf("saving control file\n");

	TiXmlDocument doc;
	TiXmlElement* msg;
	TiXmlDeclaration * decl = new TiXmlDeclaration("1.0", "", "");
	doc.LinkEndChild(decl );

	TiXmlElement * root = new TiXmlElement("controls");
	doc.LinkEndChild(root );

	TiXmlComment * comment = new TiXmlComment();
	comment->SetValue("Keyboard mappings");
	root->LinkEndChild(comment );

	TiXmlElement * msgs = new TiXmlElement("keys");
	root->LinkEndChild(msgs );

	msg = new TiXmlElement("accept");
	msg->SetAttribute("value", input::keys[KEY_ACCEPT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("accept_d1");
	msg->SetAttribute("value", input::keys[KEY_DBG_ACCEPT1]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("accept_d2");
	msg->SetAttribute("value", input::keys[KEY_DBG_ACCEPT2]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("cancel");
	msg->SetAttribute("value", input::keys[KEY_CANCEL]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("up");
	msg->SetAttribute("value", input::keys[KEY_UP]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("up_d");
	msg->SetAttribute("value", input::keys[KEY_DBG_UP]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("down");
	msg->SetAttribute("value", input::keys[KEY_DOWN]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("down_d");
	msg->SetAttribute("value", input::keys[KEY_DBG_DOWN]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("left");
	msg->SetAttribute("value", input::keys[KEY_LEFT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("left_d");
	msg->SetAttribute("value", input::keys[KEY_DBG_LEFT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("right");
	msg->SetAttribute("value", input::keys[KEY_RIGHT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("right_d");
	msg->SetAttribute("value", input::keys[KEY_DBG_RIGHT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("upleft");
	msg->SetAttribute("value", input::keys[KEY_UPLEFT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("upright");
	msg->SetAttribute("value", input::keys[KEY_UPRIGHT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("downleft");
	msg->SetAttribute("value", input::keys[KEY_DOWNLEFT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("downright");
	msg->SetAttribute("value", input::keys[KEY_DOWNRIGHT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("attack");
	msg->SetAttribute("value", input::keys[KEY_ATTACK]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("spells");
	msg->SetAttribute("value", input::keys[KEY_SPELLS]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("inventory");
	msg->SetAttribute("value", input::keys[KEY_INVENTORY]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("interact");
	msg->SetAttribute("value", input::keys[KEY_INTERACT]->binding);
	msgs->LinkEndChild(msg);

	msg = new TiXmlElement("search");
//.........这里部分代码省略.........
开发者ID:zurn,项目名称:Zakes,代码行数:101,代码来源:input.cpp


示例13: main


//.........这里部分代码省略.........

	}
	{
		const char* str =	"\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n"
							"  <!-- Silly example -->\n"
							"    <door wall='north'>A great door!</door>\n"
							"\t<door wall='east'/>"
							"</room>";

        TiXmlDocument doc;
		doc.Parse( str );

		TiXmlHandle docHandle( &doc );
		TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" );
		TiXmlHandle commentHandle = docHandle.FirstChildElement( "room" ).FirstChild();
		TiXmlHandle textHandle = docHandle.FirstChildElement( "room" ).ChildElement( "door", 0 ).FirstChild();
		TiXmlHandle door0Handle = docHandle.FirstChildElement( "room" ).ChildElement( 0 );
		TiXmlHandle door1Handle = docHandle.FirstChildElement( "room" ).ChildElement( 1 );

		assert( docHandle.Node() );
		assert( roomHandle.Element() );
		assert( commentHandle.Node() );
		assert( textHandle.Text() );
		assert( door0Handle.Element() );
		assert( door1Handle.Element() );

		TiXmlDeclaration* declaration = doc.FirstChild()->ToDeclaration();
		assert( declaration );
		TiXmlElement* room = roomHandle.Element();
		assert( room );
		TiXmlAttribute* doors = room->FirstAttribute();
		assert( doors );
		TiXmlText* text = textHandle.Text();
		TiXmlComment* comment = commentHandle.Node()->ToComment();
		assert( comment );
		TiXmlElement* door0 = door0Handle.Element();
		TiXmlElement* door1 = door1Handle.Element();

		XmlTest( "Location tracking: Declaration row", declaration->Row(), 1 );
		XmlTest( "Location tracking: Declaration col", declaration->Column(), 5 );
		XmlTest( "Location tracking: room row", room->Row(), 1 );
		XmlTest( "Location tracking: room col", room->Column(), 45 );
		XmlTest( "Location tracking: doors row", doors->Row(), 1 );
		XmlTest( "Location tracking: doors col", doors->Column(), 51 );
		XmlTest( "Location tracking: Comment row", comment->Row(), 2 );
		XmlTest( "Location tracking: Comment col", comment->Column(), 3 );
		XmlTest( "Location tracking: text row", text->Row(), 3 ); 
		XmlTest( "Location tracking: text col", text->Column(), 24 );
		XmlTest( "Location tracking: door0 row", door0->Row(), 3 );
		XmlTest( "Location tracking: door0 col", door0->Column(), 5 );
		XmlTest( "Location tracking: door1 row", door1->Row(), 4 );
		XmlTest( "Location tracking: door1 col", door1->Column(), 5 );
	}
	{
		const char* str =	"\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n"
							"</room>";

        TiXmlDocument doc;
		doc.SetTabSize( 8 );
		doc.Parse( str );

		TiXmlHandle docHandle( &doc );
		TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" );

		assert( docHandle.Node() );
		assert( roomHandle.Element() );
开发者ID:bsmr-worldforge,项目名称:libwfut,代码行数:67,代码来源:xmltest.cpp


示例14: main


//.........这里部分代码省略.........
          //printf( "error=%d id='%s' row %d col%d\n", (int) doc.Error(), doc.ErrorDesc(), doc.ErrorRow()+1, doc.ErrorCol() + 1 );
	}
	{
		const char* str =	"\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n"
							"  <!-- Silly example -->\n"
							"    <door wall='north'>A great door!</door>\n"
							"\t<door wall='east'/>"
							"</room>";

        TiXmlDocument doc;
		doc.Parse( str );

		TiXmlHandle docHandle( &doc );
		TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" );
		TiXmlHandle commentHandle = docHandle.FirstChildElement( "room" ).FirstChild();
		TiXmlHandle textHandle = docHandle.FirstChildElement( "room" ).ChildElement( "door", 0 ).FirstChild();
		TiXmlHandle door0Handle = docHandle.FirstChildElement( "room" ).ChildElement( 0 );
		TiXmlHandle door1Handle = docHandle.FirstChildElement( "room" ).ChildElement( 1 );

		assert( docHandle.Node() );
		assert( roomHandle.Element() );
		assert( commentHandle.Node() );
		assert( textHandle.Text() );
		assert( door0Handle.Element() );
		assert( door1Handle.Element() );

		TiXmlDeclaration* declaration = doc.FirstChild()->ToDeclaration();
		assert( declaration );
		TiXmlElement* room = roomHandle.Element();
		assert( room );
		TiXmlAttribute* doors = room->FirstAttribute();
		assert( doors );
		TiXmlText* text = textHandle.Text();
		TiXmlComment* comment = commentHandle.Node()->ToComment();
		assert( comment );
		TiXmlElement* door0 = door0Handle.Element();
		TiXmlElement* door1 = door1Handle.Element();

		XmlTest( "Location tracking: Declaration row", declaration->Row(), 1 );
		XmlTest( "Location tracking: Declaration col", declaration->Column(), 5 );
		XmlTest( "Location tracking: room row", room->Row(), 1 );
		XmlTest( "Location tracking: room col", room->Column(), 45 );
		XmlTest( "Location tracking: doors row", doors->Row(), 1 );
		XmlTest( "Location tracking: doors col", doors->Column(), 51 );
		XmlTest( "Location tracking: Comment row", comment->Row(), 2 );
		XmlTest( "Location tracking: Comment col", comment->Column(), 3 );
		XmlTest( "Location tracking: text row", text->Row(), 3 ); 
		XmlTest( "Location tracking: text col", text->Column(), 24 );
		XmlTest( "Location tracking: door0 row", door0->Row(), 3 );
		XmlTest( "Location tracking: door0 col", door0->Column(), 5 );
		XmlTest( "Location tracking: door1 row", door1->Row(), 4 );
		XmlTest( "Location tracking: door1 col", door1->Column(), 5 );
	}
	{
		const char* str =	"\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n"
							"</room>";

        TiXmlDocument doc;
		doc.SetTabSize( 8 );
		doc.Parse( str );

		TiXmlHandle docHandle( &doc );
		TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" );

		assert( docHandle.Node() );
		assert( roomHandle.Element() );
开发者ID:E-LLP,项目名称:europa,代码行数:67,代码来源:xmltest.cpp


示例15: TiXmlNode

TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT )
{
	copy.CopyTo( this );
}
开发者ID:dos5gw,项目名称:TMeter,代码行数:4,代码来源:tinyxml.cpp


示例16: TiXmlDeclaration

// save world information into file
void MapInfoXmlWriter::SaveWorld(const std::string Filename, const WorldInfo & wi)
{
	TiXmlDocument doc;
	TiXmlComment * comment;
	std::string s;

 	TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
	doc.LinkEndChild( decl );

	TiXmlElement * root = new TiXmlElement("World");
	doc.LinkEndChild( root );
	root->SetAttribute("name", wi.Name);
	root->SetAttribute("firstmap", wi.FirstMap);
	root->SetAttribute("firstsparea", wi.FirstSpawning);

	TiXmlElement * desc = new TiXmlElement( "description" );
	root->LinkEndChild(desc);
	desc->LinkEndChild(new TiXmlText(wi.Description));

	// block: teleport
	{
		comment = new TiXmlComment();
		s="Define the place it is possible to teleport to, the first place is the place where we arrive in the world";
		comment->SetValue(s.c_str());
		root->LinkEndChild( comment );

		TiXmlElement * tps = new TiXmlElement( "teleports" );
		root->LinkEndChild(tps);


		std::map<std::string, TPInfo>::const_iterator it = wi.Teleports.begin();
		std::map<std::string, TPInfo>::const_iterator end = wi.Teleports.end();
		for(; it != end; ++it)
		{
			TiXmlElement * tp = new TiXmlElement( "teleport" );
			tps->LinkEndChild(tp);

			tp->SetAttribute("name", it->second.Name);
			tp->SetAttribute("map", it->second.NewMap);
			tp->SetAttribute("sparea", it->second.Spawning);
		}
	}

		// file info block
		{
			TiXmlElement * files = new TiXmlElement( "files" );
			root->LinkEndChild(files);

			std::map<std::string, std::string>::const_iterator it2 = wi.Files.begin();
			std::map<std::string, std::string>::const_iterator end2 = wi.Files.end();
			for(; it2 != end2; ++it2)
			{
				TiXmlElement * file = new TiXmlElement( "file" );
				files->LinkEndChild(file);

				file->SetAttribute("name", it2->first);
				file->SetAttribute("path", it2->second);
			}
		}



	TiXmlElement * maps = new TiXmlElement( "maps" );
	root->LinkEndChild(maps);

	std::map<std::string, MapInfo>::const_iterator it = wi.Maps.begin();
	std::map<std::string, MapInfo>::const_iterator end = wi.Maps.end();
	for(; it != end; ++it)
	{
		comment = new TiXmlComment();
		s="Map of "+it->second.Description;
		comment->SetValue(s.c_str());
		maps->LinkEndChild( comment );


		TiXmlElement * map = new TiXmlElement( "Map" );
		maps->LinkEndChild(map);

		map->SetAttribute("name", it->first);
		map->SetAttribute("type", it->second.Type);
		map->SetAttribute("music", it->second.Music);
		map->SetAttribute("repeatmusic", it->second.MusicLoop);


		TiXmlElement * descm = new TiXmlElement( "description" );
		map->LinkEndChild(descm);
		descm->LinkEndChild(new TiXmlText(it->second.Description));


		// file info block
		{
			comment = new TiXmlComment();
			s="Give the path of the files containing the island information to be loaded";
			comment->SetValue(s.c_str());
			map->LinkEndChild( comment );

			TiXmlElement * files = new TiXmlElement( "files" );
			map->LinkEndChild(files);

//.........这里部分代码省略.........
开发者ID:leloulight,项目名称:lbanet,代码行数:101,代码来源:MapInfoXmlWriter.cpp


示例17:

void TiXmlComment::operator=( const TiXmlComment& base )
{
	Clear();
	base.CopyTo( this );
}
开发者ID:dos5gw,项目名称:TMeter,代码行数:5,代码来源:tinyxml.cpp


示例18: TiXmlDeclaration

void CSettingsManager::write_SettingsXML()
{
  try
  {
    if(m_Settings.size() > 0)
    {
      TiXmlDocument doc;
      // ToDo: check all TiXml* generations!
      TiXmlDeclaration *declaration = new TiXmlDeclaration("1.0", "", "");
      doc.LinkEndChild(declaration);
      TiXmlComment *autoGenComment = new TiXmlComment();
      autoGenComment->SetValue(" THIS IS A AUTO GENERTATED FILE. DO NOT EDIT! ");
      doc.LinkEndChild(autoGenComment);

      for(SettingsMap::iterator mapIter = m_Settings.begin(); mapIter != m_Settings.end(); mapIter++)
      {
        vector<string> tokens;
        strTokenizer(mapIter->first, SETTINGS_SEPERATOR_STR, tokens);
        if(tokens.size() != 3)
        {
          doc.Clear();
          KODI->Log(LOG_ERROR, "Line: %i func: %s, Saving XML-File failed! Wrong SettingsMap string! Please call contact Addon author!\n", __LINE__, __func__, m_XMLFilename.c_str());
          return;
        }

        TiXmlElement *mainCategory = NULL;
        // check if this main category is already available
        for(TiXmlNode *element = doc.FirstChild(); element && !mainCategory; element = element->NextSiblingElement())
        {
          if(element->Value() == tokens[0])
          {
            mainCategory = static_cast<TiXmlElement*>(element);
          }
        }

        if(!mainCategory)
        { // create new main category
          mainCategory = new TiXmlElement(tokens[0]);
          doc.LinkEndChild(mainCategory);
        }

        TiXmlElement *settingsGroup = new TiXmlElement("settings_group");
        settingsGroup->SetAttribute("sub_category", tokens[1].c_str());
        settingsGroup->SetAttribute("group_name", tokens[2].c_str());
        mainCategory->LinkEndChild(settingsGroup);

        for(CSettingsList::iterator setIter=mapIter->second.begin(); setIter != mapIter->second.end(); setIter++)
        {
          if(!*setIter)
          {
            KODI->Log(LOG_ERROR, "Line: %i func: %s, invalid settings element! Please call contact Addon author!\n", __LINE__, __func__);
            return;
          }
          TiXmlElement *setting = new TiXmlElement("setting");
          setting->SetAttribute("key", (*setIter)->get_Key().c_str());

          switch((*setIter)->get_Type())
          {
            case ISettingsElement::STRING_SETTING:
              setting->SetAttribute("string", STRING_SETTINGS(*setIter)->get_Setting().c_str());
            break;

            case ISettingsElement::UNSIGNED_INT_SETTING:
              setting->SetAttribute("unsigned_int", toString(UNSIGNED_INT_SETTINGS(*setIter)->get_Setting()).c_str());
            break;

            case ISettingsElement::INT_SETTING:
              setting->SetAttribute("int", INT_SETTINGS(*setIter)->get_Setting());
            break;

            case ISettingsElement::FLOAT_SETTING:
              setting->SetDoubleAttribute("float", (double)FLOAT_SETTINGS(*setIter)->get_Setting());
            break;

            case ISettingsElement::DOUBLE_SETTING:
              setting->SetDoubleAttribute("double", DOUBLE_SETTINGS(*setIter)->get_Setting());
            break;

            case ISettingsElement::BOOL_SETTING:
              if(BOOL_SETTINGS(*setIter)->get_Setting())
              {
                setting->SetAttribute("bool", "true");
              }
              else
              {
                setting->SetAttribute("bool", "false");
              }
            break;

            default:
              KODI->Log(LOG_ERROR, "Line: %i func: %s, invalid settings type! Please call contact Addon author!\n", __LINE__, __func__);
              return;
            break;
          }

          settingsGroup->LinkEndChild(setting);
        }
      }

      if(!doc.SaveFile(m_XMLFilename.c_str()))
//.........这里部分代码省略.........
开发者ID:AchimTuran,项目名称:adsp.xconvolver-fork,代码行数:101,代码来源:SettingsManager.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TiXmlDeclaration类代码示例发布时间:2022-05-31
下一篇:
C++ TiXmlAttributeA类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap