|
Boost-Commit : |
From: david_at_[hidden]
Date: 2008-01-29 11:43:51
Author: djenkins
Date: 2008-01-29 11:43:51 EST (Tue, 29 Jan 2008)
New Revision: 43013
URL: http://svn.boost.org/trac/boost/changeset/43013
Log:
update copyright and misc cleanup
Text files modified:
trunk/libs/xpressive/example/numbers.cpp | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
Modified: trunk/libs/xpressive/example/numbers.cpp
==============================================================================
--- trunk/libs/xpressive/example/numbers.cpp (original)
+++ trunk/libs/xpressive/example/numbers.cpp 2008-01-29 11:43:51 EST (Tue, 29 Jan 2008)
@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////
-// main.hpp
+// numbers.cpp
//
-// Copyright 2007 David Jenkins. Distributed under the Boost
+// Copyright 2008 David Jenkins. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -11,7 +11,7 @@
#endif
#include <iostream>
-#include <string>
+#include <string>
#include <map>
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/xpressive/xpressive.hpp>
@@ -34,20 +34,20 @@
using namespace boost::assign;
// initialize the maps for named numbers
- std::map< std::string, int > ones_map =
+ std::map< std::string, int > ones_map =
map_list_of("one",1)("two",2)("three",3)("four",4)("five",5)
("six",6)("seven",7)("eight",8)("nine",9);
- std::map< std::string, int > teens_map =
+ std::map< std::string, int > teens_map =
map_list_of("ten",10)("eleven",11)("twelve",12)("thirteen",13)
("fourteen",14)("fifteen",15)("sixteen",16)("seventeen",17)
("eighteen",18)("nineteen",19);
- std::map< std::string, int > tens_map =
+ std::map< std::string, int > tens_map =
map_list_of("twenty",20)("thirty",30)("fourty",40)
("fifty",50)("sixty",60)("seventy",70)("eighty",80)("ninety",90);
- std::map< std::string, int > specials_map =
+ std::map< std::string, int > specials_map =
map_list_of("zero",0)("dozen",12)("score",20);
// n is the integer result
@@ -70,7 +70,7 @@
( a1 = tens_map ) [ n += a1 ] >> delim
>> !ones_rx
)
- |
+ |
( ( a1 = teens_map ) [ n += a1 ] >> delim
);
@@ -78,10 +78,10 @@
( ( tens_rx >> "hundred" >> delim )
[ n *= 100 ]
>> !tens_rx
- )
+ )
| tens_rx;
- sregex thousands_rx =
+ sregex thousands_rx =
( ( hundreds_rx >> "thousand" >> delim )
[ temp += n * 1000, n = 0 ]
>> !hundreds_rx
@@ -89,7 +89,7 @@
| hundreds_rx
;
- sregex millions_rx =
+ sregex millions_rx =
( ( hundreds_rx >> "million" >> delim )
[ temp += n * 1000000, n = 0 ]
>> !thousands_rx
@@ -97,25 +97,25 @@
| thousands_rx;
// Note: this uses two attribues, a1 and a2, and it uses
- // a default attribute value of 1 for a1.
+ // a default attribute value of 1 for a1.
sregex specials_rx =
- ( !((a1 = ones_map) >> delim) >> (a2 = specials_map) )
- [ n = (a1 | 1) * a2 ]
+ ( !((a1 = ones_map) >> delim) >> (a2 = specials_map) )
+ [ n = (a1 | 1) * a2 ]
>> delim
>> !("and" >> +_s >> ones_rx);
- sregex number_rx =
- bow
- >>
+ sregex number_rx =
+ bow
+ >>
( specials_rx
- |
+ |
millions_rx
- [n += temp, temp = 0 ]
+ [n += temp, temp = 0 ]
);
// this is the input string
std::string str( "one two three eighteen twenty two "
- "nine hundred ninety nine twelve "
+ "nine hundred ninety nine twelve "
"eight hundred sixty three thousand ninety five "
"sixty five hundred ten "
"two million eight hundred sixty three thousand ninety five "
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