diff options
Diffstat (limited to 'boost/wave/cpp_iteration_context.hpp')
-rw-r--r-- | boost/wave/cpp_iteration_context.hpp | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/boost/wave/cpp_iteration_context.hpp b/boost/wave/cpp_iteration_context.hpp index bf9f734cdb..78c5590ce4 100644 --- a/boost/wave/cpp_iteration_context.hpp +++ b/boost/wave/cpp_iteration_context.hpp @@ -1,10 +1,10 @@ /*============================================================================= Boost.Wave: A Standard compliant C++ preprocessor library Definition of the preprocessor context - + http://www.boost.org/ - Copyright (c) 2001-2011 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2012 Hartmut Kaiser. 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) =============================================================================*/ @@ -22,7 +22,7 @@ #include <boost/wave/cpp_exceptions.hpp> #include <boost/wave/language_support.hpp> #include <boost/wave/util/file_position.hpp> -// #include <boost/spirit/include/iterator/classic_multi_pass.hpp> // make_multi_pass +// #include <boost/spirit/include/iterator/classic_multi_pass.hpp> // make_multi_pass // this must occur after all of the includes and before any code appears #ifdef BOOST_HAS_ABI_HEADERS @@ -36,9 +36,9 @@ namespace iteration_context_policies { /////////////////////////////////////////////////////////////////////////////// // -// The iteration_context_policies templates are policies for the -// boost::wave::iteration_context which allows to control, how a given -// input file is to be represented by a pair of iterators pointing to the +// The iteration_context_policies templates are policies for the +// boost::wave::iteration_context which allows to control, how a given +// input file is to be represented by a pair of iterators pointing to the // begin and the end of the resulting input sequence. // /////////////////////////////////////////////////////////////////////////////// @@ -47,18 +47,18 @@ namespace iteration_context_policies { // // load_file_to_string // - // Loads a file into a string and returns the iterators pointing to + // Loads a file into a string and returns the iterators pointing to // the beginning and the end of the loaded string. // /////////////////////////////////////////////////////////////////////////// - struct load_file_to_string + struct load_file_to_string { template <typename IterContextT> - class inner + class inner { public: template <typename PositionT> - static void init_iterators(IterContextT &iter_ctx, + static void init_iterators(IterContextT &iter_ctx, PositionT const &act_pos, language_support language) { typedef typename IterContextT::iterator_type iterator_type; @@ -66,7 +66,7 @@ namespace iteration_context_policies { // read in the file std::ifstream instream(iter_ctx.filename.c_str()); if (!instream.is_open()) { - BOOST_WAVE_THROW_CTX(iter_ctx.ctx, preprocess_exception, + BOOST_WAVE_THROW_CTX(iter_ctx.ctx, preprocess_exception, bad_include_file, iter_ctx.filename.c_str(), act_pos); return; } @@ -77,7 +77,7 @@ namespace iteration_context_policies { std::istreambuf_iterator<char>()); iter_ctx.first = iterator_type( - iter_ctx.instring.begin(), iter_ctx.instring.end(), + iter_ctx.instring.begin(), iter_ctx.instring.end(), PositionT(iter_ctx.filename), language); iter_ctx.last = iterator_type(); } @@ -92,7 +92,7 @@ namespace iteration_context_policies { /////////////////////////////////////////////////////////////////////////////// // Base class for iteration contexts template <typename ContextT, typename IteratorT> -struct base_iteration_context +struct base_iteration_context { enum file_type { @@ -103,21 +103,23 @@ struct base_iteration_context }; base_iteration_context(ContextT& ctx_, - BOOST_WAVE_STRINGTYPE const &fname, std::size_t if_block_depth = 0) - : real_filename(fname), real_relative_filename(fname), filename(fname), - line(1), emitted_lines(0), if_block_depth(if_block_depth), ctx(ctx_) + BOOST_WAVE_STRINGTYPE const &fname, std::size_t if_block_depth = 0) + : real_filename(fname), real_relative_filename(fname), filename(fname), + line(1), emitted_lines(0), if_block_depth(if_block_depth), ctx(ctx_), + type(main_file) {} - base_iteration_context(ContextT& ctx_, - IteratorT const &first_, IteratorT const &last_, + base_iteration_context(ContextT& ctx_, + IteratorT const &first_, IteratorT const &last_, BOOST_WAVE_STRINGTYPE const &fname, std::size_t if_block_depth = 0, - file_type type = main_file) - : first(first_), last(last_), real_filename(fname), - real_relative_filename(fname), filename(fname), - line(1), emitted_lines(0), if_block_depth(if_block_depth), ctx(ctx_) + file_type type_ = main_file) + : first(first_), last(last_), real_filename(fname), + real_relative_filename(fname), filename(fname), + line(1), emitted_lines(0), if_block_depth(if_block_depth), ctx(ctx_), + type(type_) {} // the actual input stream - IteratorT first; // actual input stream position + IteratorT first; // actual input stream position IteratorT last; // end of input stream BOOST_WAVE_STRINGTYPE real_filename; // real name of the current file BOOST_WAVE_STRINGTYPE real_relative_filename; // real relative name of the current file @@ -130,14 +132,14 @@ struct base_iteration_context }; /////////////////////////////////////////////////////////////////////////////// -// +// template < - typename ContextT, typename IteratorT, - typename InputPolicyT = typename ContextT::input_policy_type + typename ContextT, typename IteratorT, + typename InputPolicyT = typename ContextT::input_policy_type > struct iteration_context : public base_iteration_context<ContextT, IteratorT>, - public InputPolicyT::template + public InputPolicyT::template inner<iteration_context<ContextT, IteratorT, InputPolicyT> > { typedef IteratorT iterator_type; @@ -146,10 +148,10 @@ struct iteration_context typedef base_iteration_context<ContextT, IteratorT> base_type; typedef iteration_context<ContextT, IteratorT, InputPolicyT> self_type; - iteration_context(ContextT& ctx, BOOST_WAVE_STRINGTYPE const &fname, - position_type const &act_pos, + iteration_context(ContextT& ctx, BOOST_WAVE_STRINGTYPE const &fname, + position_type const &act_pos, boost::wave::language_support language_, - typename base_type::file_type type = base_type::main_file) + typename base_type::file_type type = base_type::main_file) : base_iteration_context<ContextT, IteratorT>(ctx, fname, type) { InputPolicyT::template inner<self_type>::init_iterators( |