Update of /cvsroot/boost/boost/libs/graph/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13869

Modified Files:
        graphml.cpp 
Log Message:
Use simple string operations rather than the string algorithms library

Index: graphml.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/graph/src/graphml.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- graphml.cpp 29 Jan 2007 22:14:41 -0000      1.1
+++ graphml.cpp 8 Feb 2007 04:13:07 -0000       1.2
@@ -10,9 +10,9 @@
 //           Tiago de Paula Peixoto
 
 #include <boost/variant.hpp>
-#include <boost/algorithm/string/replace.hpp>
 #include <expat.h>
 #include <boost/graph/graphml.hpp>
+#include <string>
 
 using namespace boost;
 
@@ -30,13 +30,17 @@
         XML_SetCharacterDataHandler(parser, &on_character_data);
         XML_SetUserData(parser, this);
         char buffer[buffer_size];
+
+        bool okay = true;
         do 
         {
-            in.read(buffer, buffer_size);
+          in.read(buffer, buffer_size);
+
+          okay = XML_Parse(parser, buffer, in.gcount(), in.gcount() == 0);
         } 
-        while (XML_Parse(parser, buffer, in.gcount(), in.gcount() == 0) && 
in.good());
+        while (okay && in.good());
 
-        if (in.good()) 
+        if (!okay) 
         {
             std::stringstream s;
             s << "Parse error: " << XML_ErrorString(XML_GetErrorCode(parser))
@@ -67,7 +71,9 @@
         graphml_reader* self = static_cast<graphml_reader*>(user_data);
 
         std::string name(c_name);
-        replace_first(name, "http://graphml.graphdrawing.org/xmlns|", "");
+        std::string::size_type pos = name.find('|');
+        if (pos != std::string::npos)
+          name.erase(0, pos+1);
 
         if (name == "key") 
         {
@@ -193,7 +199,9 @@
         graphml_reader* self = static_cast<graphml_reader*>(user_data);
 
         std::string name(c_name);
-        replace_first(name, "http://graphml.graphdrawing.org/xmlns|", "");
+        std::string::size_type pos = name.find('|');
+        if (pos != std::string::npos)
+          name.erase(0, pos+1);
 
         if (name == "data") 
         {            


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to