Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73540 - in sandbox/coerce: boost/coerce boost/coerce/detail boost/coerce/tag libs/coerce/example libs/coerce/test
From: vexocide_at_[hidden]
Date: 2011-08-04 19:08:41


Author: vexocide
Date: 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
New Revision: 73540
URL: http://svn.boost.org/trac/boost/changeset/73540

Log:
Moved tags into their own subdirectory
Added:
   sandbox/coerce/boost/coerce/detail/precision.hpp
      - copied, changed from r73397, /sandbox/coerce/boost/coerce/precision.hpp
   sandbox/coerce/boost/coerce/tag/
   sandbox/coerce/boost/coerce/tag/base.hpp (contents, props changed)
   sandbox/coerce/boost/coerce/tag/precision.hpp (contents, props changed)
Removed:
   sandbox/coerce/boost/coerce/precision.hpp
Text files modified:
   sandbox/coerce/boost/coerce/coerce.hpp | 5 -
   sandbox/coerce/boost/coerce/detail/precision.hpp | 10 +-
   sandbox/coerce/boost/coerce/detail/reserve.hpp | 1
   sandbox/coerce/boost/coerce/reserve.hpp | 30 +++--------
   sandbox/coerce/boost/coerce/tag.hpp | 102 +++------------------------------------
   sandbox/coerce/libs/coerce/example/tag.cpp | 1
   sandbox/coerce/libs/coerce/test/reserve.cpp | 1
   sandbox/coerce/libs/coerce/test/tag.cpp | 1
   8 files changed, 28 insertions(+), 123 deletions(-)

Modified: sandbox/coerce/boost/coerce/coerce.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/coerce.hpp (original)
+++ sandbox/coerce/boost/coerce/coerce.hpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -16,7 +16,6 @@
 #include <boost/coerce/string.hpp>
 #include <boost/coerce/tag.hpp>
 
-#include <boost/config.hpp>
 #include <boost/throw_exception.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/utility/enable_if.hpp>
@@ -51,7 +50,7 @@
 
         bool result = traits::as<
                 Target, Source, Tag
- >::BOOST_NESTED_TEMPLATE call<Target, Source, Tag>(
+ >::template call<Target, Source, Tag>(
                 target, source, tag);
 
         if (!result) {
@@ -79,7 +78,7 @@
 
         bool result = traits::as<
                 Target, Source, Tag
- >::BOOST_NESTED_TEMPLATE call<Target, Source, Tag>(
+ >::template call<Target, Source, Tag>(
                 target, source, tag);
 
         if (!result) {

Copied: sandbox/coerce/boost/coerce/detail/precision.hpp (from r73397, /sandbox/coerce/boost/coerce/precision.hpp)
==============================================================================
--- /sandbox/coerce/boost/coerce/precision.hpp (original)
+++ sandbox/coerce/boost/coerce/detail/precision.hpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -4,8 +4,8 @@
 // (See accompanying file ../../../LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_COERCE_PRECISION_HPP
-#define BOOST_COERCE_PRECISION_HPP
+#ifndef BOOST_COERCE_DETAIL_PRECISION_HPP
+#define BOOST_COERCE_DETAIL_PRECISION_HPP
 
 #ifdef _MSC_VER
 #pragma once
@@ -14,7 +14,7 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 
-namespace boost { namespace coerce { namespace traits {
+namespace boost { namespace coerce { namespace detail {
 
     template <typename T>
     struct precision {
@@ -40,6 +40,6 @@
                 : is_specialized_decimal ? precision_decimal : 6);
     };
 
-} } } // namespace boost::coerce::traits
+} } } // namespace boost::coerce::detail
 
-#endif // BOOST_COERCE_PRECISION_HPP
+#endif // BOOST_COERCE_DETAIL_PRECISION_HPP

Modified: sandbox/coerce/boost/coerce/detail/reserve.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/detail/reserve.hpp (original)
+++ sandbox/coerce/boost/coerce/detail/reserve.hpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -34,6 +34,7 @@
     public:
         BOOST_STATIC_CONSTANT(bool, value =
             sizeof(test<Sequence>(0)) == sizeof(type_traits::yes_type));
+
         typedef mpl::bool_<value> type;
     };
 

Deleted: sandbox/coerce/boost/coerce/precision.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/precision.hpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
+++ (empty file)
@@ -1,45 +0,0 @@
-// Copyright Jeroen Habraken 2011.
-//
-// 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)
-
-#ifndef BOOST_COERCE_PRECISION_HPP
-#define BOOST_COERCE_PRECISION_HPP
-
-#ifdef _MSC_VER
-#pragma once
-#endif
-
-#include <boost/config.hpp>
-#include <boost/limits.hpp>
-
-namespace boost { namespace coerce { namespace traits {
-
- template <typename T>
- struct precision {
- typedef std::numeric_limits<T> limits;
-
- BOOST_STATIC_CONSTANT(bool, is_specialized =
- limits::is_specialized && !limits::is_exact);
-
- BOOST_STATIC_CONSTANT(bool, is_specialized_binary =
- is_specialized && limits::radix == 2 && limits::digits > 0);
-
- BOOST_STATIC_CONSTANT(unsigned, precision_binary =
- 2UL + limits::digits * 30103UL / 100000UL);
-
- BOOST_STATIC_CONSTANT(bool, is_specialized_decimal =
- is_specialized && limits::radix == 10 && limits::digits10 > 0);
-
- BOOST_STATIC_CONSTANT(unsigned, precision_decimal =
- limits::digits10 + 1U);
-
- BOOST_STATIC_CONSTANT(unsigned, value =
- is_specialized_binary ? precision_binary
- : is_specialized_decimal ? precision_decimal : 6);
- };
-
-} } } // namespace boost::coerce::traits
-
-#endif // BOOST_COERCE_PRECISION_HPP

Modified: sandbox/coerce/boost/coerce/reserve.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/reserve.hpp (original)
+++ sandbox/coerce/boost/coerce/reserve.hpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -11,8 +11,8 @@
 #pragma once
 #endif
 
+#include <boost/coerce/detail/precision.hpp>
 #include <boost/coerce/detail/reserve.hpp>
-#include <boost/coerce/precision.hpp>
 #include <boost/coerce/tag.hpp>
 
 #include <boost/config.hpp>
@@ -29,23 +29,18 @@
         BOOST_STATIC_CONSTANT(std::size_t, value = 0);
     };
 
- template <>
- struct reserve_size_impl<char, tag::none> {
+ template <typename Tag>
+ struct reserve_size_impl<char, Tag> {
         BOOST_STATIC_CONSTANT(std::size_t, value = 1);
     };
 
- template <>
- struct reserve_size_impl<wchar_t, tag::none> {
+ template <typename Tag>
+ struct reserve_size_impl<wchar_t, Tag> {
         BOOST_STATIC_CONSTANT(std::size_t, value = 1);
     };
 
     template <typename T, typename Tag>
     struct reserve_size_impl_integral {
- BOOST_STATIC_CONSTANT(std::size_t, value = 0);
- };
-
- template <typename T>
- struct reserve_size_impl_integral<T, tag::none> {
         BOOST_STATIC_CONSTANT(std::size_t, value =
             std::numeric_limits<T>::is_signed +
             1 +
@@ -118,15 +113,10 @@
 
     template <typename T, typename Tag>
     struct reserve_size_impl_floating_point {
- BOOST_STATIC_CONSTANT(std::size_t, value = 0);
- };
-
- template <typename T>
- struct reserve_size_impl_floating_point<T, tag::none> {
         BOOST_STATIC_CONSTANT(std::size_t, value =
             std::numeric_limits<T>::is_signed +
             8 +
- precision<T>::value);
+ detail::precision<T>::value);
     };
 
     template <typename Tag>
@@ -141,8 +131,8 @@
     struct reserve_size_impl<long double, Tag>
         : reserve_size_impl_floating_point<long double, Tag> { };
 
- template <>
- struct reserve_size_impl<bool, tag::none> {
+ template <typename Tag>
+ struct reserve_size_impl<bool, Tag> {
         BOOST_STATIC_CONSTANT(std::size_t, value = 5);
     };
 
@@ -152,9 +142,7 @@
 
     template <typename T, typename Tag, typename Enable = void>
     struct reserve_size {
- typedef std::size_t type;
-
- static inline type
+ static inline std::size_t
         call(T const &, Tag const &) {
             return reserve_size_impl<T, Tag>::value;
         }

Modified: sandbox/coerce/boost/coerce/tag.hpp
==============================================================================
--- sandbox/coerce/boost/coerce/tag.hpp (original)
+++ sandbox/coerce/boost/coerce/tag.hpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -11,22 +11,12 @@
 #pragma once
 #endif
 
-#include <boost/coerce/precision.hpp>
+#include <boost/coerce/detail/precision.hpp>
 
-#include <boost/config.hpp>
 #include <boost/spirit/home/karma/auto.hpp>
-#include <boost/spirit/home/karma/numeric.hpp>
+#include <boost/spirit/home/karma/numeric/real.hpp>
+#include <boost/spirit/home/karma/numeric/real_policies.hpp>
 #include <boost/spirit/home/qi/auto.hpp>
-#include <boost/spirit/home/qi/directive/no_case.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/numeric/int.hpp>
-#include <boost/spirit/home/qi/numeric/uint.hpp>
-#include <boost/spirit/home/qi/operator/optional.hpp>
-#include <boost/spirit/home/qi/operator/sequence.hpp>
-#include <boost/spirit/home/qi/parser.hpp>
-#include <boost/spirit/home/qi/string/lit.hpp>
-#include <boost/spirit/home/support/meta_compiler.hpp>
-#include <boost/type_traits/is_signed.hpp>
 #include <boost/type_traits/remove_const.hpp>
 
 namespace boost { namespace coerce { namespace tag {
@@ -51,7 +41,7 @@
> {
             static inline unsigned
             precision(Source const &) {
- return traits::precision<Source>::value;
+ return detail::precision<Source>::value;
             }
         };
 
@@ -79,89 +69,13 @@
     };
 
     template <unsigned Radix>
- struct base {
-#ifdef BOOST_MSVC
-#pragma warning(push)
-#pragma warning(disable: 4348) // redefinition of default parameter : parameter 2
-#endif
- template <typename Target, bool U = is_signed<Target>::value>
- struct parser_base;
-#ifdef BOOST_MSVC
-#pragma warning(pop)
-#endif
+ struct base;
 
- template <typename Target>
- struct parser_base<Target, true>
- : spirit::qi::int_parser<Target, Radix> { };
-
- template <typename Target>
- struct parser_base<Target, false>
- : spirit::qi::uint_parser<Target, Radix> { };
+ struct bin;
 
- template <typename Iterator, typename Target, typename Source>
- struct parser
- : parser_base<Target> {
- parser(tag::base<Radix> const &) { }
- };
-
-#ifdef BOOST_MSVC
-#pragma warning(push)
-#pragma warning(disable: 4348) // redefinition of default parameter : parameter 2
-#endif
- template <typename Source, bool U = is_signed<Source>::value>
- struct generator_base;
-#ifdef BOOST_MSVC
-#pragma warning(pop)
-#endif
-
- template <typename Source>
- struct generator_base<Source, true>
- : spirit::karma::int_generator<Source, Radix> { };
-
- template <typename Source>
- struct generator_base<Source, false>
- : spirit::karma::uint_generator<Source, Radix> { };
+ struct oct;
     
- template <typename Iterator, typename Target, typename Source>
- struct generator
- : generator_base<Source> {
- generator(tag::base<Radix> const &) { }
- };
- };
-
- struct bin
- : base<2> { };
-
- struct oct
- : base<8> { };
-
- struct hex
- : base<16> {
- template <typename Iterator, typename Target, typename Source>
- struct parser
- : spirit::qi::parser<parser<Iterator, Target, Source> > {
- parser(tag::hex const &) { }
-
- template <typename Context, typename Iterator_>
- struct attribute {
- typedef Target type;
- };
-
- template <typename Context, typename Skipper>
- inline bool
- parse(
- Iterator & first,
- Iterator const & last,
- Context & context,
- Skipper const & skipper,
- Target & target
- ) const {
- return spirit::compile<spirit::qi::domain>(
- -spirit::standard::no_case_type()["0x"] >> parser_base<Target>()
- ).parse(first, last, context, skipper, target);
- }
- };
- };
+ struct hex;
 
 } } } // namespace boost::coerce::tag
 

Added: sandbox/coerce/boost/coerce/tag/base.hpp
==============================================================================
--- (empty file)
+++ sandbox/coerce/boost/coerce/tag/base.hpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -0,0 +1,124 @@
+// Copyright Jeroen Habraken 2011.
+//
+// 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)
+
+#ifndef BOOST_COERCE_TAG_BASE_HPP
+#define BOOST_COERCE_TAG_BASE_HPP
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+
+#include <boost/config.hpp>
+#include <boost/spirit/home/karma/numeric/int.hpp>
+#include <boost/spirit/home/karma/numeric/uint.hpp>
+#include <boost/spirit/home/qi/directive/no_case.hpp>
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/numeric/int.hpp>
+#include <boost/spirit/home/qi/numeric/uint.hpp>
+#include <boost/spirit/home/qi/operator/optional.hpp>
+#include <boost/spirit/home/qi/operator/sequence.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/string/lit.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_signed.hpp>
+
+namespace boost { namespace coerce { namespace tag {
+
+ template <unsigned Radix>
+ struct base {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable: 4348) // redefinition of default parameter : parameter 2
+#endif
+ template <typename Target, bool U = is_signed<Target>::value>
+ struct parser_base;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+ template <typename Target>
+ struct parser_base<Target, true>
+ : spirit::qi::int_parser<Target, Radix> { };
+
+ template <typename Target>
+ struct parser_base<Target, false>
+ : spirit::qi::uint_parser<Target, Radix> { };
+
+ template <typename Iterator, typename Target, typename Source>
+ struct parser
+ : parser_base<Target> {
+ parser(tag::base<Radix> const &) {
+ BOOST_STATIC_ASSERT(is_integral<Target>::value);
+ }
+ };
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable: 4348) // redefinition of default parameter : parameter 2
+#endif
+ template <typename Source, bool U = is_signed<Source>::value>
+ struct generator_base;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+ template <typename Source>
+ struct generator_base<Source, true>
+ : spirit::karma::int_generator<Source, Radix> { };
+
+ template <typename Source>
+ struct generator_base<Source, false>
+ : spirit::karma::uint_generator<Source, Radix> { };
+
+ template <typename Iterator, typename Target, typename Source>
+ struct generator
+ : generator_base<Source> {
+ generator(tag::base<Radix> const &) {
+ BOOST_STATIC_ASSERT(is_integral<Source>::value);
+ }
+ };
+ };
+
+ struct bin
+ : base<2> { };
+
+ struct oct
+ : base<8> { };
+
+ struct hex
+ : base<16> {
+ template <typename Iterator, typename Target, typename Source>
+ struct parser
+ : spirit::qi::parser<parser<Iterator, Target, Source> > {
+ parser(tag::hex const &) { }
+
+ template <typename Context, typename Iterator_>
+ struct attribute {
+ typedef Target type;
+ };
+
+ template <typename Context, typename Skipper>
+ inline bool
+ parse(
+ Iterator & first,
+ Iterator const & last,
+ Context & context,
+ Skipper const & skipper,
+ Target & target
+ ) const {
+ BOOST_STATIC_ASSERT(is_integral<Target>::value);
+
+ return spirit::compile<spirit::qi::domain>(
+ -spirit::standard::no_case_type()["0x"] >> parser_base<Target>()
+ ).parse(first, last, context, skipper, target);
+ }
+ };
+ };
+
+} } } // namespace boost::coerce::tag
+
+#endif // BOOST_COERCE_TAG_HPP

Added: sandbox/coerce/boost/coerce/tag/precision.hpp
==============================================================================
--- (empty file)
+++ sandbox/coerce/boost/coerce/tag/precision.hpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -0,0 +1,64 @@
+// Copyright Jeroen Habraken 2011.
+//
+// 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)
+
+#ifndef BOOST_COERCE_TAG_PRECISION_HPP
+#define BOOST_COERCE_TAG_PRECISION_HPP
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/numeric/real.hpp>
+#include <boost/spirit/home/karma/numeric/real_policies.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_floating_point.hpp>
+#include <boost/type_traits/remove_const.hpp>
+
+namespace boost { namespace coerce { namespace tag {
+
+ struct precision {
+ precision(unsigned const & value)
+ : value(value) { }
+
+ template <typename Iterator, typename Target, typename Source>
+ struct parser {
+ BOOST_STATIC_ASSERT(sizeof(Iterator) == 0);
+ };
+
+ template <typename Source>
+ struct real_policies
+ : spirit::karma::real_policies<
+ typename remove_const<Source>::type
+ > {
+ real_policies(unsigned const & value)
+ : value(value) { }
+
+ inline unsigned
+ precision(Source const &) const {
+ return value;
+ }
+
+ unsigned value;
+ };
+
+ template <typename Iterator, typename Target, typename Source>
+ struct generator
+ : spirit::karma::real_generator<Source, real_policies<Source> > {
+ generator(tag::precision const & tag)
+ : spirit::karma::real_generator<
+ Source, real_policies<Source>
+ >(real_policies<Source>(tag.value))
+ {
+ BOOST_STATIC_ASSERT(is_floating_point<Source>::value);
+ }
+ };
+
+ unsigned value;
+ };
+
+} } } // namespace boost::coerce::tag
+
+#endif // BOOST_COERCE_TAG_PRECISION_HPP

Modified: sandbox/coerce/libs/coerce/example/tag.cpp
==============================================================================
--- sandbox/coerce/libs/coerce/example/tag.cpp (original)
+++ sandbox/coerce/libs/coerce/example/tag.cpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -7,6 +7,7 @@
 #define BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
 
 #include <boost/coerce.hpp>
+#include <boost/coerce/tag/base.hpp>
 
 #include <iostream>
 #include <string>

Modified: sandbox/coerce/libs/coerce/test/reserve.cpp
==============================================================================
--- sandbox/coerce/libs/coerce/test/reserve.cpp (original)
+++ sandbox/coerce/libs/coerce/test/reserve.cpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -9,6 +9,7 @@
 #define BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
 
 #include <boost/coerce.hpp>
+#include <boost/coerce/tag/base.hpp>
 #include <boost/optional.hpp>
 #include <boost/test/unit_test.hpp>
 

Modified: sandbox/coerce/libs/coerce/test/tag.cpp
==============================================================================
--- sandbox/coerce/libs/coerce/test/tag.cpp (original)
+++ sandbox/coerce/libs/coerce/test/tag.cpp 2011-08-04 19:08:40 EDT (Thu, 04 Aug 2011)
@@ -9,6 +9,7 @@
 #define BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
 
 #include <boost/coerce.hpp>
+#include <boost/coerce/tag/base.hpp>
 #include <boost/mpl/for_each.hpp>
 #include <boost/mpl/vector.hpp>
 #include <boost/test/unit_test.hpp>


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