Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63535 - in trunk: boost/graph libs/graph/build libs/graph/doc
From: jewillco_at_[hidden]
Date: 2010-07-02 21:14:59


Author: jewillco
Date: 2010-07-02 21:14:58 EDT (Fri, 02 Jul 2010)
New Revision: 63535
URL: http://svn.boost.org/trac/boost/changeset/63535

Log:
Changed BGL Graphviz writer to use Xpressive to avoid need to link to libboost_regex
Text files modified:
   trunk/boost/graph/graphviz.hpp | 9 +++++----
   trunk/libs/graph/build/Jamfile.v2 | 1 -
   trunk/libs/graph/doc/write-graphviz.html | 4 ----
   3 files changed, 5 insertions(+), 9 deletions(-)

Modified: trunk/boost/graph/graphviz.hpp
==============================================================================
--- trunk/boost/graph/graphviz.hpp (original)
+++ trunk/boost/graph/graphviz.hpp 2010-07-02 21:14:58 EDT (Fri, 02 Jul 2010)
@@ -26,9 +26,9 @@
 #include <boost/graph/overloading.hpp>
 #include <boost/graph/dll_import_export.hpp>
 #include <boost/spirit/include/classic_multi_pass.hpp>
-#include <boost/regex.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/algorithm/string/replace.hpp>
+#include <boost/xpressive/xpressive_static.hpp>
 
 namespace boost {
 
@@ -61,12 +61,13 @@
 
   template <typename T>
   inline std::string escape_dot_string(const T& obj) {
- static boost::regex valid_unquoted_id("[a-zA-Z\\0200-\\0377_][a-zA-Z\\0200-\\0377_0-9]*|-?(?:[.][0-9]*|[0-9]+(?:[.][0-9]*)?)");
+ using namespace boost::xpressive;
+ static sregex valid_unquoted_id = (((alpha | '_') >> *_w) | (!as_xpr('-') >> (('.' >> *_d) | (+_d >> !('.' >> *_d)))));
     std::string s(boost::lexical_cast<std::string>(obj));
- if (boost::regex_match(s, valid_unquoted_id)) {
+ if (regex_match(s, valid_unquoted_id)) {
       return s;
     } else {
- return "\"" + boost::algorithm::replace_all_copy(s, "\"", "\\\"") + "\"";
+ return "\"" + regex_replace(s, sregex(as_xpr('"')), "\\\"") + "\"";
     }
   }
 

Modified: trunk/libs/graph/build/Jamfile.v2
==============================================================================
--- trunk/libs/graph/build/Jamfile.v2 (original)
+++ trunk/libs/graph/build/Jamfile.v2 2010-07-02 21:14:58 EDT (Fri, 02 Jul 2010)
@@ -23,7 +23,6 @@
     <toolset>msvc-7.1:<cxxflags>-GR-
     :
     :
- <library>../../regex/build//boost_regex
     ;
 
 boost-install boost_graph ;

Modified: trunk/libs/graph/doc/write-graphviz.html
==============================================================================
--- trunk/libs/graph/doc/write-graphviz.html (original)
+++ trunk/libs/graph/doc/write-graphviz.html 2010-07-02 21:14:58 EDT (Fri, 02 Jul 2010)
@@ -329,10 +329,6 @@
 
 <a href="./read_graphviz.html"><tt>read_graphviz</tt></a>
 
-<h3>Notes</h3>
-The Graphviz file writing functions require that programs link to the
-<tt>boost_regex</tt> library.
-
 <br>
 <HR>
 <TABLE>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk