/usr/include/boost/spirit/home/qi/char
Edit: /usr/include/boost/spirit/home/qi/char/char_class.hpp (4473B)
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
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)
==============================================================================*/
#if !defined(BOOST_SPIRIT_CHAR_CLASS_APRIL_16_2006_1051AM)
#define BOOST_SPIRIT_CHAR_CLASS_APRIL_16_2006_1051AM
#if defined(_MSC_VER)
#pragma once
#endif
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace spirit
{
///////////////////////////////////////////////////////////////////////////
// Enablers
///////////////////////////////////////////////////////////////////////////
// enables alnum, alpha, graph, etc.
template
struct use_terminal >
: mpl::true_ {};
}}
namespace boost { namespace spirit { namespace qi
{
// hoist the char classification namespaces into qi sub-namespaces of the
// same name
namespace ascii { using namespace boost::spirit::ascii; }
namespace iso8859_1 { using namespace boost::spirit::iso8859_1; }
namespace standard { using namespace boost::spirit::standard; }
namespace standard_wide { using namespace boost::spirit::standard_wide; }
#if defined(BOOST_SPIRIT_UNICODE)
namespace unicode { using namespace boost::spirit::unicode; }
#endif
// Import the standard namespace into the qi namespace. This allows
// for default handling of all character/string related operations if not
// prefixed with a character set namespace.
using namespace boost::spirit::standard;
// Import encoding
using spirit::encoding;
///////////////////////////////////////////////////////////////////////////
// Generic char classification parser (for alnum, alpha, graph, etc.)
///////////////////////////////////////////////////////////////////////////
template
struct char_class
: char_parser, typename Tag::char_encoding::char_type>
{
typedef typename Tag::char_encoding char_encoding;
typedef typename Tag::char_class classification;
template
bool test(CharParam ch, Context&) const
{
using spirit::char_class::classify;
return traits::ischar::call(ch) &&
classify::is(classification(), ch);
}
template
info what(Context& /*context*/) const
{
typedef spirit::char_class::what what_;
return info(what_::is(classification()));
}
};
namespace detail
{
template
struct make_char_class : mpl::identity {};
template <>
struct make_char_class : mpl::identity {};
template <>
struct make_char_class : mpl::identity {};
}
///////////////////////////////////////////////////////////////////////////
// Parser generators: make_xxx function (objects)
///////////////////////////////////////////////////////////////////////////
template
struct make_primitive, Modifiers>
{
static bool const no_case =
has_modifier >::value;
typedef typename
spirit::detail::get_encoding::type
char_encoding;
typedef tag::char_code<
typename detail::make_char_class::type
, char_encoding>
tag;
typedef char_class result_type;
result_type operator()(unused_type, unused_type) const
{
return result_type();
}
};
}}}
#endif