diff options
Diffstat (limited to 'boost/wave/util/iteration_context.hpp')
-rw-r--r-- | boost/wave/util/iteration_context.hpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/boost/wave/util/iteration_context.hpp b/boost/wave/util/iteration_context.hpp index 8673f46639..1ea027c88d 100644 --- a/boost/wave/util/iteration_context.hpp +++ b/boost/wave/util/iteration_context.hpp @@ -3,7 +3,7 @@ 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) =============================================================================*/ @@ -30,17 +30,17 @@ namespace util { /////////////////////////////////////////////////////////////////////////////// template <typename IterationContextT> -class iteration_context_stack +class iteration_context_stack { typedef std::stack<IterationContextT> base_type; - + public: typedef typename base_type::size_type size_type; - + iteration_context_stack() : max_include_nesting_depth(BOOST_WAVE_MAX_INCLUDE_LEVEL_DEPTH) {} - + void set_max_include_nesting_depth(size_type new_depth) { max_include_nesting_depth = new_depth; } size_type get_max_include_nesting_depth() const @@ -49,22 +49,22 @@ public: typename base_type::size_type size() const { return iter_ctx.size(); } typename base_type::value_type &top() { return iter_ctx.top(); } void pop() { iter_ctx.pop(); } - + template <typename Context, typename PositionT> - void push(Context& ctx, PositionT const &pos, + void push(Context& ctx, PositionT const &pos, typename base_type::value_type const &val) - { + { if (iter_ctx.size() == max_include_nesting_depth) { char buffer[22]; // 21 bytes holds all NUL-terminated unsigned 64-bit numbers using namespace std; // for some systems sprintf is in namespace std sprintf(buffer, "%d", (int)max_include_nesting_depth); - BOOST_WAVE_THROW_CTX(ctx, preprocess_exception, + BOOST_WAVE_THROW_CTX(ctx, preprocess_exception, include_nesting_too_deep, buffer, pos); } - iter_ctx.push(val); + iter_ctx.push(val); } - + private: size_type max_include_nesting_depth; base_type iter_ctx; |