annotate DEPENDENCIES/generic/include/boost/xpressive/detail/core/quant_style.hpp @ 90:1710ac3f246f

Full path for Vamp SDK
author Chris Cannam
date Tue, 14 Apr 2015 11:18:54 +0100
parents 2665513ce2d3
children c530137014c0
rev   line source
Chris@16 1 ///////////////////////////////////////////////////////////////////////////////
Chris@16 2 // quant_style.hpp
Chris@16 3 //
Chris@16 4 // Copyright 2008 Eric Niebler. Distributed under the Boost
Chris@16 5 // Software License, Version 1.0. (See accompanying file
Chris@16 6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7
Chris@16 8 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_QUANT_STYLE_HPP_EAN_10_04_2005
Chris@16 9 #define BOOST_XPRESSIVE_DETAIL_CORE_QUANT_STYLE_HPP_EAN_10_04_2005
Chris@16 10
Chris@16 11 // MS compatible compilers support #pragma once
Chris@16 12 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
Chris@16 13 # pragma once
Chris@16 14 #endif
Chris@16 15
Chris@16 16 #include <boost/config.hpp>
Chris@16 17 #include <boost/mpl/has_xxx.hpp>
Chris@16 18 #include <boost/xpressive/detail/utility/width.hpp>
Chris@16 19 #include <boost/xpressive/detail/detail_fwd.hpp>
Chris@16 20
Chris@16 21 namespace boost { namespace xpressive { namespace detail
Chris@16 22 {
Chris@16 23
Chris@16 24 BOOST_MPL_HAS_XXX_TRAIT_DEF(is_boost_xpressive_xpression_)
Chris@16 25
Chris@16 26 ///////////////////////////////////////////////////////////////////////////////
Chris@16 27 // is_xpr
Chris@16 28 //
Chris@16 29 template<typename Xpr>
Chris@16 30 struct is_xpr
Chris@16 31 : has_is_boost_xpressive_xpression_<Xpr>
Chris@16 32 {};
Chris@16 33
Chris@16 34 ///////////////////////////////////////////////////////////////////////////////
Chris@16 35 // quant_enum
Chris@16 36 //
Chris@16 37 enum quant_enum
Chris@16 38 {
Chris@16 39 quant_none,
Chris@16 40 quant_fixed_width,
Chris@16 41 quant_variable_width
Chris@16 42 };
Chris@16 43
Chris@16 44 ///////////////////////////////////////////////////////////////////////////////
Chris@16 45 // quant_style
Chris@16 46 //
Chris@16 47 template<quant_enum QuantStyle, std::size_t Width = unknown_width::value, bool Pure = true>
Chris@16 48 struct quant_style
Chris@16 49 {
Chris@16 50 typedef void is_boost_xpressive_xpression_;
Chris@16 51
Chris@16 52 // Which quantification strategy to use?
Chris@16 53 BOOST_STATIC_CONSTANT(int, quant = QuantStyle);
Chris@16 54
Chris@16 55 // how many characters this matcher consumes
Chris@16 56 BOOST_STATIC_CONSTANT(std::size_t, width = Width);
Chris@16 57
Chris@16 58 // whether this matcher has observable side-effects
Chris@16 59 BOOST_STATIC_CONSTANT(bool, pure = Pure);
Chris@16 60
Chris@16 61 static detail::width get_width()
Chris@16 62 {
Chris@16 63 return width;
Chris@16 64 }
Chris@16 65 };
Chris@16 66
Chris@16 67 #define BOOST_XPR_QUANT_STYLE(Style, Width, Pure) \
Chris@16 68 typedef void is_boost_xpressive_xpression_; \
Chris@16 69 BOOST_STATIC_CONSTANT(int, quant = Style); \
Chris@16 70 BOOST_STATIC_CONSTANT(std::size_t, width = Width); \
Chris@16 71 BOOST_STATIC_CONSTANT(bool, pure = Pure); \
Chris@16 72 static detail::width get_width() { return width; } \
Chris@16 73 /**/
Chris@16 74
Chris@16 75 // // Replace transmogrify stupidity with rebindable matchers/placeholders
Chris@16 76 //#define BOOST_XPR_IDENTITY_REBIND(TYPE) \/
Chris@16 77 // template<typename BidiIter, typename ICase, typename Traits> \/
Chris@16 78 // struct rebind \/
Chris@16 79 // { \/
Chris@16 80 // typedef TYPE type; \/
Chris@16 81 // }; \/
Chris@16 82 // /**/
Chris@16 83
Chris@16 84 ///////////////////////////////////////////////////////////////////////////////
Chris@16 85 // quant_style_none
Chris@16 86 // this sub-expression cannot be quantified
Chris@16 87 typedef quant_style<quant_none> quant_style_none;
Chris@16 88
Chris@16 89 ///////////////////////////////////////////////////////////////////////////////
Chris@16 90 // quant_style_fixed_unknown_width
Chris@16 91 // this sub-expression is fixed width for the purpose of quantification, but
Chris@16 92 // the width cannot be determined at compile time. An example would be the
Chris@16 93 // string_matcher or the mark_matcher.
Chris@16 94 typedef quant_style<quant_fixed_width> quant_style_fixed_unknown_width;
Chris@16 95
Chris@16 96 ///////////////////////////////////////////////////////////////////////////////
Chris@16 97 // quant_style_variable_width
Chris@16 98 // this sub-expression can match a variable number of characters
Chris@16 99 typedef quant_style<quant_variable_width> quant_style_variable_width;
Chris@16 100
Chris@16 101 ///////////////////////////////////////////////////////////////////////////////
Chris@16 102 // quant_style_fixed_width
Chris@16 103 // for when the sub-expression has a fixed width that is known at compile time
Chris@16 104 template<std::size_t Width>
Chris@16 105 struct quant_style_fixed_width
Chris@16 106 : quant_style<quant_fixed_width, Width>
Chris@16 107 {
Chris@16 108 };
Chris@16 109
Chris@16 110 ///////////////////////////////////////////////////////////////////////////////
Chris@16 111 // quant_style_assertion
Chris@16 112 // a zero-width assertion.
Chris@16 113 struct quant_style_assertion
Chris@16 114 : quant_style<quant_none, 0>
Chris@16 115 {
Chris@16 116 };
Chris@16 117
Chris@16 118 ///////////////////////////////////////////////////////////////////////////////
Chris@16 119 // quant_type
Chris@16 120 //
Chris@16 121 template<typename Matcher>
Chris@16 122 struct quant_type
Chris@16 123 : mpl::int_<Matcher::quant>
Chris@16 124 {
Chris@16 125 };
Chris@16 126
Chris@16 127 }}} // namespace boost::xpressive::detail
Chris@16 128
Chris@16 129 #endif