sl@0: /*============================================================================= sl@0: Boost.Wave: A Standard compliant C++ preprocessor library sl@0: sl@0: http://www.boost.org/ sl@0: sl@0: Copyright (c) 2001-2007 Hartmut Kaiser. Distributed under the Boost sl@0: Software License, Version 1.0. (See accompanying file sl@0: LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) sl@0: =============================================================================*/ sl@0: sl@0: #if !defined(BOOST_WAVE_CPP_THROW_HPP_INCLUDED) sl@0: #define BOOST_WAVE_CPP_THROW_HPP_INCLUDED sl@0: sl@0: #include sl@0: #include sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // helper macro for throwing exceptions sl@0: #if !defined(BOOST_WAVE_THROW) sl@0: #ifdef BOOST_NO_STRINGSTREAM sl@0: #include sl@0: #define BOOST_WAVE_THROW(cls, code, msg, act_pos) \ sl@0: { \ sl@0: using namespace boost::wave; \ sl@0: std::strstream stream; \ sl@0: stream << cls::severity_text(cls::code) << ": " \ sl@0: << cls::error_text(cls::code); \ sl@0: if ((msg)[0] != 0) stream << ": " << (msg); \ sl@0: stream << std::ends; \ sl@0: std::string throwmsg = stream.str(); stream.freeze(false); \ sl@0: boost::throw_exception(cls(throwmsg.c_str(), cls::code, \ sl@0: (act_pos).get_line(), (act_pos).get_column(), \ sl@0: (act_pos).get_file().c_str())); \ sl@0: } \ sl@0: /**/ sl@0: #else sl@0: #include sl@0: #define BOOST_WAVE_THROW(cls, code, msg, act_pos) \ sl@0: { \ sl@0: using namespace boost::wave; \ sl@0: std::stringstream stream; \ sl@0: stream << cls::severity_text(cls::code) << ": " \ sl@0: << cls::error_text(cls::code); \ sl@0: if ((msg)[0] != 0) stream << ": " << (msg); \ sl@0: stream << std::ends; \ sl@0: boost::throw_exception(cls(stream.str().c_str(), cls::code, \ sl@0: (act_pos).get_line(), (act_pos).get_column(), \ sl@0: (act_pos).get_file().c_str())); \ sl@0: } \ sl@0: /**/ sl@0: #endif // BOOST_NO_STRINGSTREAM sl@0: #endif // BOOST_WAVE_THROW sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // helper macro for throwing exceptions with additional parameter sl@0: #if !defined(BOOST_WAVE_THROW_NAME) sl@0: #ifdef BOOST_NO_STRINGSTREAM sl@0: #include sl@0: #define BOOST_WAVE_THROW_NAME(cls, code, msg, act_pos, name) \ sl@0: { \ sl@0: using namespace boost::wave; \ sl@0: std::strstream stream; \ sl@0: stream << cls::severity_text(cls::code) << ": " \ sl@0: << cls::error_text(cls::code); \ sl@0: if ((msg)[0] != 0) stream << ": " << (msg); \ sl@0: stream << std::ends; \ sl@0: std::string throwmsg = stream.str(); stream.freeze(false); \ sl@0: boost::throw_exception(cls(throwmsg.c_str(), cls::code, \ sl@0: (act_pos).get_line(), (act_pos).get_column(), \ sl@0: (act_pos).get_file().c_str(), (name))); \ sl@0: } \ sl@0: /**/ sl@0: #else sl@0: #include sl@0: #define BOOST_WAVE_THROW_NAME(cls, code, msg, act_pos, name) \ sl@0: { \ sl@0: using namespace boost::wave; \ sl@0: std::stringstream stream; \ sl@0: stream << cls::severity_text(cls::code) << ": " \ sl@0: << cls::error_text(cls::code); \ sl@0: if ((msg)[0] != 0) stream << ": " << (msg); \ sl@0: stream << std::ends; \ sl@0: boost::throw_exception(cls(stream.str().c_str(), cls::code, \ sl@0: (act_pos).get_line(), (act_pos).get_column(), \ sl@0: (act_pos).get_file().c_str(), (name))); \ sl@0: } \ sl@0: /**/ sl@0: #endif // BOOST_NO_STRINGSTREAM sl@0: #endif // BOOST_WAVE_THROW_NAME sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // helper macro for throwing exceptions with additional parameter sl@0: #if !defined(BOOST_WAVE_THROW_VAR) sl@0: #ifdef BOOST_NO_STRINGSTREAM sl@0: #include sl@0: #define BOOST_WAVE_THROW_VAR(cls, code, msg, act_pos) \ sl@0: { \ sl@0: using namespace boost::wave; \ sl@0: std::strstream stream; \ sl@0: stream << cls::severity_text(code) << ": " \ sl@0: << cls::error_text(code); \ sl@0: if ((msg)[0] != 0) stream << ": " << (msg); \ sl@0: stream << std::ends; \ sl@0: std::string throwmsg = stream.str(); stream.freeze(false); \ sl@0: boost::throw_exception(cls(throwmsg.c_str(), code, \ sl@0: (act_pos).get_line(), (act_pos).get_column(), \ sl@0: (act_pos).get_file().c_str())); \ sl@0: } \ sl@0: /**/ sl@0: #else sl@0: #include sl@0: #define BOOST_WAVE_THROW_VAR(cls, code, msg, act_pos) \ sl@0: { \ sl@0: using namespace boost::wave; \ sl@0: std::stringstream stream; \ sl@0: stream << cls::severity_text(code) << ": " \ sl@0: << cls::error_text(code); \ sl@0: if ((msg)[0] != 0) stream << ": " << (msg); \ sl@0: stream << std::ends; \ sl@0: boost::throw_exception(cls(stream.str().c_str(), code, \ sl@0: (act_pos).get_line(), (act_pos).get_column(), \ sl@0: (act_pos).get_file().c_str())); \ sl@0: } \ sl@0: /**/ sl@0: #endif // BOOST_NO_STRINGSTREAM sl@0: #endif // BOOST_WAVE_THROW_VAR sl@0: sl@0: #endif // !defined(BOOST_WAVE_CPP_THROW_HPP_INCLUDED)