[857] | 1 | // (C) Copyright Gennadiy Rozental 2005.
|
---|
| 2 | // Distributed under the Boost Software License, Version 1.0.
|
---|
| 3 | // (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 4 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 5 |
|
---|
| 6 | // See http://www.boost.org/libs/test for the library home page.
|
---|
| 7 | //
|
---|
| 8 | // File : $RCSfile: config.hpp,v $
|
---|
| 9 | //
|
---|
| 10 | // Version : $Revision: 1.3 $
|
---|
| 11 | //
|
---|
| 12 | // Description : Runtime.Param library configuration
|
---|
| 13 | // ***************************************************************************
|
---|
| 14 |
|
---|
| 15 | #ifndef BOOST_RT_CONFIG_HPP_062604GER
|
---|
| 16 | #define BOOST_RT_CONFIG_HPP_062604GER
|
---|
| 17 |
|
---|
| 18 | // Boost
|
---|
| 19 | #include <boost/config.hpp>
|
---|
| 20 | #ifdef BOOST_MSVC
|
---|
| 21 | # pragma warning(disable: 4511) // copy constructor could not be generated
|
---|
| 22 | # pragma warning(disable: 4512) // assignment operator could not be generated
|
---|
| 23 | # pragma warning(disable: 4181) // qualifier applied to reference type; ignored
|
---|
| 24 | # pragma warning(disable: 4675) // resolved overload was found by argument-dependent lookup
|
---|
| 25 | #endif
|
---|
| 26 |
|
---|
| 27 | // Boost.Test
|
---|
| 28 | #include <boost/test/detail/config.hpp>
|
---|
| 29 | #include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
---|
| 30 | #include <boost/test/utils/wrap_stringstream.hpp>
|
---|
| 31 |
|
---|
| 32 | // STL
|
---|
| 33 | #include <string>
|
---|
| 34 | #include <cstdlib>
|
---|
| 35 |
|
---|
| 36 | //____________________________________________________________________________//
|
---|
| 37 |
|
---|
| 38 | #ifndef BOOST_RT_PARAM_CUSTOM_STRING
|
---|
| 39 | # ifndef BOOST_RT_PARAM_WIDE_STRING
|
---|
| 40 | # define BOOST_RT_PARAM_NAMESPACE runtime
|
---|
| 41 | # else
|
---|
| 42 | # define BOOST_RT_PARAM_NAMESPACE wide_runtime
|
---|
| 43 | # endif
|
---|
| 44 | #endif
|
---|
| 45 |
|
---|
| 46 | namespace boost {
|
---|
| 47 |
|
---|
| 48 | namespace BOOST_RT_PARAM_NAMESPACE {
|
---|
| 49 |
|
---|
| 50 | #ifndef BOOST_RT_PARAM_CUSTOM_STRING
|
---|
| 51 | # ifndef BOOST_RT_PARAM_WIDE_STRING
|
---|
| 52 |
|
---|
| 53 | typedef char char_type;
|
---|
| 54 | typedef std::string dstring;
|
---|
| 55 | typedef unit_test::const_string cstring;
|
---|
| 56 | typedef unit_test::literal_string literal_cstring;
|
---|
| 57 | typedef wrap_stringstream format_stream;
|
---|
| 58 |
|
---|
| 59 | #ifdef BOOST_CLASSIC_IOSTREAMS
|
---|
| 60 | typedef std::ostream out_stream;
|
---|
| 61 | #else
|
---|
| 62 | typedef std::basic_ostream<char_type> out_stream;
|
---|
| 63 | #endif
|
---|
| 64 |
|
---|
| 65 | #if defined(__COMO__)
|
---|
| 66 | inline void
|
---|
| 67 | putenv_impl( cstring name, cstring value )
|
---|
| 68 | {
|
---|
| 69 | using namespace std;
|
---|
| 70 | // !! this may actually fail. What should we do?
|
---|
| 71 | setenv( name.begin(), value.begin(), 1 );
|
---|
| 72 | }
|
---|
| 73 | #else
|
---|
| 74 | inline void
|
---|
| 75 | putenv_impl( cstring name, cstring value )
|
---|
| 76 | {
|
---|
| 77 | format_stream fs;
|
---|
| 78 |
|
---|
| 79 | fs << name << '=' << value;
|
---|
| 80 |
|
---|
| 81 | // !! this may actually fail. What should we do?
|
---|
| 82 | // const_cast is used to satisfy putenv interface
|
---|
| 83 | using namespace std;
|
---|
| 84 | putenv( const_cast<char*>( fs.str().c_str() ) );
|
---|
| 85 | }
|
---|
| 86 | #endif
|
---|
| 87 |
|
---|
| 88 | #define BOOST_RT_PARAM_LITERAL( l ) l
|
---|
| 89 | #define BOOST_RT_PARAM_CSTRING_LITERAL( l ) cstring( l, sizeof( l ) - 1 )
|
---|
| 90 | #define BOOST_RT_PARAM_GETENV getenv
|
---|
| 91 | #define BOOST_RT_PARAM_PUTENV putenv_impl
|
---|
| 92 | #define BOOST_RT_PARAM_EXCEPTION_INHERIT_STD
|
---|
| 93 |
|
---|
| 94 | //____________________________________________________________________________//
|
---|
| 95 |
|
---|
| 96 | # else
|
---|
| 97 |
|
---|
| 98 | typedef wchar_t char_type;
|
---|
| 99 | typedef std::basic_string<char_type> dstring;
|
---|
| 100 | typedef unit_test::basic_cstring<wchar_t const> cstring;
|
---|
| 101 | typedef const unit_test::basic_cstring<wchar_t const> literal_cstring;
|
---|
| 102 | typedef wrap_wstringstream format_stream;
|
---|
| 103 | typedef std::wostream out_stream;
|
---|
| 104 |
|
---|
| 105 | inline void
|
---|
| 106 | putenv_impl( cstring name, cstring value )
|
---|
| 107 | {
|
---|
| 108 | format_stream fs;
|
---|
| 109 |
|
---|
| 110 | fs << name << '=' << value;
|
---|
| 111 |
|
---|
| 112 | // !! this may actually fail. What should we do?
|
---|
| 113 | // const_cast is used to satisfy putenv interface
|
---|
| 114 | using namespace std;
|
---|
| 115 | wputenv( const_cast<wchar_t*>( fs.str().c_str() ) );
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | #define BOOST_RT_PARAM_LITERAL( l ) L ## l
|
---|
| 119 | #define BOOST_RT_PARAM_CSTRING_LITERAL( l ) cstring( L ## l, sizeof( L ## l )/sizeof(wchar_t) - 1 )
|
---|
| 120 | #define BOOST_RT_PARAM_GETENV wgetenv
|
---|
| 121 | #define BOOST_RT_PARAM_PUTENV putenv_impl
|
---|
| 122 |
|
---|
| 123 | # endif
|
---|
| 124 | #endif
|
---|
| 125 |
|
---|
| 126 | #ifdef __GNUC__
|
---|
| 127 | #define BOOST_RT_PARAM_UNNEEDED_VIRTUAL virtual
|
---|
| 128 | #else
|
---|
| 129 | #define BOOST_RT_PARAM_UNNEEDED_VIRTUAL
|
---|
| 130 | #endif
|
---|
| 131 |
|
---|
| 132 | //____________________________________________________________________________//
|
---|
| 133 |
|
---|
| 134 | } // namespace BOOST_RT_PARAM_NAMESPACE
|
---|
| 135 |
|
---|
| 136 | } // namespace boost
|
---|
| 137 |
|
---|
| 138 | // ************************************************************************** //
|
---|
| 139 | // Revision History:
|
---|
| 140 | //
|
---|
| 141 | // $Log: config.hpp,v $
|
---|
| 142 | // Revision 1.3 2005/05/06 04:02:52 rogeeff
|
---|
| 143 | // include ctdlib for setenv
|
---|
| 144 | //
|
---|
| 145 | // Revision 1.2 2005/05/05 05:55:31 rogeeff
|
---|
| 146 | // portability fixes
|
---|
| 147 | //
|
---|
| 148 | // Revision 1.1 2005/04/12 06:42:42 rogeeff
|
---|
| 149 | // Runtime.Param library initial commit
|
---|
| 150 | //
|
---|
| 151 | // ************************************************************************** //
|
---|
| 152 |
|
---|
| 153 | #endif // BOOST_RT_CONFIG_HPP_062604GER
|
---|