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


C++ TiXmlDocument::ErrorId方法代码示例

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


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

示例1: FileExists

bool GD_API FileExists( const gd::String & file )
{
    TiXmlDocument doc;
    if ( !doc.LoadFile(file.ToLocale().c_str()) && doc.ErrorId() == 2)
        return false;

    return true ;
}
开发者ID:HaoDrang,项目名称:GD,代码行数:8,代码来源:FileTools.cpp

示例2: getDocument

static TiXmlDocument* getDocument(const char* fileName)
{
	SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
	std::string filePath = resourceManager->getLayoutPath() + SE_SEP + fileName;
	TiXmlDocument* doc = new TiXmlDocument(filePath.c_str());
    doc->LoadFile();
    if(doc->Error() && doc->ErrorId() ==TiXmlBase::TIXML_ERROR_OPENING_FILE)
    {
		OUTSTRING("can not open xml file: %s\n", filePath);
        return NULL;
    }
	return doc;
}
开发者ID:huhuhu1092,项目名称:test-server,代码行数:13,代码来源:SE_CheckXml.cpp

示例3: make_solution_for_ub

void make_solution_for_ub( project_info_table& info )
{	
	TiXmlDocument root;
	std::string path = util::string::wc2mb( info.project_file_path.c_str() );
	root.LoadFile( path.c_str() );

	std::string backup_path = path + "_backup";
	root.SaveFile( backup_path.c_str() );

	if ( root.Error() == true )
	{
		printf( "loading error file : %s errorID : %d , errorRow : %d errorCol : %d"
				, path.c_str()
				, root.ErrorId()
				, root.ErrorRow()
				, root.ErrorCol()
				);

		return;
	}

	TiXmlNode* pRoot = root.FirstChildElement("Project");
	if ( pRoot == NULL )
		return;

	TiXmlNode* pItemGroup = pRoot->FirstChild("ItemGroup");
	if ( pItemGroup == NULL )
		return;

	
	search_node( pItemGroup , info.filepath_table );

	print_unity_x( info );
	
	clear_unity_file( pRoot );
	add_unity_file( pRoot );


	root.SaveFile( path.c_str() );
	root.Clear();
}
开发者ID:rodrigobmg,项目名称:choding,代码行数:41,代码来源:all_cpp.cpp

示例4: load_registry_xml

static bool load_registry_xml(char* filename)
{
  TiXmlDocument doc;
  if(!doc.LoadFile(filename))
  {
    if(doc.ErrorId() != TiXmlBase::TIXML_ERROR_OPENING_FILE)
      CLog::Log(LOGERROR, __FUNCTION__"(%s) - %s on row %d and col %d", filename, doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol());
    return false;
  }

  if(strcmp("registry", doc.RootElement()->Value()))
  {
    CLog::Log(LOGERROR, __FUNCTION__"(%s) - Invalid root element expected ""registry""", doc.RootElement()->Value());
    return false;
  }

  TiXmlNode *node = NULL;
  while(node = doc.RootElement()->IterateChildren("key", node))
    load_registry_key(0, node->ToElement());

  return true;
}
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:22,代码来源:emu_registry.cpp

示例5: Run

    /**
     * Constructor of the run class for toaster_vizualiser
     */
    Run() {
        name_list = std::vector<std::string>();
        id_cpt = 1;

        ros::NodeHandle reception_node;
        ros::NodeHandle emission_node;

        area_list = visualization_msgs::MarkerArray();
        obj_list = visualization_msgs::MarkerArray();
        human_list = visualization_msgs::MarkerArray();
        robot_list = visualization_msgs::MarkerArray();

        //definition of subscribers
        sub_objList = reception_node.subscribe("/pdg/objectList", 1000, &Run::chatterCallbackObjList, this);
        sub_areaList = reception_node.subscribe("/area_manager/areaList", 1000, &Run::chatterCallbackAreaList, this);
        sub_humanList = reception_node.subscribe("/pdg/humanList", 1000, &Run::chatterCallbackHumanList, this);
        sub_robotList = reception_node.subscribe("/pdg/robotList", 1000, &Run::chatterCallbackRobotList, this);

        //definition of publishers
        pub_obj = emission_node.advertise<visualization_msgs::MarkerArray>("/toaster_visualizer/marker_object", 1000);
        pub_area = emission_node.advertise<visualization_msgs::MarkerArray>("/toaster_visualizer/marker_area", 1000);
        pub_human = emission_node.advertise<visualization_msgs::MarkerArray>("/toaster_visualizer/marker_human", 1000);
        pub_robot = emission_node.advertise<visualization_msgs::MarkerArray>("/toaster_visualizer/marker_robot", 1000);


        //open xml files

        // Objects
        std::stringstream pathObj;
        pathObj << ros::package::getPath("toaster_visualizer") << "/src/list_obj.xml";
        listObj = TiXmlDocument(pathObj.str());

        if (!listObj.LoadFile()) {
            ROS_WARN_ONCE("Erreur lors du chargement du fichier xml");
            ROS_WARN_ONCE("error # %d", listObj.ErrorId());
            ROS_WARN_ONCE("%s", listObj.ErrorDesc());
        }

        // Humans
        std::stringstream pathHuman;
        pathHuman << ros::package::getPath("toaster_visualizer") << "/src/list_human_morse_joints.xml";
        listMemb = TiXmlDocument(pathHuman.str());

        if (!listMemb.LoadFile()) {
            ROS_WARN_ONCE("Erreur lors du chargement du fichier xml");
            ROS_WARN_ONCE("error # %d", listMemb.ErrorId());
            ROS_WARN_ONCE("%s", listMemb.ErrorDesc());
        }

        // Robots        
        /*path.flush();
        path << ros::package::getPath("toaster_visualizer") << "/src/list_robots.xml";
        listRob = TiXmlDocument(path.str());

        if (!listRob.LoadFile()) {
            ROS_WARN_ONCE("Erreur lors du chargement du fichier xml");
            ROS_WARN_ONCE("error # %d", listRob.ErrorId());
            ROS_WARN_ONCE("%s", listRob.ErrorDesc());
        }*/

    }
开发者ID:globox1,项目名称:toaster,代码行数:64,代码来源:run.cpp

示例6: main


//.........这里部分代码省略.........
		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 ) {
			printf( "WARNING: File 'utf8test.xml' not found.\n"
					"(Are you running the test from the wrong directory?)\n"
				    "Could not test UTF-8 functionality.\n" );
		}
		else
		{
			TiXmlHandle docH( &doc );
			// Get the attribute "value" from the "Russian" element and check it.
			TiXmlElement* element = docH.FirstChildElement( "document" ).FirstChildElement( "Russian" ).Element();
			const unsigned char correctValue[] = {	0xd1U, 0x86U, 0xd0U, 0xb5U, 0xd0U, 0xbdU, 0xd0U, 0xbdU, 
													0xd0U, 0xbeU, 0xd1U, 0x81U, 0xd1U, 0x82U, 0xd1U, 0x8cU, 0 };

			XmlTest( "UTF-8: Russian value.", (const char*)correctValue, element->Attribute( "value" ), true );
			XmlTest( "UTF-8: Russian value row.", 4, element->Row() );
			XmlTest( "UTF-8: Russian value column.", 5, element->Column() );

			const unsigned char russianElementName[] = {	0xd0U, 0xa0U, 0xd1U, 0x83U,
															0xd1U, 0x81U, 0xd1U, 0x81U,
															0xd0U, 0xbaU, 0xd0U, 0xb8U,
															0xd0U, 0xb9U, 0 };
			const char russianText[] = "<\xD0\xB8\xD0\xBC\xD0\xB5\xD0\xB5\xD1\x82>";

			TiXmlText* text = docH.FirstChildElement( "document" ).FirstChildElement( (const char*) russianElementName ).Child( 0 ).Text();
			XmlTest( "UTF-8: Browsing russian element name.",
					 russianText,
					 text->Value(),
					 true );
			XmlTest( "UTF-8: Russian element name row.", 7, text->Row() );
			XmlTest( "UTF-8: Russian element name column.", 47, text->Column() );

			TiXmlDeclaration* dec = docH.Child( 0 ).Node()->ToDeclaration();
			XmlTest( "UTF-8: Declaration column.", 1, dec->Column() );
开发者ID:DavidLui,项目名称:-CSE380-Balloon-Escape,代码行数:67,代码来源:xmltest.cpp

示例7: run

static void run(int argc, const char* argv[])
{
  PO po;
  PO::Option& inputOpt = po.add("input").requiresValue("<filename>");
  PO::Option& widgetId = po.add("widgetid").requiresValue("<id>");
  PO::Option& prefH = po.add("pref-h");
  PO::Option& prefCpp = po.add("pref-cpp");
  PO::Option& theme = po.add("theme");
  PO::Option& strings = po.add("strings");
  PO::Option& commandIds = po.add("command-ids");
  PO::Option& widgetsDir = po.add("widgets-dir").requiresValue("<dir>");
  PO::Option& stringsDir = po.add("strings-dir").requiresValue("<dir>");
  PO::Option& guiFile = po.add("gui-file").requiresValue("<filename>");
  po.parse(argc, argv);

  // Try to load the XML file
  TiXmlDocument* doc = nullptr;

  std::string inputFilename = po.value_of(inputOpt);
  if (!inputFilename.empty() &&
      base::get_file_extension(inputFilename) == "xml") {
    base::FileHandle inputFile(base::open_file(inputFilename, "rb"));
    doc = new TiXmlDocument();
    doc->SetValue(inputFilename.c_str());
    if (!doc->LoadFile(inputFile.get())) {
      std::cerr << doc->Value() << ":"
                << doc->ErrorRow() << ":"
                << doc->ErrorCol() << ": "
                << "error " << doc->ErrorId() << ": "
                << doc->ErrorDesc() << "\n";

      throw std::runtime_error("invalid input file");
    }
  }

  if (doc) {
    // Generate widget class
    if (po.enabled(widgetId))
      gen_ui_class(doc, inputFilename, po.value_of(widgetId));
    // Generate preference header file
    else if (po.enabled(prefH))
      gen_pref_header(doc, inputFilename);
    // Generate preference c++ file
    else if (po.enabled(prefCpp))
      gen_pref_impl(doc, inputFilename);
    // Generate theme class
    else if (po.enabled(theme))
      gen_theme_class(doc, inputFilename);
  }
  // Generate strings.ini.h file
  else if (po.enabled(strings)) {
    gen_strings_class(inputFilename);
  }
  // Generate command_ids.ini.h file
  else if (po.enabled(commandIds)) {
    gen_command_ids(inputFilename);
  }
  // Check all translation files (en.ini, es.ini, etc.)
  else if (po.enabled(widgetsDir) &&
           po.enabled(stringsDir)) {
    check_strings(po.value_of(widgetsDir),
                  po.value_of(stringsDir),
                  po.value_of(guiFile));
  }
}
开发者ID:aseprite,项目名称:aseprite,代码行数:65,代码来源:gen.cpp

示例8: reload

void TileSet::reload()
{
	// XML-Dokument laden
	std::string text = FileSystem::inst().readStringFromFile(filename);
	TiXmlDocument doc;
	doc.Parse(text.c_str());
	if(doc.ErrorId())
	{
		printfLog("+ ERROR: Could not parse tileset XML file \"%s\" (Error: %d).\n",
				  filename.c_str(),
				  doc.ErrorId());
		error = 1;
		return;
	}

	TiXmlHandle docHandle(&doc);
	TiXmlHandle tileSetHandle = docHandle.FirstChildElement("TileSet");
	TiXmlElement* p_tileSetElement = tileSetHandle.Element();

	// Dateiname des Bilds und Größe der Tiles lesen
	const char* p_imageFilename = p_tileSetElement->Attribute("image");
	p_tileSetElement->Attribute("tileWidth", &tileSize.x);
	p_tileSetElement->Attribute("tileHeight", &tileSize.y);

	// Textur laden
	std::string dir = FileSystem::inst().getPathDirectory(filename);
	std::string imageFilename = dir + (dir.empty() ? "" : "/") + std::string(p_imageFilename);
	p_texture = Manager<Texture>::inst().request(imageFilename);
	if(!p_texture)
	{
		printfLog("+ ERROR: Could not load tileset texture \"%s\" for tileset \"%s\".\n",
				  p_imageFilename,
				  filename.c_str());
		error = 2;
		return;
	}

	p_texture->keepInMemory();

	maxTileID = 0;

	// alle Kind-Elemente verarbeiten
	TiXmlElement* p_tileElement = p_tileSetElement->FirstChildElement("Tile");
	while(p_tileElement)
	{
		TileInfo info = badTile;

		// ID lesen
		uint id = static_cast<uint>(p_tileElement->Attribute("id")[0]);
		maxTileID = max(maxTileID, id);

		// Position lesen
		p_tileElement->Attribute("x", &info.position.x);
		p_tileElement->Attribute("y", &info.position.y);

		// Typ lesen
		p_tileElement->Attribute("type", &info.type);

		if(info.type == 2)
		{
			// Zerstörzeit lesen
			p_tileElement->Attribute("destroyTime", &info.destroyTime);

			// Trümmerfarbe berechnen
			info.debrisColor = DebrisColorDB::inst().getDebrisColor(p_texture, info.position);
		}

		// Tile-Typ eintragen
		tiles[id] = info;

		p_tileElement = p_tileElement->NextSiblingElement("Tile");
	}
}
开发者ID:TomasRiker,项目名称:blocks-5,代码行数:73,代码来源:tileset.cpp

示例9: reload

void Font::reload()
{
	cleanUp();

	// XML-Dokument laden
	std::string text = FileSystem::inst().readStringFromFile(filename);
	TiXmlDocument doc;
	doc.Parse(text.c_str());
	if(doc.ErrorId())
	{
		printfLog("+ ERROR: Could not parse font XML file \"%s\" (Error: %d).\n",
				  filename.c_str(),
				  doc.ErrorId());
		error = 1;
		return;
	}

	TiXmlHandle docHandle(&doc);
	TiXmlHandle fontHandle = docHandle.FirstChildElement("Font");
	TiXmlElement* p_fontElement = fontHandle.Element();

	// Dateiname des Bilds, Zeilenhöhe und Offset lesen
	const char* p_imageFilename = p_fontElement->Attribute("image");
	p_fontElement->Attribute("lineHeight", &lineHeight);
	p_fontElement->Attribute("offset", &offset);

	// alle Kind-Elemente verarbeiten
	TiXmlElement* p_charElement = p_fontElement->FirstChildElement("Character");
	while(p_charElement)
	{
		int code, x, y, w, h;
		p_charElement->Attribute("code", &code);
		p_charElement->Attribute("x", &x);
		p_charElement->Attribute("y", &y);
		p_charElement->Attribute("w", &w);
		p_charElement->Attribute("h", &h);

		if(code >= 0 && code < 256)
		{
			charInfo[code].position = Vec2i(x, y);
			charInfo[code].size = Vec2i(w, h);
		}

		p_charElement = p_charElement->NextSiblingElement("Character");
	}

	// Textur laden
	std::string dir = FileSystem::inst().getPathDirectory(filename);
	std::string imageFilename = dir + (dir.empty() ? "" : "/") + std::string(p_imageFilename);
	p_texture = Manager<Texture>::inst().request(imageFilename);
	if(!p_texture)
	{
		printfLog("+ ERROR: Could not load font texture \"%s\" for font \"%s\".\n",
				  p_imageFilename,
				  filename.c_str());
		error = 2;
		return;
	}

	// Cache leeren
	stringCache.clear();
	listFree = ~0;
}
开发者ID:TomasRiker,项目名称:blocks-5,代码行数:63,代码来源:font.cpp

示例10: main


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

		// Round trip check: stream in, then stream back out to verify. The stream
		// out has already been checked, above. We use the output

		istringstream inputStringStream( outputStream.str() );
		TiXmlDocument document0;

		inputStringStream >> document0;

		ostringstream outputStream0( ostringstream::out );
		outputStream0 << document0;

		XmlTest( "Stream round trip correct.",	string( demoEnd ).c_str(), 
												outputStream0.str().c_str(), true );

		std::string str;
		str << document0;

		XmlTest( "String printing correct.", string( demoEnd ).c_str(), 
											 str.c_str(), true );
	}
#endif

	// --------------------------------------------------------
	// 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 ) {
			printf( "WARNING: File 'utf8test.xml' not found.\n"
					"(Are you running the test from the wrong directory?)\n"
				    "Could not test UTF-8 functionality.\n" );
		}
		else
		{
			TiXmlHandle docH( &doc );
			// Get the attribute "value" from the "Russian" element and check it.
			TiXmlElement* element = docH.FirstChildElement( "document" ).FirstChildElement( "Russian" ).Element();
			const unsigned char correctValue[] = {	0xd1U, 0x86U, 0xd0U, 0xb5U, 0xd0U, 0xbdU, 0xd0U, 0xbdU, 
													0xd0U, 0xbeU, 0xd1U, 0x81U, 0xd1U, 0x82U, 0xd1U, 0x8cU, 0 };

			XmlTest( "UTF-8: Russian value.", (const char*)correctValue, element->Attribute( "value" ), true );
			XmlTest( "UTF-8: Russian value row.", 4, element->Row() );
			XmlTest( "UTF-8: Russian value column.", 5, element->Column() );

			const unsigned char russianElementName[] = {	0xd0U, 0xa0U, 0xd1U, 0x83U,
															0xd1U, 0x81U, 0xd1U, 0x81U,
															0xd0U, 0xbaU, 0xd0U, 0xb8U,
															0xd0U, 0xb9U, 0 };
			const char russianText[] = "<\xD0\xB8\xD0\xBC\xD0\xB5\xD0\xB5\xD1\x82>";

			TiXmlText* text = docH.FirstChildElement( "document" ).FirstChildElement( (const char*) russianElementName ).Child( 0 ).Text();
			XmlTest( "UTF-8: Browsing russian element name.",
					 russianText,
					 text->Value(),
					 true );
			XmlTest( "UTF-8: Russian element name row.", 7, text->Row() );
			XmlTest( "UTF-8: Russian element name column.", 47, text->Column() );

			TiXmlDeclaration* dec = docH.Child( 0 ).Node()->ToDeclaration();
			XmlTest( "UTF-8: Declaration column.", 1, dec->Column() );
开发者ID:bsmr-worldforge,项目名称:libwfut,代码行数:67,代码来源:xmltest.cpp

示例11: GetDirectory

bool CRSSDirectory::GetDirectory(const CStdString& path, CFileItemList &items)
{
  CStdString strPath(path);
  CUtil::RemoveSlashAtEnd(strPath);

  /* check cache */
  if(m_path == strPath)
  {
    items.Copy(m_items);
    return true;
  }

  /* clear cache */
  m_items.Clear();
  m_path == "";

  TiXmlDocument xmlDoc;
  if (!xmlDoc.LoadFile(strPath))
  {
    CLog::Log(LOGERROR,"failed to load xml from <%s>. error: <%d>", strPath.c_str(), xmlDoc.ErrorId());
    return false;
  }
  if (xmlDoc.Error())
  {
    CLog::Log(LOGERROR,"error parsing xml doc from <%s>. error: <%d>", strPath.c_str(), xmlDoc.ErrorId());
    return false;
  }

  TiXmlElement* rssXmlNode = xmlDoc.RootElement();

  if (!rssXmlNode)
    return false;

  TiXmlHandle docHandle( &xmlDoc );
  TiXmlElement* channelXmlNode = docHandle.FirstChild( "rss" ).FirstChild( "channel" ).Element();
  if (channelXmlNode)
    ParseItem(&items, channelXmlNode);
  else
    return false;

  TiXmlElement* child = NULL;
  for (child = channelXmlNode->FirstChildElement("item"); child; child = child->NextSiblingElement())
  {
    // Create new item,
    CFileItemPtr item(new CFileItem());
    ParseItem(item.get(), child);

    item->SetProperty("isrss", "1");

    if (!item->m_strPath.IsEmpty())
      items.Add(item);
  }

  items.AddSortMethod(SORT_METHOD_UNSORTED , 231, LABEL_MASKS("%L", "%D", "%L", ""));    // FileName, Duration | Foldername, empty
  items.AddSortMethod(SORT_METHOD_LABEL    , 551, LABEL_MASKS("%L", "%D", "%L", ""));    // FileName, Duration | Foldername, empty
  items.AddSortMethod(SORT_METHOD_SIZE     , 553, LABEL_MASKS("%L", "%I", "%L", "%I"));  // FileName, Size | Foldername, Size
  items.AddSortMethod(SORT_METHOD_DATE     , 552, LABEL_MASKS("%L", "%J", "%L", "%J"));  // FileName, Date | Foldername, Date

  m_items.Copy(items);
  m_path  = strPath;

  return true;
}
开发者ID:tmacreturns,项目名称:XBMC_wireless_setup,代码行数:63,代码来源:RSSDirectory.cpp

示例12: Load

//================================================================================================
//
//  Load()
//
//    - Called by Main_OnInitDialog()
//
/// <summary>
///   Attempts to load the config-file.  Returns true if successful, false if not
/// </summary>
/// <remarks>
///   If we're unsuccessful, the caller will assume this is the first time we've run the program
///   and will run through the startup-wizard.
/// </remarks>
//
bool Configuration::Load()
{
    TRACEI("[Configuration] [Load]  > Entering routine.");

    TiXmlDocument doc;

    const path pb=path::base_dir()/_T("peerblock.conf");
    const path oldpb=path::base_dir()/_T("peerblock.conf.bak");
    const path pg2=path::base_dir()/_T("pg2.conf");

    vector<path> files;
    files.push_back(pb);
    files.push_back(oldpb);
    files.push_back(pg2);

    bool loaded = false;
    bool isDirty = false;

    for(vector<path>::iterator itr = files.begin(); itr != files.end() && !loaded; ++itr)
    {
        {
            HANDLE fp = NULL;
            HANDLE map = NULL;
            const void *view = NULL;
            if (!LoadFile((*itr).file_str().c_str(), &fp, &map, &view))	// first try to find a PeerBlock file
            {
                tstring strBuf = boost::str(tformat(_T("[Configuration] [Load]    WARNING:  Unable to load configuration file [%1%]")) %
                                            (*itr).file_str().c_str() );
                TRACEBUFW(strBuf);
                continue;
            }

            tstring strBuf = boost::str(tformat(_T("[Configuration] [Load]    Loaded configuration file [%1%]")) %
                                        (*itr).file_str().c_str() );
            TRACEBUFI(strBuf);

            boost::shared_ptr<void> fp_safe(fp, CloseHandle);
            boost::shared_ptr<void> map_safe(map, CloseHandle);
            boost::shared_ptr<const void> view_safe(view, UnmapViewOfFile);

            doc.Parse((const char*)view);

            if(doc.Error())
            {
                TRACEE("[Configuration] [Load]  * ERROR:  Can't parse xml document");
                tstring strBuf = boost::str(tformat(_T("[Configuration] [Load]  * - Error: [%1%] (\"%2%\") at row:[%3%] col:[%4%]")) %
                                            doc.ErrorId() % doc.ErrorDesc() % doc.ErrorRow() % doc.ErrorCol() );
                TRACEBUFE(strBuf);

                // copy over to .failed
                path failedFile;
                failedFile = itr->file_str();
                failedFile = failedFile.file_str() + L".failed";
                path::copy(*itr, failedFile, true);
                strBuf = boost::str(tformat(_T("[Configuration] [Load]    - Copied failed-parsing config-file to: [%1%]")) % failedFile.file_str() );
                TRACEBUFE(strBuf);
                continue;
            }
        }

        if (*itr == pb)
        {
            TRACEI("[Configuration] [Load]    found peerblock configuration file");
        }
        else if (*itr == oldpb)
        {
            TRACEW("[Configuration] [Load]    using last-known-good configuration file");
            MessageBox(NULL, IDS_CONFERRTEXT, IDS_CONFERR, MB_ICONWARNING|MB_OK);
            g_config.Save(_T("peerblock.conf"));	// save restored config to regular file
        }
        else if (*itr == pg2)
        {
            TRACEI("[Configuration] [Load]    found old-style pg2 configuration file");
        }
        else	// can't find anything, return false so caller can run the startup-wizard
        {
            TRACEW("[Configuration] [Load]    WARNING:  No configuration file found.");
            return false;
        }

        loaded = true;
    }

    if (!loaded)
    {
        // can't find anything, return false so caller can run the startup-wizard
//.........这里部分代码省略.........
开发者ID:hskang113,项目名称:peerblock,代码行数:101,代码来源:configuration.cpp

示例13: throw

XMLException::XMLException(const TiXmlDocument& doc) throw ()
	: m_errorInfo(doc.ErrorId(), doc.ErrorRow(), doc.ErrorCol())
{ _createErrorString(); }
开发者ID:Alwnikrotikz,项目名称:xsd-tools,代码行数:3,代码来源:Exception.cpp


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