diff options
Diffstat (limited to 'boost/metaparse/v1/util')
-rw-r--r-- | boost/metaparse/v1/util/digit_to_int.hpp | 38 | ||||
-rw-r--r-- | boost/metaparse/v1/util/digit_to_int_c.hpp | 40 | ||||
-rw-r--r-- | boost/metaparse/v1/util/in_range.hpp | 75 | ||||
-rw-r--r-- | boost/metaparse/v1/util/in_range_c.hpp | 38 | ||||
-rw-r--r-- | boost/metaparse/v1/util/int_to_digit.hpp | 38 | ||||
-rw-r--r-- | boost/metaparse/v1/util/int_to_digit_c.hpp | 38 | ||||
-rw-r--r-- | boost/metaparse/v1/util/is_digit.hpp | 38 | ||||
-rw-r--r-- | boost/metaparse/v1/util/is_lcase_letter.hpp | 38 | ||||
-rw-r--r-- | boost/metaparse/v1/util/is_letter.hpp | 44 | ||||
-rw-r--r-- | boost/metaparse/v1/util/is_ucase_letter.hpp | 38 | ||||
-rw-r--r-- | boost/metaparse/v1/util/is_whitespace.hpp | 38 | ||||
-rw-r--r-- | boost/metaparse/v1/util/is_whitespace_c.hpp | 32 |
12 files changed, 495 insertions, 0 deletions
diff --git a/boost/metaparse/v1/util/digit_to_int.hpp b/boost/metaparse/v1/util/digit_to_int.hpp new file mode 100644 index 0000000000..5ec885bbd1 --- /dev/null +++ b/boost/metaparse/v1/util/digit_to_int.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_HPP +#define BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. +// 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) + +#include <boost/metaparse/v1/util/digit_to_int_c.hpp> + +#include <boost/mpl/vector.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <class D = boost::mpl::na> + struct digit_to_int : digit_to_int_c<D::type::value> {}; + + template <> + struct digit_to_int<boost::mpl::na> + { + typedef digit_to_int type; + + template <class D = boost::mpl::na> + struct apply : digit_to_int<D> {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/digit_to_int_c.hpp b/boost/metaparse/v1/util/digit_to_int_c.hpp new file mode 100644 index 0000000000..51cc13d915 --- /dev/null +++ b/boost/metaparse/v1/util/digit_to_int_c.hpp @@ -0,0 +1,40 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_C_HPP +#define BOOST_METAPARSE_V1_UTIL_DIGIT_TO_INT_C_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. +// 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) + +#include <boost/metaparse/v1/error/digit_expected.hpp> + +#include <boost/mpl/int.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <char C> + struct digit_to_int_c : error::digit_expected {}; + + template <> struct digit_to_int_c<'0'> : boost::mpl::int_<0> {}; + template <> struct digit_to_int_c<'1'> : boost::mpl::int_<1> {}; + template <> struct digit_to_int_c<'2'> : boost::mpl::int_<2> {}; + template <> struct digit_to_int_c<'3'> : boost::mpl::int_<3> {}; + template <> struct digit_to_int_c<'4'> : boost::mpl::int_<4> {}; + template <> struct digit_to_int_c<'5'> : boost::mpl::int_<5> {}; + template <> struct digit_to_int_c<'6'> : boost::mpl::int_<6> {}; + template <> struct digit_to_int_c<'7'> : boost::mpl::int_<7> {}; + template <> struct digit_to_int_c<'8'> : boost::mpl::int_<8> {}; + template <> struct digit_to_int_c<'9'> : boost::mpl::int_<9> {}; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/in_range.hpp b/boost/metaparse/v1/util/in_range.hpp new file mode 100644 index 0000000000..a4baba073c --- /dev/null +++ b/boost/metaparse/v1/util/in_range.hpp @@ -0,0 +1,75 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_IN_RANGE_HPP +#define BOOST_METAPARSE_V1_UTIL_IN_RANGE_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. +// 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) + +#include <boost/mpl/less_equal.hpp> +#include <boost/mpl/comparison.hpp> +#include <boost/mpl/quote.hpp> +#include <boost/mpl/bool.hpp> + +#include <boost/mpl/vector.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template < + class LowerBound = boost::mpl::na, + class UpperBound = boost::mpl::na, + class Item = boost::mpl::na + > + struct in_range : + boost::mpl::bool_< + boost::mpl::less_equal<LowerBound, Item>::type::value + && boost::mpl::less_equal<Item, UpperBound>::type::value + > + {}; + + template <class LowerBound, class UpperBound> + struct in_range<LowerBound, UpperBound, boost::mpl::na> + { + typedef in_range type; + + template <class Item = boost::mpl::na> + struct apply : in_range<LowerBound, UpperBound, Item> {}; + }; + + template <class LowerBound> + struct in_range<LowerBound, boost::mpl::na, boost::mpl::na> + { + typedef in_range type; + + template < + class UpperBound = boost::mpl::na, + class Item = boost::mpl::na + > + struct apply : in_range<LowerBound, UpperBound, Item> {}; + }; + + template <> + struct in_range<boost::mpl::na, boost::mpl::na, boost::mpl::na> + { + typedef in_range type; + + template < + class LowerBound = boost::mpl::na, + class UpperBound = boost::mpl::na, + class Item = boost::mpl::na + > + struct apply : in_range<LowerBound, UpperBound, Item> {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/in_range_c.hpp b/boost/metaparse/v1/util/in_range_c.hpp new file mode 100644 index 0000000000..21fde89871 --- /dev/null +++ b/boost/metaparse/v1/util/in_range_c.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_IN_RANGE_C_HPP +#define BOOST_METAPARSE_V1_UTIL_IN_RANGE_C_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. +// 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) + +#include <boost/mpl/bool.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <class T, T LowerBound, T UpperBound> + struct in_range_c + { + typedef in_range_c type; + + template <class Item> + struct apply : + boost::mpl::bool_<( + LowerBound <= Item::type::value + && Item::type::value <= UpperBound + )> + {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/int_to_digit.hpp b/boost/metaparse/v1/util/int_to_digit.hpp new file mode 100644 index 0000000000..0e093e9de3 --- /dev/null +++ b/boost/metaparse/v1/util/int_to_digit.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_INT_TO_DIGIT_HPP +#define BOOST_METAPARSE_V1_UTIL_INT_TO_DIGIT_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2012. +// 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) + +#include <boost/metaparse/v1/util/int_to_digit_c.hpp> + +#include <boost/mpl/vector.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <class N = boost::mpl::na> + struct int_to_digit : int_to_digit_c<N::type::value> {}; + + template <> + struct int_to_digit<boost::mpl::na> + { + typedef int_to_digit type; + + template <class N = boost::mpl::na> + struct apply : int_to_digit<N> {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/int_to_digit_c.hpp b/boost/metaparse/v1/util/int_to_digit_c.hpp new file mode 100644 index 0000000000..2742e330b6 --- /dev/null +++ b/boost/metaparse/v1/util/int_to_digit_c.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_INT_TO_DIGIT_C_HPP +#define BOOST_METAPARSE_V1_UTIL_INT_TO_DIGIT_C_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. +// 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) + +#include <boost/mpl/char.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <int N> + struct int_to_digit_c; + + template <> struct int_to_digit_c<0> : boost::mpl::char_<'0'> {}; + template <> struct int_to_digit_c<1> : boost::mpl::char_<'1'> {}; + template <> struct int_to_digit_c<2> : boost::mpl::char_<'2'> {}; + template <> struct int_to_digit_c<3> : boost::mpl::char_<'3'> {}; + template <> struct int_to_digit_c<4> : boost::mpl::char_<'4'> {}; + template <> struct int_to_digit_c<5> : boost::mpl::char_<'5'> {}; + template <> struct int_to_digit_c<6> : boost::mpl::char_<'6'> {}; + template <> struct int_to_digit_c<7> : boost::mpl::char_<'7'> {}; + template <> struct int_to_digit_c<8> : boost::mpl::char_<'8'> {}; + template <> struct int_to_digit_c<9> : boost::mpl::char_<'9'> {}; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/is_digit.hpp b/boost/metaparse/v1/util/is_digit.hpp new file mode 100644 index 0000000000..ccc9b456f0 --- /dev/null +++ b/boost/metaparse/v1/util/is_digit.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_IS_DIGIT_HPP +#define BOOST_METAPARSE_V1_UTIL_IS_DIGIT_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. +// 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) + +#include <boost/metaparse/v1/util/in_range_c.hpp> + +#include <boost/mpl/vector.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <class C = boost::mpl::na> + struct is_digit : in_range_c<char, '0', '9'>::apply<C> {}; + + template <> + struct is_digit<boost::mpl::na> + { + typedef is_digit type; + + template <class C = boost::mpl::na> + struct apply : is_digit<C> {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/is_lcase_letter.hpp b/boost/metaparse/v1/util/is_lcase_letter.hpp new file mode 100644 index 0000000000..9c05b48208 --- /dev/null +++ b/boost/metaparse/v1/util/is_lcase_letter.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_IS_LCASE_LETTER_HPP +#define BOOST_METAPARSE_V1_UTIL_IS_LCASE_LETTER_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. +// 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) + +#include <boost/metaparse/v1/util/in_range_c.hpp> + +#include <boost/mpl/vector.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <class C = boost::mpl::na> + struct is_lcase_letter : in_range_c<char, 'a', 'z'>::apply<C> {}; + + template <> + struct is_lcase_letter<boost::mpl::na> + { + typedef is_lcase_letter type; + + template <class C = boost::mpl::na> + struct apply : is_lcase_letter<C> {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/is_letter.hpp b/boost/metaparse/v1/util/is_letter.hpp new file mode 100644 index 0000000000..a3bc3114a7 --- /dev/null +++ b/boost/metaparse/v1/util/is_letter.hpp @@ -0,0 +1,44 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_IS_LETTER_HPP +#define BOOST_METAPARSE_V1_UTIL_IS_LETTER_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. +// 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) + +#include <boost/metaparse/v1/util/is_ucase_letter.hpp> +#include <boost/metaparse/v1/util/is_lcase_letter.hpp> + +#include <boost/mpl/bool.hpp> +#include <boost/mpl/vector.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <class C = boost::mpl::na> + struct is_letter : + boost::mpl::bool_< + is_lcase_letter<C>::type::value || is_ucase_letter<C>::type::value + > + {}; + + template <> + struct is_letter<boost::mpl::na> + { + typedef is_letter type; + + template <class C = boost::mpl::na> + struct apply : is_letter<C> {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/is_ucase_letter.hpp b/boost/metaparse/v1/util/is_ucase_letter.hpp new file mode 100644 index 0000000000..37926b6075 --- /dev/null +++ b/boost/metaparse/v1/util/is_ucase_letter.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_IS_UCASE_LETTER_HPP +#define BOOST_METAPARSE_V1_UTIL_IS_UCASE_LETTER_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. +// 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) + +#include <boost/metaparse/v1/util/in_range_c.hpp> + +#include <boost/mpl/vector.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <class C = boost::mpl::na> + struct is_ucase_letter : in_range_c<char, 'A', 'Z'>::apply<C> {}; + + template <> + struct is_ucase_letter<boost::mpl::na> + { + typedef is_ucase_letter type; + + template <class C = boost::mpl::na> + struct apply : is_ucase_letter<C> {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/is_whitespace.hpp b/boost/metaparse/v1/util/is_whitespace.hpp new file mode 100644 index 0000000000..93940fd8fb --- /dev/null +++ b/boost/metaparse/v1/util/is_whitespace.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_IS_WHITESPACE_HPP +#define BOOST_METAPARSE_V1_UTIL_IS_WHITESPACE_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. +// 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) + +#include <boost/metaparse/v1/util/is_whitespace_c.hpp> + +#include <boost/mpl/vector.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <class C = boost::mpl::na> + struct is_whitespace : is_whitespace_c<C::type::value> {}; + + template <> + struct is_whitespace<boost::mpl::na> + { + typedef is_whitespace type; + + template <class C = boost::mpl::na> + struct apply : is_whitespace<C> {}; + }; + } + } + } +} + +#endif + diff --git a/boost/metaparse/v1/util/is_whitespace_c.hpp b/boost/metaparse/v1/util/is_whitespace_c.hpp new file mode 100644 index 0000000000..b37ab7cbc6 --- /dev/null +++ b/boost/metaparse/v1/util/is_whitespace_c.hpp @@ -0,0 +1,32 @@ +#ifndef BOOST_METAPARSE_V1_UTIL_IS_WHITESPACE_C_HPP +#define BOOST_METAPARSE_V1_UTIL_IS_WHITESPACE_C_HPP + +// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. +// 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) + +#include <boost/mpl/bool.hpp> + +namespace boost +{ + namespace metaparse + { + namespace v1 + { + namespace util + { + template <char C> + struct is_whitespace_c : boost::mpl::false_ {}; + + template <> struct is_whitespace_c<' '> : boost::mpl::true_ {}; + template <> struct is_whitespace_c<'\r'> : boost::mpl::true_ {}; + template <> struct is_whitespace_c<'\n'> : boost::mpl::true_ {}; + template <> struct is_whitespace_c<'\t'> : boost::mpl::true_ {}; + } + } + } +} + +#endif + |