Update of /cvsroot/boost/boost/libs/xpressive/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13535/libs/xpressive/test

Modified Files:
        test_actions.cpp test_symbols.cpp 
Log Message:
portability fixes

Index: test_actions.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/xpressive/test/test_actions.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- test_actions.cpp    24 May 2007 23:17:08 -0000      1.10
+++ test_actions.cpp    1 Jul 2007 21:33:24 -0000       1.11
@@ -16,6 +16,8 @@
 #include <boost/xpressive/regex_actions.hpp>
 #include <boost/test/unit_test.hpp>
 
+namespace xp = boost::xpressive;
+
 ///////////////////////////////////////////////////////////////////////////////
 // test1
 //  simple action which builds a string
@@ -25,7 +27,7 @@
 
     std::string result;
     std::string str("foo bar baz foo bar baz");
-    sregex rx = (+_w)[ ref(result) += _ ] >> *(' ' >> (+_w)[ ref(result) += 
',' + _ ]);
+    sregex rx = (+_w)[ xp::ref(result) += _ ] >> *(' ' >> (+_w)[ 
xp::ref(result) += ',' + _ ]);
 
     if(!regex_match(str, rx))
     {
@@ -46,7 +48,7 @@
 
     std::string result;
     std::string str("foo bar baz foo bar baz");
-    sregex rx = (+_w)[ ref(result) += _ ] >> *(' ' >> (+_w)[ ref(result) += 
',' + _ ]) >> repeat<4>(_);
+    sregex rx = (+_w)[ xp::ref(result) += _ ] >> *(' ' >> (+_w)[ 
xp::ref(result) += ',' + _ ]) >> repeat<4>(_);
 
     if(!regex_match(str, rx))
     {
@@ -68,11 +70,11 @@
     std::list<int> result;
     std::string str("1 23 456 7890");
 #if BOOST_VERSION >= 103500
-    sregex rx = (+_d)[ ref(result)->*push_back( as<int>(_) ) ] 
-        >> *(' ' >> (+_d)[ ref(result)->*push_back( as<int>(_) ) ]);
+    sregex rx = (+_d)[ xp::ref(result)->*push_back( as<int>(_) ) ] 
+        >> *(' ' >> (+_d)[ xp::ref(result)->*push_back( as<int>(_) ) ]);
 #else
-    sregex rx = (+_d)[ push_back(ref(result), as<int>(_) ) ] 
-        >> *(' ' >> (+_d)[ push_back(ref(result), as<int>(_) ) ]);
+    sregex rx = (+_d)[ push_back(xp::ref(result), as<int>(_) ) ] 
+        >> *(' ' >> (+_d)[ push_back(xp::ref(result), as<int>(_) ) ]);
 #endif
 
     if(!regex_match(str, rx))
@@ -98,7 +100,7 @@
 
     std::map<std::string, int> result;
     std::string str("aaa=>1 bbb=>23 ccc=>456");
-    sregex pair = ( (s1= +_w) >> "=>" >> (s2= +_d) )[ ref(result)[s1] = 
as<int>(s2) ];
+    sregex pair = ( (s1= +_w) >> "=>" >> (s2= +_d) )[ xp::ref(result)[s1] = 
as<int>(s2) ];
     sregex rx = pair >> *(+_s >> pair);
 
     if(!regex_match(str, rx))

Index: test_symbols.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/xpressive/test/test_symbols.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test_symbols.cpp    25 Jun 2007 22:09:29 -0000      1.2
+++ test_symbols.cpp    1 Jul 2007 21:33:24 -0000       1.3
@@ -12,9 +12,12 @@
 #include <boost/version.hpp>
 #include <boost/xpressive/xpressive_static.hpp>
 #include <boost/xpressive/regex_actions.hpp>
-#include <boost/foreach.hpp>
 #include <boost/test/unit_test.hpp>
 
+#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
+
+namespace xp = boost::xpressive;
+
 ///////////////////////////////////////////////////////////////////////////////
 // test1
 //  simple action which builds a *translated* string
@@ -29,7 +32,7 @@
     map1["bar"] = "2";
     map1["baz"] = "3";
 
-    sregex rx = (a1=map1)[ ref(result) = a1 ] >> *(' ' >> (a1=map1)[ 
ref(result) += ',' + a1 ]);
+    sregex rx = (a1=map1)[ xp::ref(result) = a1 ] >> *(' ' >> (a1=map1)[ 
xp::ref(result) += ',' + a1 ]);
 
     if(!regex_match(str, rx))
     {
@@ -57,8 +60,8 @@
     map1["foobaz"] = "4";
     map1["foobazbaz"] = "5";
 
-    sregex rx = (a1=map1)[ ref(result) = a1 ] 
-               >> *((a1=map1)[ ref(result) += ',', ref(result) += a1 ]);
+    sregex rx = (a1=map1)[ xp::ref(result) = a1 ] 
+               >> *((a1=map1)[ xp::ref(result) += ',', xp::ref(result) += a1 
]);
 
     if(!regex_match(str, rx))
     {
@@ -86,11 +89,11 @@
     map1["bop"] = 7890;
 
 #if BOOST_VERSION >= 103500
-    sregex rx = (a1=map1)[ ref(result)->*push_back( a1 ) ] 
-        >> *(' ' >> (a1=map1)[ ref(result)->*push_back( a1 ) ]);
+    sregex rx = (a1=map1)[ xp::ref(result)->*push_back( a1 ) ] 
+        >> *(' ' >> (a1=map1)[ xp::ref(result)->*push_back( a1 ) ]);
 #else
-    sregex rx = (a1=map1)[ push_back(ref(result), a1 ) ] 
-        >> *(' ' >> (a1=map1)[ push_back(ref(result), a1 ) ]);
+    sregex rx = (a1=map1)[ push_back(xp::ref(result), a1 ) ] 
+        >> *(' ' >> (a1=map1)[ push_back(xp::ref(result), a1 ) ]);
 #endif
 
     if(!regex_match(str, rx))
@@ -174,15 +177,15 @@
     map9["i"] = 9;
 
     sregex rx = 
-           (a1=map1)[ ref(result) += a1 ]
-        >> (a2=map2)[ ref(result) += a2 ]
-        >> (a3=map3)[ ref(result) += a3 ] 
-        >> (a4=map4)[ ref(result) += a4 ] 
-        >> (a5=map5)[ ref(result) += a5 ] 
-        >> (a6=map6)[ ref(result) += a6 ] 
-        >> (a7=map7)[ ref(result) += a7 ] 
-        >> (a8=map8)[ ref(result) += a8 ] 
-        >> (a9=map9)[ ref(result) += a9 ];
+           (a1=map1)[ xp::ref(result) += a1 ]
+        >> (a2=map2)[ xp::ref(result) += a2 ]
+        >> (a3=map3)[ xp::ref(result) += a3 ] 
+        >> (a4=map4)[ xp::ref(result) += a4 ] 
+        >> (a5=map5)[ xp::ref(result) += a5 ] 
+        >> (a6=map6)[ xp::ref(result) += a6 ] 
+        >> (a7=map7)[ xp::ref(result) += a7 ] 
+        >> (a8=map8)[ xp::ref(result) += a8 ] 
+        >> (a9=map9)[ xp::ref(result) += a9 ];
 
     if(!regex_match(str, rx))
     {
@@ -208,9 +211,9 @@
     map1["b"] = "3";
     map1["B"] = "4";
     std::string str("a A b B a A b B");
-    sregex rx = icase(a1= map1) [ ref(result) = a1 ] 
-        >> repeat<3>( (' ' >> icase(a1= map1) [ ref(result) += ',', 
ref(result) += a1 ]) )
-        >> repeat<4>( (' ' >>      (a1= map1) [ ref(result) += ',', 
ref(result) += a1 ]) );
+    sregex rx = icase(a1= map1) [ xp::ref(result) = a1 ] 
+        >> repeat<3>( (' ' >> icase(a1= map1) [ xp::ref(result) += ',', 
xp::ref(result) += a1 ]) )
+        >> repeat<4>( (' ' >>      (a1= map1) [ xp::ref(result) += ',', 
xp::ref(result) += a1 ]) );
     if(!regex_match(str, rx))
     {
         BOOST_ERROR("oops");
@@ -236,7 +239,7 @@
     map2["c"] = "3";
     map2["d"] = "4";
     std::string str("abcde");
-    sregex rx = *((a1= map1) | (a1= map2) | 'e') [ ref(result) += (a1 | "9") ];
+    sregex rx = *((a1= map1) | (a1= map2) | 'e') [ xp::ref(result) += (a1 | 
"9") ];
     if(!regex_match(str, rx))
     {
         BOOST_ERROR("oops");
@@ -255,6 +258,8 @@
     int population;
 };
 
+BOOST_TYPEOF_REGISTER_TYPE(City)
+
 ///////////////////////////////////////////////////////////////////////////////
 // test8
 //  test wide strings with structure result
@@ -267,20 +272,21 @@
         {L"New York", "The Big Apple", 16626000},
         {L"\u041c\u043E\u0441\u043A\u0432\u0430", "Moscow", 9299000}
     };
+    int const nbr_cities = sizeof(cities)/sizeof(*cities);
 
     std::map<std::wstring, City> map1;
-    BOOST_FOREACH(const City & c, cities)
+    for(int i=0; i<nbr_cities; ++i)
     {
-        map1[c.name] = c;
+        map1[cities[i].name] = cities[i];
     }
 
     std::wstring str(L"Chicago \u041c\u043E\u0441\u043A\u0432\u0430");
     City result1, result2;
     //int result1p;
     // ERROR "error C2039: 'population' : is not a member of 
'boost::proto::expr<Tag,Args>'    c:\boost\libs\xpressive\test\test_symbols.cpp 
  277"
-    //sregex rx = (a1= map1)[ ref(result1p) = a1.population ];
-    wsregex rx = (a1= map1)[ ref(result1) = a1 ] >> +_s
-        >> (a1= map1)[ ref(result2) = a1 ];
+    //sregex rx = (a1= map1)[ xp::ref(result1p) = a1.population ];
+    wsregex rx = (a1= map1)[ xp::ref(result1) = a1 ] >> +_s
+        >> (a1= map1)[ xp::ref(result2) = a1 ];
     if(!regex_match(str, rx))
     {
         BOOST_ERROR("oops");
@@ -310,7 +316,7 @@
     std::map<std::string,int> map1;
     map1["foo"] = 1;
     int xx = 0;
-    sregex rx = ~before((a1=map1)[ref(xx)=a1]) >> (s1=*_w)[ ref(result) = s1 ];
+    sregex rx = ~before((a1=map1)[xp::ref(xx)=a1]) >> (s1=*_w)[ 
xp::ref(result) = s1 ];
     if(!regex_match(str, rx))
     {
         BOOST_CHECK_EQUAL(result, "");


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to