2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2017-07-29 05:20:01 +00:00
|
|
|
Copyright (c) 2011-2017 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
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)
|
|
|
|
=============================================================================*/
|
2011-11-13 08:54:38 +00:00
|
|
|
#ifndef SPROUT_WEED_TRAITS_PARSER_IS_PARSER_HPP
|
|
|
|
#define SPROUT_WEED_TRAITS_PARSER_IS_PARSER_HPP
|
|
|
|
|
|
|
|
#include <type_traits>
|
|
|
|
#include <sprout/config.hpp>
|
2013-11-22 12:11:08 +00:00
|
|
|
#include <sprout/type_traits/integral_constant.hpp>
|
2011-11-13 08:54:38 +00:00
|
|
|
#include <sprout/weed/unused.hpp>
|
|
|
|
#include <sprout/weed/parser/parser_base.hpp>
|
|
|
|
#include <sprout/weed/traits/type/is_char_type.hpp>
|
|
|
|
#include <sprout/weed/traits/type/is_c_str.hpp>
|
|
|
|
#include <sprout/weed/traits/expr/is_expr.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
namespace weed {
|
|
|
|
namespace traits {
|
|
|
|
//
|
|
|
|
// is_parser
|
|
|
|
//
|
|
|
|
template<typename T, typename = void>
|
|
|
|
struct is_parser;
|
|
|
|
template<typename T>
|
|
|
|
struct is_parser<
|
|
|
|
T,
|
|
|
|
typename std::enable_if<
|
2012-11-30 18:00:46 +00:00
|
|
|
std::is_base_of<sprout::weed::parser_base, T>::value
|
|
|
|
&& !std::is_const<T>::value
|
2011-11-13 08:54:38 +00:00
|
|
|
>::type
|
|
|
|
>
|
2013-11-22 12:11:08 +00:00
|
|
|
: public sprout::true_type
|
2011-11-13 08:54:38 +00:00
|
|
|
{};
|
|
|
|
template<typename T>
|
|
|
|
struct is_parser<
|
|
|
|
T,
|
|
|
|
typename std::enable_if<
|
2012-11-30 18:00:46 +00:00
|
|
|
sprout::weed::traits::is_expr<T>::value
|
2011-11-13 08:54:38 +00:00
|
|
|
&& !std::is_const<T>::value
|
|
|
|
>::type
|
|
|
|
>
|
2013-11-22 12:11:08 +00:00
|
|
|
: public sprout::true_type
|
2011-11-13 08:54:38 +00:00
|
|
|
{};
|
|
|
|
template<typename T>
|
|
|
|
struct is_parser<
|
|
|
|
T,
|
|
|
|
typename std::enable_if<
|
2012-11-30 18:00:46 +00:00
|
|
|
sprout::weed::traits::is_char_type<T>::value
|
2011-11-13 08:54:38 +00:00
|
|
|
&& !std::is_const<T>::value
|
|
|
|
>::type
|
|
|
|
>
|
2013-11-22 12:11:08 +00:00
|
|
|
: public sprout::true_type
|
2011-11-13 08:54:38 +00:00
|
|
|
{};
|
|
|
|
template<typename T>
|
|
|
|
struct is_parser<
|
|
|
|
T,
|
|
|
|
typename std::enable_if<
|
2012-11-30 18:00:46 +00:00
|
|
|
sprout::weed::traits::is_c_str<T>::value
|
2013-03-25 03:43:47 +00:00
|
|
|
&& !std::is_const<T>::value
|
2011-11-13 08:54:38 +00:00
|
|
|
>::type
|
|
|
|
>
|
2013-11-22 12:11:08 +00:00
|
|
|
: public sprout::true_type
|
2011-11-13 08:54:38 +00:00
|
|
|
{};
|
|
|
|
template<typename T>
|
|
|
|
struct is_parser<
|
|
|
|
T,
|
|
|
|
typename std::enable_if<
|
2012-11-30 18:00:46 +00:00
|
|
|
std::is_const<T>::value
|
2011-11-13 08:54:38 +00:00
|
|
|
>::type
|
|
|
|
>
|
2012-11-30 18:00:46 +00:00
|
|
|
: public sprout::weed::traits::is_parser<
|
|
|
|
typename std::remove_const<T>::type
|
|
|
|
>
|
2011-11-13 08:54:38 +00:00
|
|
|
{};
|
|
|
|
} // namespace traits
|
|
|
|
} // namespace weed
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_WEED_TRAITS_PARSER_IS_PARSER_HPP
|