annotate DEPENDENCIES/generic/include/boost/spirit/home/karma/generator.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright (c) 2001-2011 Hartmut Kaiser
Chris@16 2 // Copyright (c) 2001-2011 Joel de Guzman
Chris@16 3 //
Chris@16 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6
Chris@16 7 #if !defined(BOOST_SPIRIT_GENERATOR_JANUARY_13_2009_1002AM)
Chris@16 8 #define BOOST_SPIRIT_GENERATOR_JANUARY_13_2009_1002AM
Chris@16 9
Chris@16 10 #if defined(_MSC_VER)
Chris@16 11 #pragma once
Chris@16 12 #endif
Chris@16 13
Chris@16 14 #include <boost/mpl/has_xxx.hpp>
Chris@16 15 #include <boost/mpl/int.hpp>
Chris@16 16 #include <boost/spirit/home/karma/domain.hpp>
Chris@16 17
Chris@16 18 namespace boost { namespace spirit { namespace karma
Chris@16 19 {
Chris@16 20 struct generator_properties
Chris@16 21 {
Chris@16 22 enum enum_type {
Chris@16 23 no_properties = 0,
Chris@16 24 buffering = 0x01, // generator requires buffering
Chris@16 25 counting = 0x02, // generator requires counting
Chris@16 26 tracking = 0x04, // generator requires position tracking
Chris@16 27 disabling = 0x08, // generator requires disabling of output
Chris@16 28
Chris@16 29 countingbuffer = 0x03, // buffering | counting
Chris@16 30 all_properties = 0x0f // buffering | counting | tracking | disabling
Chris@16 31 };
Chris@16 32 };
Chris@16 33
Chris@16 34 template <typename Derived>
Chris@16 35 struct generator
Chris@16 36 {
Chris@16 37 struct generator_id;
Chris@16 38 typedef mpl::int_<generator_properties::no_properties> properties;
Chris@16 39 typedef Derived derived_type;
Chris@16 40 typedef karma::domain domain;
Chris@16 41
Chris@16 42 // Requirement: g.generate(o, context, delimiter, attr) -> bool
Chris@16 43 //
Chris@16 44 // g: a generator
Chris@16 45 // o: output iterator
Chris@16 46 // context: enclosing rule context (can be unused_type)
Chris@16 47 // delimit: delimiter (can be unused_type)
Chris@16 48 // attr: attribute (can be unused_type)
Chris@16 49
Chris@16 50 // Requirement: g.what(context) -> info
Chris@16 51 //
Chris@16 52 // g: a generator
Chris@16 53 // context: enclosing rule context (can be unused_type)
Chris@16 54
Chris@16 55 // Requirement: G::template attribute<Ctx, Iter>::type
Chris@16 56 //
Chris@16 57 // G: a generator type
Chris@16 58 // Ctx: A context type (can be unused_type)
Chris@16 59 // Iter: An iterator type (always unused_type)
Chris@16 60
Chris@16 61 Derived const& derived() const
Chris@16 62 {
Chris@16 63 return *static_cast<Derived const*>(this);
Chris@16 64 }
Chris@16 65 };
Chris@16 66
Chris@16 67 template <typename Derived>
Chris@16 68 struct primitive_generator : generator<Derived>
Chris@16 69 {
Chris@16 70 struct primitive_generator_id;
Chris@16 71 };
Chris@16 72
Chris@16 73 template <typename Derived>
Chris@16 74 struct nary_generator : generator<Derived>
Chris@16 75 {
Chris@16 76 struct nary_generator_id;
Chris@16 77
Chris@16 78 // Requirement: g.elements -> fusion sequence
Chris@16 79 //
Chris@16 80 // g: a composite generator
Chris@16 81
Chris@16 82 // Requirement: G::elements_type -> fusion sequence
Chris@16 83 //
Chris@16 84 // G: a composite generator type
Chris@16 85 };
Chris@16 86
Chris@16 87 template <typename Derived>
Chris@16 88 struct unary_generator : generator<Derived>
Chris@16 89 {
Chris@16 90 struct unary_generator_id;
Chris@16 91
Chris@16 92 // Requirement: g.subject -> subject generator
Chris@16 93 //
Chris@16 94 // g: a unary generator
Chris@16 95
Chris@16 96 // Requirement: G::subject_type -> subject generator type
Chris@16 97 //
Chris@16 98 // G: a unary generator type
Chris@16 99 };
Chris@16 100
Chris@16 101 template <typename Derived>
Chris@16 102 struct binary_generator : generator<Derived>
Chris@16 103 {
Chris@16 104 struct binary_generator_id;
Chris@16 105
Chris@16 106 // Requirement: g.left -> left generator
Chris@16 107 //
Chris@16 108 // g: a binary generator
Chris@16 109
Chris@16 110 // Requirement: G::left_type -> left generator type
Chris@16 111 //
Chris@16 112 // G: a binary generator type
Chris@16 113
Chris@16 114 // Requirement: g.right -> right generator
Chris@16 115 //
Chris@16 116 // g: a binary generator
Chris@16 117
Chris@16 118 // Requirement: G::right_type -> right generator type
Chris@16 119 //
Chris@16 120 // G: a binary generator type
Chris@16 121 };
Chris@16 122
Chris@16 123 }}}
Chris@16 124
Chris@16 125 namespace boost { namespace spirit { namespace traits // classification
Chris@16 126 {
Chris@16 127 namespace detail
Chris@16 128 {
Chris@16 129 // generator tags
Chris@16 130 BOOST_MPL_HAS_XXX_TRAIT_DEF(generator_id)
Chris@16 131 BOOST_MPL_HAS_XXX_TRAIT_DEF(primitive_generator_id)
Chris@16 132 BOOST_MPL_HAS_XXX_TRAIT_DEF(nary_generator_id)
Chris@16 133 BOOST_MPL_HAS_XXX_TRAIT_DEF(unary_generator_id)
Chris@16 134 BOOST_MPL_HAS_XXX_TRAIT_DEF(binary_generator_id)
Chris@16 135 }
Chris@16 136
Chris@16 137 // check for generator tags
Chris@16 138 template <typename T>
Chris@16 139 struct is_generator : detail::has_generator_id<T> {};
Chris@16 140
Chris@16 141 template <typename T>
Chris@16 142 struct is_primitive_generator : detail::has_primitive_generator_id<T> {};
Chris@16 143
Chris@16 144 template <typename T>
Chris@16 145 struct is_nary_generator : detail::has_nary_generator_id<T> {};
Chris@16 146
Chris@16 147 template <typename T>
Chris@16 148 struct is_unary_generator : detail::has_unary_generator_id<T> {};
Chris@16 149
Chris@16 150 template <typename T>
Chris@16 151 struct is_binary_generator : detail::has_binary_generator_id<T> {};
Chris@16 152
Chris@16 153 // check for generator properties
Chris@16 154 template <typename T>
Chris@16 155 struct properties_of : T::properties {};
Chris@16 156
Chris@16 157 }}}
Chris@16 158
Chris@16 159 #endif