Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:43

0001 /*=============================================================================
0002     Boost.Wave: A Standard compliant C++ preprocessor library
0003 
0004     http://www.boost.org/
0005 
0006     Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
0007     Software License, Version 1.0. (See accompanying file
0008     LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 =============================================================================*/
0010 
0011 #if !defined(BOOST_ITERATION_CONTEXT_HPP_9556CD16_F11E_4ADC_AC8B_FB9A174BE664_INCLUDED)
0012 #define BOOST_ITERATION_CONTEXT_HPP_9556CD16_F11E_4ADC_AC8B_FB9A174BE664_INCLUDED
0013 
0014 #include <cstdlib>
0015 #include <stack>
0016 #include <string>
0017 
0018 #include <boost/wave/wave_config.hpp>
0019 #include <boost/wave/cpp_exceptions.hpp>
0020 
0021 // this must occur after all of the includes and before any code appears
0022 #ifdef BOOST_HAS_ABI_HEADERS
0023 #include BOOST_ABI_PREFIX
0024 #endif
0025 
0026 ///////////////////////////////////////////////////////////////////////////////
0027 namespace boost {
0028 namespace wave {
0029 namespace util {
0030 
0031 ///////////////////////////////////////////////////////////////////////////////
0032 template <typename IterationContextT>
0033 class iteration_context_stack
0034 {
0035     typedef std::stack<IterationContextT> base_type;
0036 
0037 public:
0038     typedef typename base_type::size_type size_type;
0039 
0040     iteration_context_stack()
0041     :   max_include_nesting_depth(BOOST_WAVE_MAX_INCLUDE_LEVEL_DEPTH)
0042     {}
0043 
0044     void set_max_include_nesting_depth(size_type new_depth)
0045         {  max_include_nesting_depth = new_depth; }
0046     size_type get_max_include_nesting_depth() const
0047         { return max_include_nesting_depth; }
0048 
0049     typename base_type::size_type size() const { return iter_ctx.size(); }
0050     typename base_type::value_type &top() { return iter_ctx.top(); }
0051     void pop() { iter_ctx.pop(); }
0052 
0053     template <typename Context, typename PositionT>
0054     void push(Context& ctx, PositionT const &pos,
0055         typename base_type::value_type const &val)
0056     {
0057         if (iter_ctx.size() == max_include_nesting_depth) {
0058             std::string buffer = std::to_string(max_include_nesting_depth);
0059             BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
0060                                  include_nesting_too_deep, buffer.c_str(), pos);
0061         }
0062         iter_ctx.push(val);
0063     }
0064 
0065 private:
0066     size_type max_include_nesting_depth;
0067     base_type iter_ctx;
0068 };
0069 
0070 ///////////////////////////////////////////////////////////////////////////////
0071 }   // namespace util
0072 }   // namespace wave
0073 }   // namespace boost
0074 
0075 // the suffix header occurs after all of the code
0076 #ifdef BOOST_HAS_ABI_HEADERS
0077 #include BOOST_ABI_SUFFIX
0078 #endif
0079 
0080 #endif // !defined(BOOST_ITERATION_CONTEXT_HPP_9556CD16_F11E_4ADC_AC8B_FB9A174BE664_INCLUDED)