]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/spirit/example/qi/german_floating_point.cpp
1 // Copyright (c) 2001-2011 Hartmut Kaiser
2 // Copyright (c) 2011 Michael Caisse
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/spirit/include/qi.hpp>
9 namespace qi
= boost::spirit::qi
;
12 struct german_real_policies
: qi::real_policies
<T
>
14 template <typename Iterator
>
15 static bool parse_dot(Iterator
& first
, Iterator
const& last
)
17 if (first
== last
|| *first
!= ',')
24 qi::real_parser
<double, german_real_policies
<double> > const german_double
;
26 ///////////////////////////////////////////////////////////////////////////////
29 std::string
input("123,456");
30 std::string::iterator begin
= input
.begin();
31 std::string::iterator end
= input
.end();
34 if (!qi::parse(begin
, end
, german_double
, value
))
36 std::cout
<< "-------------------------------- \n";
37 std::cout
<< "Parsing failed\n";
38 std::cout
<< "-------------------------------- \n";
42 std::cout
<< "-------------------------------- \n";
43 std::cout
<< "Parsing succeeded, got: " << value
<< "\n";
44 std::cout
<< "---------------------------------\n";