os/ossrv/ossrv_pub/boost_apis/boost/wave/cpp_throw.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/wave/cpp_throw.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,128 @@
     1.4 +/*=============================================================================
     1.5 +    Boost.Wave: A Standard compliant C++ preprocessor library
     1.6 +
     1.7 +    http://www.boost.org/
     1.8 +
     1.9 +    Copyright (c) 2001-2007 Hartmut Kaiser. Distributed under the Boost
    1.10 +    Software License, Version 1.0. (See accompanying file
    1.11 +    LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
    1.12 +=============================================================================*/
    1.13 +
    1.14 +#if !defined(BOOST_WAVE_CPP_THROW_HPP_INCLUDED)
    1.15 +#define BOOST_WAVE_CPP_THROW_HPP_INCLUDED
    1.16 +
    1.17 +#include <string>
    1.18 +#include <boost/throw_exception.hpp>
    1.19 +
    1.20 +///////////////////////////////////////////////////////////////////////////////
    1.21 +// helper macro for throwing exceptions
    1.22 +#if !defined(BOOST_WAVE_THROW)
    1.23 +#ifdef BOOST_NO_STRINGSTREAM
    1.24 +#include <strstream>
    1.25 +#define BOOST_WAVE_THROW(cls, code, msg, act_pos)                             \
    1.26 +    {                                                                         \
    1.27 +        using namespace boost::wave;                                          \
    1.28 +        std::strstream stream;                                                \
    1.29 +            stream << cls::severity_text(cls::code) << ": "                   \
    1.30 +            << cls::error_text(cls::code);                                    \
    1.31 +        if ((msg)[0] != 0) stream << ": " << (msg);                           \
    1.32 +        stream << std::ends;                                                  \
    1.33 +        std::string throwmsg = stream.str(); stream.freeze(false);            \
    1.34 +        boost::throw_exception(cls(throwmsg.c_str(), cls::code,               \
    1.35 +            (act_pos).get_line(), (act_pos).get_column(),                     \
    1.36 +            (act_pos).get_file().c_str()));                                   \
    1.37 +    }                                                                         \
    1.38 +    /**/
    1.39 +#else
    1.40 +#include <sstream>
    1.41 +#define BOOST_WAVE_THROW(cls, code, msg, act_pos)                             \
    1.42 +    {                                                                         \
    1.43 +        using namespace boost::wave;                                          \
    1.44 +        std::stringstream stream;                                             \
    1.45 +            stream << cls::severity_text(cls::code) << ": "                   \
    1.46 +            << cls::error_text(cls::code);                                    \
    1.47 +        if ((msg)[0] != 0) stream << ": " << (msg);                           \
    1.48 +        stream << std::ends;                                                  \
    1.49 +        boost::throw_exception(cls(stream.str().c_str(), cls::code,           \
    1.50 +            (act_pos).get_line(), (act_pos).get_column(),                     \
    1.51 +            (act_pos).get_file().c_str()));                                   \
    1.52 +    }                                                                         \
    1.53 +    /**/
    1.54 +#endif // BOOST_NO_STRINGSTREAM
    1.55 +#endif // BOOST_WAVE_THROW
    1.56 +
    1.57 +///////////////////////////////////////////////////////////////////////////////
    1.58 +// helper macro for throwing exceptions with additional parameter
    1.59 +#if !defined(BOOST_WAVE_THROW_NAME)
    1.60 +#ifdef BOOST_NO_STRINGSTREAM
    1.61 +#include <strstream>
    1.62 +#define BOOST_WAVE_THROW_NAME(cls, code, msg, act_pos, name)                  \
    1.63 +    {                                                                         \
    1.64 +        using namespace boost::wave;                                          \
    1.65 +        std::strstream stream;                                                \
    1.66 +            stream << cls::severity_text(cls::code) << ": "                   \
    1.67 +            << cls::error_text(cls::code);                                    \
    1.68 +        if ((msg)[0] != 0) stream << ": " << (msg);                           \
    1.69 +        stream << std::ends;                                                  \
    1.70 +        std::string throwmsg = stream.str(); stream.freeze(false);            \
    1.71 +        boost::throw_exception(cls(throwmsg.c_str(), cls::code,               \
    1.72 +            (act_pos).get_line(), (act_pos).get_column(),                     \
    1.73 +            (act_pos).get_file().c_str(), (name)));                           \
    1.74 +    }                                                                         \
    1.75 +    /**/
    1.76 +#else
    1.77 +#include <sstream>
    1.78 +#define BOOST_WAVE_THROW_NAME(cls, code, msg, act_pos, name)                  \
    1.79 +    {                                                                         \
    1.80 +        using namespace boost::wave;                                          \
    1.81 +        std::stringstream stream;                                             \
    1.82 +            stream << cls::severity_text(cls::code) << ": "                   \
    1.83 +            << cls::error_text(cls::code);                                    \
    1.84 +        if ((msg)[0] != 0) stream << ": " << (msg);                           \
    1.85 +        stream << std::ends;                                                  \
    1.86 +        boost::throw_exception(cls(stream.str().c_str(), cls::code,           \
    1.87 +            (act_pos).get_line(), (act_pos).get_column(),                     \
    1.88 +            (act_pos).get_file().c_str(), (name)));                           \
    1.89 +    }                                                                         \
    1.90 +    /**/
    1.91 +#endif // BOOST_NO_STRINGSTREAM
    1.92 +#endif // BOOST_WAVE_THROW_NAME
    1.93 +
    1.94 +///////////////////////////////////////////////////////////////////////////////
    1.95 +// helper macro for throwing exceptions with additional parameter
    1.96 +#if !defined(BOOST_WAVE_THROW_VAR)
    1.97 +#ifdef BOOST_NO_STRINGSTREAM
    1.98 +#include <strstream>
    1.99 +#define BOOST_WAVE_THROW_VAR(cls, code, msg, act_pos)                         \
   1.100 +    {                                                                         \
   1.101 +        using namespace boost::wave;                                          \
   1.102 +        std::strstream stream;                                                \
   1.103 +            stream << cls::severity_text(code) << ": "                        \
   1.104 +            << cls::error_text(code);                                         \
   1.105 +        if ((msg)[0] != 0) stream << ": " << (msg);                           \
   1.106 +        stream << std::ends;                                                  \
   1.107 +        std::string throwmsg = stream.str(); stream.freeze(false);            \
   1.108 +        boost::throw_exception(cls(throwmsg.c_str(), code,                    \
   1.109 +            (act_pos).get_line(), (act_pos).get_column(),                     \
   1.110 +            (act_pos).get_file().c_str()));                                   \
   1.111 +    }                                                                         \
   1.112 +    /**/
   1.113 +#else
   1.114 +#include <sstream>
   1.115 +#define BOOST_WAVE_THROW_VAR(cls, code, msg, act_pos)                         \
   1.116 +    {                                                                         \
   1.117 +        using namespace boost::wave;                                          \
   1.118 +        std::stringstream stream;                                             \
   1.119 +            stream << cls::severity_text(code) << ": "                        \
   1.120 +            << cls::error_text(code);                                         \
   1.121 +        if ((msg)[0] != 0) stream << ": " << (msg);                           \
   1.122 +        stream << std::ends;                                                  \
   1.123 +        boost::throw_exception(cls(stream.str().c_str(), code,                \
   1.124 +            (act_pos).get_line(), (act_pos).get_column(),                     \
   1.125 +            (act_pos).get_file().c_str()));                                   \
   1.126 +    }                                                                         \
   1.127 +    /**/
   1.128 +#endif // BOOST_NO_STRINGSTREAM
   1.129 +#endif // BOOST_WAVE_THROW_VAR
   1.130 +
   1.131 +#endif // !defined(BOOST_WAVE_CPP_THROW_HPP_INCLUDED)