diff options
Diffstat (limited to 'boost/test/utils')
77 files changed, 1527 insertions, 1365 deletions
diff --git a/boost/test/utils/algorithm.hpp b/boost/test/utils/algorithm.hpp index 1ad389dbaf..7a70654718 100644 --- a/boost/test/utils/algorithm.hpp +++ b/boost/test/utils/algorithm.hpp @@ -1,20 +1,18 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. // -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : addition to STL algorithms +/// @file +/// Addition to STL algorithms // *************************************************************************** -#ifndef BOOST_ALGORITHM_HPP_062304GER -#define BOOST_ALGORITHM_HPP_062304GER +#ifndef BOOST_TEST_UTILS_ALGORITHM_HPP +#define BOOST_TEST_UTILS_ALGORITHM_HPP +// STL #include <utility> #include <algorithm> // std::find #include <functional> // std::bind1st @@ -29,7 +27,7 @@ namespace unit_test { /// @brief this algorithm search through two collections for first mismatch position that get returned as a pair /// of iterators, first pointing to the mismatch position in first collection, second iterator in second one - +/// /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator @@ -52,7 +50,7 @@ mismatch( InputIter1 first1, InputIter1 last1, /// @brief this algorithm search through two collections for first mismatch position that get returned as a pair /// of iterators, first pointing to the mismatch position in first collection, second iterator in second one. This algorithms /// uses supplied predicate for collection elements comparison - +/// /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator @@ -75,14 +73,14 @@ mismatch( InputIter1 first1, InputIter1 last1, //____________________________________________________________________________// /// @brief this algorithm search through first collection for first element that does not belong a second one - +/// /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator template<class ForwardIterator1, class ForwardIterator2> inline ForwardIterator1 -find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, +find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ) { while( first1 != last1 ) { @@ -96,9 +94,9 @@ find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, //____________________________________________________________________________// -/// @brief this algorithm search through first collection for first element that does not satisfy binary +/// @brief this algorithm search through first collection for first element that does not satisfy binary /// predicate in conjunction will any element in second collection - +/// /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator @@ -106,8 +104,8 @@ find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, /// @param pred - predicate to be used for search template<class ForwardIterator1, class ForwardIterator2, class Predicate> inline ForwardIterator1 -find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, +find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, Predicate pred ) { while( first1 != last1 ) { @@ -122,14 +120,14 @@ find_first_not_of( ForwardIterator1 first1, ForwardIterator1 last1, //____________________________________________________________________________// /// @brief this algorithm search through first collection for last element that belongs to a second one - +/// /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator template<class BidirectionalIterator1, class ForwardIterator2> inline BidirectionalIterator1 -find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, +find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ) { if( first1 == last1 || first2 == last2 ) @@ -143,9 +141,9 @@ find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, //____________________________________________________________________________// -/// @brief this algorithm search through first collection for last element that satisfy binary +/// @brief this algorithm search through first collection for last element that satisfy binary /// predicate in conjunction will at least one element in second collection - +/// /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator @@ -153,8 +151,8 @@ find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, /// @param pred - predicate to be used for search template<class BidirectionalIterator1, class ForwardIterator2, class Predicate> inline BidirectionalIterator1 -find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, +find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, Predicate pred ) { if( first1 == last1 || first2 == last2 ) @@ -169,14 +167,14 @@ find_last_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, //____________________________________________________________________________// /// @brief this algorithm search through first collection for last element that does not belong to a second one - +/// /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator /// @param last2 - second collection end iterator template<class BidirectionalIterator1, class ForwardIterator2> inline BidirectionalIterator1 -find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, +find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, ForwardIterator2 first2, ForwardIterator2 last2 ) { if( first1 == last1 || first2 == last2 ) @@ -190,9 +188,9 @@ find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, //____________________________________________________________________________// -/// @brief this algorithm search through first collection for last element that does not satisfy binary +/// @brief this algorithm search through first collection for last element that does not satisfy binary /// predicate in conjunction will any element in second collection - +/// /// @param first1 - first collection begin iterator /// @param last1 - first collection end iterator /// @param first2 - second collection begin iterator @@ -200,8 +198,8 @@ find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, /// @param pred - predicate to be used for search template<class BidirectionalIterator1, class ForwardIterator2, class Predicate> inline BidirectionalIterator1 -find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, +find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, Predicate pred ) { if( first1 == last1 || first2 == last2 ) @@ -216,13 +214,10 @@ find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, //____________________________________________________________________________// } // namespace unit_test - } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_ALGORITHM_HPP_062304GER +#endif // BOOST_TEST_UTILS_ALGORITHM_HPP diff --git a/boost/test/utils/assign_op.hpp b/boost/test/utils/assign_op.hpp index 434219fa9d..ea49b5148b 100644 --- a/boost/test/utils/assign_op.hpp +++ b/boost/test/utils/assign_op.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,11 +12,10 @@ // Description : overloadable assignment // *************************************************************************** -#ifndef BOOST_TEST_ASSIGN_OP_033005GER -#define BOOST_TEST_ASSIGN_OP_033005GER +#ifndef BOOST_TEST_UTILS_ASSIGN_OP_HPP +#define BOOST_TEST_UTILS_ASSIGN_OP_HPP namespace boost { - namespace unit_test { // ************************************************************************** // @@ -34,8 +33,7 @@ assign_op( T& t, S const& s, long ) //____________________________________________________________________________// } // namespace unit_test - } // namespace boost -#endif // BOOST_TEST_ASSIGN_OP_033005GER +#endif // BOOST_TEST_UTILS_ASSIGN_OP_HPP diff --git a/boost/test/utils/basic_cstring/basic_cstring.hpp b/boost/test/utils/basic_cstring/basic_cstring.hpp index 14742c49f9..7cbd36b328 100644 --- a/boost/test/utils/basic_cstring/basic_cstring.hpp +++ b/boost/test/utils/basic_cstring/basic_cstring.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,17 +9,20 @@ // // Version : $Revision$ // -// Description : class basic_cstring wraps C string and provide std_string like +// Description : class basic_cstring wraps C string and provide std_string like // interface // *************************************************************************** -#ifndef BOOST_TEST_BASIC_CSTRING_HPP_071894GER -#define BOOST_TEST_BASIC_CSTRING_HPP_071894GER +#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_HPP +#define BOOST_TEST_UTILS_BASIC_CSTRING_HPP // Boost.Test #include <boost/test/utils/basic_cstring/basic_cstring_fwd.hpp> #include <boost/test/utils/basic_cstring/bcs_char_traits.hpp> +// Boost +#include <boost/type_traits/remove_cv.hpp> + // STL #include <string> @@ -44,6 +47,7 @@ public: typedef typename ut_detail::bcs_char_traits<CharT>::std_string std_string; typedef CharT value_type; + typedef typename remove_cv<value_type>::type value_ret_type; typedef value_type* pointer; typedef value_type const* const_pointer; typedef value_type& reference; @@ -70,12 +74,13 @@ public: basic_cstring(); basic_cstring( std_string const& s ); basic_cstring( pointer s ); - basic_cstring( pointer s, size_type arg_size ); + template<typename LenType> + basic_cstring( pointer s, LenType len ) : m_begin( s ), m_end( m_begin + len ) {} basic_cstring( pointer first, pointer last ); // data access methods - value_type operator[]( size_type index ) const; - value_type at( size_type index ) const; + value_ret_type operator[]( size_type index ) const; + value_ret_type at( size_type index ) const; // size operators size_type size() const; @@ -84,25 +89,25 @@ public: void resize( size_type new_len ); // !! only for STL container conformance use is_empty instead - bool empty() const; + bool empty() const; // Trimming self_type& trim_right( size_type trim_size ); self_type& trim_left( size_type trim_size ); self_type& trim_right( iterator it ); self_type& trim_left( iterator it ); -#ifndef __IBMCPP__ +#if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(800)) self_type& trim_left( self_type exclusions = self_type() ) ; self_type& trim_right( self_type exclusions = self_type() ) ; self_type& trim( self_type exclusions = self_type() ) ; #else - // VisualAge version 6 has in this case a problem with the default arguments. - self_type& trim_left( self_type exclusions ) ; - self_type& trim_right( self_type exclusions ) ; - self_type& trim( self_type exclusions ) ; - self_type& trim_left() { trim_left( self_type() ) ; } - self_type& trim_right() { trim_right( self_type() ) ; } - self_type& trim() { trim( self_type() ) ; } + // VA C++/XL C++ v6 and v8 has in this case a problem with the default arguments. + self_type& trim_left( self_type exclusions ); + self_type& trim_right( self_type exclusions ); + self_type& trim( self_type exclusions ); + self_type& trim_left() { return trim_left( self_type() ); } + self_type& trim_right() { return trim_right( self_type() ); } + self_type& trim() { return trim( self_type() ); } #endif // Assignment operators @@ -111,12 +116,28 @@ public: basic_cstring& operator=( pointer s ); template<typename CharT2> - basic_cstring& assign( basic_cstring<CharT2> const& s ) { *this = basic_cstring<CharT>( s.begin(), s.end() ); return *this; } - basic_cstring& assign( self_type const& s, size_type pos, size_type len ); + basic_cstring& assign( basic_cstring<CharT2> const& s ) + { + return *this = basic_cstring<CharT>( s.begin(), s.end() ); + } + template<typename PosType, typename LenType> + basic_cstring& assign( self_type const& s, PosType pos, LenType len ) + { + return *this = self_type( s.m_begin + pos, len ); + } + basic_cstring& assign( std_string const& s ); - basic_cstring& assign( std_string const& s, size_type pos, size_type len ); + template<typename PosType, typename LenType> + basic_cstring& assign( std_string const& s, PosType pos, LenType len ) + { + return *this = self_type( s.c_str() + pos, len ); + } basic_cstring& assign( pointer s ); - basic_cstring& assign( pointer s, size_type len ); + template<typename LenType> + basic_cstring& assign( pointer s, LenType len ) + { + return *this = self_type( s, len ); + } basic_cstring& assign( pointer f, pointer l ); // swapping @@ -187,15 +208,6 @@ basic_cstring<CharT>::basic_cstring( pointer s ) template<typename CharT> inline -basic_cstring<CharT>::basic_cstring( pointer s, size_type arg_size ) -: m_begin( s ), m_end( m_begin + arg_size ) -{ -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>::basic_cstring( pointer first, pointer last ) : m_begin( first ) , m_end( last ) @@ -205,7 +217,7 @@ basic_cstring<CharT>::basic_cstring( pointer first, pointer last ) //____________________________________________________________________________// template<typename CharT> -inline typename basic_cstring<CharT>::value_type +inline typename basic_cstring<CharT>::value_ret_type basic_cstring<CharT>::operator[]( size_type index ) const { return m_begin[index]; @@ -214,7 +226,7 @@ basic_cstring<CharT>::operator[]( size_type index ) const //____________________________________________________________________________// template<typename CharT> -inline typename basic_cstring<CharT>::value_type +inline typename basic_cstring<CharT>::value_ret_type basic_cstring<CharT>::at( size_type index ) const { if( m_begin + index >= m_end ) @@ -229,7 +241,7 @@ template<typename CharT> inline typename basic_cstring<CharT>::size_type basic_cstring<CharT>::size() const { - return m_end - m_begin; + return static_cast<size_type>(m_end - m_begin); } //____________________________________________________________________________// @@ -309,7 +321,7 @@ basic_cstring<CharT>::trim_left( basic_cstring exclusions ) if( traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) ) break; } - + return trim_left( it ); } @@ -354,7 +366,7 @@ basic_cstring<CharT>::trim_right( basic_cstring exclusions ) if( self_type::traits_type::find( exclusions.begin(), exclusions.size(), *it ) == reinterpret_cast<pointer>(0) ) break; } - + return trim_right( it+1 ); } @@ -404,15 +416,6 @@ basic_cstring<CharT>::operator=( pointer s ) template<typename CharT> inline basic_cstring<CharT>& -basic_cstring<CharT>::assign( basic_cstring<CharT> const& s, size_type pos, size_type len ) -{ - return *this = self_type( s.m_begin + pos, len ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& basic_cstring<CharT>::assign( std_string const& s ) { return *this = self_type( s ); @@ -422,15 +425,6 @@ basic_cstring<CharT>::assign( std_string const& s ) template<typename CharT> inline basic_cstring<CharT>& -basic_cstring<CharT>::assign( std_string const& s, size_type pos, size_type len ) -{ - return *this = self_type( s.c_str() + pos, len ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& basic_cstring<CharT>::assign( pointer s ) { return *this = self_type( s ); @@ -440,15 +434,6 @@ basic_cstring<CharT>::assign( pointer s ) template<typename CharT> inline basic_cstring<CharT>& -basic_cstring<CharT>::assign( pointer s, size_type len ) -{ - return *this = self_type( s, len ); -} - -//____________________________________________________________________________// - -template<typename CharT> -inline basic_cstring<CharT>& basic_cstring<CharT>::assign( pointer f, pointer l ) { return *this = self_type( f, l ); @@ -526,7 +511,7 @@ basic_cstring<CharT>::find( basic_cstring<CharT> str ) const ++it; } - return it == last ? static_cast<size_type>(npos) : it - begin(); + return it == last ? npos : static_cast<size_type>(it - begin()); } //____________________________________________________________________________// @@ -586,7 +571,7 @@ inline bool operator==( basic_cstring<CharT1> const& s1, basic_cstring<CharT2> const& s2 ) { typedef typename basic_cstring<CharT1>::traits_type traits_type; - return s1.size() == s2.size() && + return s1.size() == s2.size() && traits_type::compare( s1.begin(), s2.begin(), s1.size() ) == 0; } @@ -682,12 +667,12 @@ operator!=( typename basic_cstring<CharT>::std_string const& s2, basic_cstring<C // ************************************************************************** // template<typename CharT> -inline typename basic_cstring<CharT>::value_type +inline typename basic_cstring<CharT>::value_ret_type first_char( basic_cstring<CharT> source ) { - typedef typename basic_cstring<CharT>::value_type string_value_type; + typedef typename basic_cstring<CharT>::value_ret_type res_type; - return source.is_empty() ? static_cast<string_value_type>(0) : *source.begin(); + return source.is_empty() ? static_cast<res_type>(0) : *source.begin(); } //____________________________________________________________________________// @@ -697,12 +682,12 @@ first_char( basic_cstring<CharT> source ) // ************************************************************************** // template<typename CharT> -inline typename basic_cstring<CharT>::value_type +inline typename basic_cstring<CharT>::value_ret_type last_char( basic_cstring<CharT> source ) { - typedef typename basic_cstring<CharT>::value_type string_value_type; + typedef typename basic_cstring<CharT>::value_ret_type res_type; - return source.is_empty() ? static_cast<string_value_type>(0) : *(source.end()-1); + return source.is_empty() ? static_cast<res_type>(0) : *(source.end()-1); } //____________________________________________________________________________// @@ -720,6 +705,28 @@ assign_op( std::basic_string<CharT1>& target, basic_cstring<CharT2> src, int ) //____________________________________________________________________________// +template<typename CharT1, typename CharT2> +inline std::basic_string<CharT1>& +operator+=( std::basic_string<CharT1>& target, basic_cstring<CharT2> const& str ) +{ + target.append( str.begin(), str.end() ); + return target; +} + +//____________________________________________________________________________// + +template<typename CharT1, typename CharT2> +inline std::basic_string<CharT1> +operator+( std::basic_string<CharT1> const& lhs, basic_cstring<CharT2> const& rhs ) +{ + std::basic_string<CharT1> res( lhs ); + + res.append( rhs.begin(), rhs.end() ); + return res; +} + +//____________________________________________________________________________// + } // namespace unit_test } // namespace boost @@ -728,4 +735,4 @@ assign_op( std::basic_string<CharT1>& target, basic_cstring<CharT2> src, int ) #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TEST_BASIC_CSTRING_HPP_071894GER +#endif // BOOST_TEST_UTILS_BASIC_CSTRING_HPP diff --git a/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp b/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp index f3d11a5cd2..a1865f4f94 100644 --- a/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp +++ b/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,12 +9,12 @@ // // Version : $Revision$ // -// Description : basic_cstring class wrap C string and provide std_string like +// Description : basic_cstring class wrap C string and provide std_string like // interface // *************************************************************************** -#ifndef BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER -#define BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER +#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP +#define BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP #include <boost/detail/workaround.hpp> @@ -36,5 +36,5 @@ typedef char const* const c_literal_string; } // namespace boost -#endif // BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER +#endif // BOOST_TEST_UTILS_BASIC_CSTRING_FWD_HPP diff --git a/boost/test/utils/basic_cstring/bcs_char_traits.hpp b/boost/test/utils/basic_cstring/bcs_char_traits.hpp index a97d4616a2..4700d14291 100644 --- a/boost/test/utils/basic_cstring/bcs_char_traits.hpp +++ b/boost/test/utils/basic_cstring/bcs_char_traits.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : generic char traits class; wraps std::char_traits // *************************************************************************** -#ifndef BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER -#define BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER +#ifndef BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP +#define BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP // Boost #include <boost/config.hpp> @@ -119,11 +119,11 @@ struct char_traits_with_find : std::string_char_traits<CharT> { } }; -template<> struct bcs_char_traits_impl<char> : char_traits_with_find<char> {}; -template<> struct bcs_char_traits_impl<wchar_t> : char_traits_with_find<wchar_t> {}; +template<> struct bcs_char_traits_impl<char> : public char_traits_with_find<char> {}; +template<> struct bcs_char_traits_impl<wchar_t> : public char_traits_with_find<wchar_t> {}; #else -template<> struct bcs_char_traits_impl<char> : std::char_traits<char> {}; -template<> struct bcs_char_traits_impl<wchar_t> : std::char_traits<wchar_t> {}; +template<> struct bcs_char_traits_impl<char> : public std::char_traits<char> {}; +template<> struct bcs_char_traits_impl<wchar_t> : public std::char_traits<wchar_t> {}; #endif template<typename CharT> @@ -147,4 +147,4 @@ public: #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER +#endif // BOOST_TEST_UTILS_BCS_CHAR_TRAITS_HPP diff --git a/boost/test/utils/basic_cstring/compare.hpp b/boost/test/utils/basic_cstring/compare.hpp index 5c1416f17a..f071a2540c 100644 --- a/boost/test/utils/basic_cstring/compare.hpp +++ b/boost/test/utils/basic_cstring/compare.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : class basic_cstring comparisons implementation // *************************************************************************** -#ifndef BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER -#define BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER +#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP +#define BOOST_TEST_UTILS_BASIC_CSTRING_COMPARE_HPP // Boost.Test #include <boost/test/utils/basic_cstring/basic_cstring.hpp> @@ -81,8 +81,8 @@ class case_ins_less : public std::binary_function<basic_cstring<CharT>,basic_cst public: bool operator()( basic_cstring<CharT> x, basic_cstring<CharT> y ) const { - return x.size() != y.size() - ? x.size() < y.size() + return x.size() != y.size() + ? x.size() < y.size() : ut_detail::case_ins<CharT>::compare( x.begin(), y.begin(), x.size() ) < 0; } }; @@ -90,7 +90,7 @@ public: //____________________________________________________________________________// // ************************************************************************** // -// ************** operator < ************** // +// ************** operators <,> ************** // // ************************************************************************** // template<class CharT> @@ -99,11 +99,43 @@ operator <( boost::unit_test::basic_cstring<CharT> const& x, boost::unit_test::basic_cstring<CharT> const& y ) { typedef typename boost::unit_test::basic_cstring<CharT>::traits_type traits_type; - return x.size() != y.size() - ? x.size() < y.size() + return x.size() != y.size() + ? x.size() < y.size() : traits_type::compare( x.begin(), y.begin(), x.size() ) < 0; } +//____________________________________________________________________________// + +template<class CharT> +inline bool +operator <=( boost::unit_test::basic_cstring<CharT> const& x, + boost::unit_test::basic_cstring<CharT> const& y ) +{ + return !(y < x); +} + +//____________________________________________________________________________// + +template<class CharT> +inline bool +operator >( boost::unit_test::basic_cstring<CharT> const& x, + boost::unit_test::basic_cstring<CharT> const& y ) +{ + return y < x; +} + +//____________________________________________________________________________// + +template<class CharT> +inline bool +operator >=( boost::unit_test::basic_cstring<CharT> const& x, + boost::unit_test::basic_cstring<CharT> const& y ) +{ + return !(x < y); +} + +//____________________________________________________________________________// + } // namespace unit_test } // namespace boost diff --git a/boost/test/utils/basic_cstring/io.hpp b/boost/test/utils/basic_cstring/io.hpp index 1c8a2a3826..218ae6a520 100644 --- a/boost/test/utils/basic_cstring/io.hpp +++ b/boost/test/utils/basic_cstring/io.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : basic_cstring i/o implementation // *************************************************************************** -#ifndef BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER -#define BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER +#ifndef BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP +#define BOOST_TEST_UTILS_BASIC_CSTRING_IO_HPP // Boost.Test #include <boost/test/utils/basic_cstring/basic_cstring.hpp> diff --git a/boost/test/utils/callback.hpp b/boost/test/utils/callback.hpp deleted file mode 100644 index 6aa0a15773..0000000000 --- a/boost/test/utils/callback.hpp +++ /dev/null @@ -1,310 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to 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) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : -// *************************************************************************** - -#ifndef BOOST_TEST_CALLBACK_020505GER -#define BOOST_TEST_CALLBACK_020505GER - -// Boost -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/shared_ptr.hpp> - -#include <boost/test/detail/suppress_warnings.hpp> - -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(BOOST_INTEL, <= 700) -# define BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR -#endif - -//____________________________________________________________________________// - -namespace boost { - -namespace unit_test { - -namespace ut_detail { - -struct unused {}; - -template<typename R> -struct invoker { - template<typename Functor> - R invoke( Functor& f ) { return f(); } - template<typename Functor, typename T1> - R invoke( Functor& f, T1 t1 ) { return f( t1 ); } - template<typename Functor, typename T1, typename T2> - R invoke( Functor& f, T1 t1, T2 t2 ) { return f( t1, t2 ); } - template<typename Functor, typename T1, typename T2, typename T3> - R invoke( Functor& f, T1 t1, T2 t2, T3 t3 ) { return f( t1, t2, t3 ); } -}; - -//____________________________________________________________________________// - -template<> -struct invoker<unused> { - template<typename Functor> - unused invoke( Functor& f ) { f(); return unused(); } - template<typename Functor, typename T1> - unused invoke( Functor& f, T1 t1 ) { f( t1 ); return unused(); } - template<typename Functor, typename T1, typename T2> - unused invoke( Functor& f, T1 t1, T2 t2 ) { f( t1, t2 ); return unused(); } - template<typename Functor, typename T1, typename T2, typename T3> - unused invoke( Functor& f, T1 t1, T2 t2, T3 t3 ) { f( t1, t2, t3 ); return unused(); } -}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -// ************************************************************************** // -// ************** unit_test::callback0 ************** // -// ************************************************************************** // - -namespace ut_detail { - -template<typename R> -struct callback0_impl { - virtual ~callback0_impl() {} - - virtual R invoke() = 0; -}; - -//____________________________________________________________________________// - -template<typename R, typename Functor> -struct callback0_impl_t : callback0_impl<R> { - // Constructor - explicit callback0_impl_t( Functor f ) : m_f( f ) {} - - virtual R invoke() { return invoker<R>().invoke( m_f ); } - -private: - // Data members - Functor m_f; -}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -template<typename R = ut_detail::unused> -class callback0 { -public: - // Constructors - callback0() {} -#ifdef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR - callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {} -#endif - - template<typename Functor> - callback0( Functor f ) - : m_impl( new ut_detail::callback0_impl_t<R,Functor>( f ) ) {} - - void operator=( callback0 const& rhs ) { m_impl = rhs.m_impl; } - - template<typename Functor> - void operator=( Functor f ) { m_impl.reset( new ut_detail::callback0_impl_t<R,Functor>( f ) ); } - - R operator()() const { return m_impl->invoke(); } - - bool operator!() const { return !m_impl; } - -private: - // Data members - boost::shared_ptr<ut_detail::callback0_impl<R> > m_impl; -}; - -// ************************************************************************** // -// ************** unit_test::callback1 ************** // -// ************************************************************************** // - -namespace ut_detail { - -template<typename R, typename T1> -struct callback1_impl { - virtual ~callback1_impl() {} - - virtual R invoke( T1 t1 ) = 0; -}; - -//____________________________________________________________________________// - -template<typename R, typename T1,typename Functor> -struct callback1_impl_t : callback1_impl<R,T1> { - // Constructor - explicit callback1_impl_t( Functor f ) : m_f( f ) {} - - virtual R invoke( T1 t1 ) { return invoker<R>().invoke( m_f, t1 ); } - -private: - // Data members - Functor m_f; -}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -template<typename T1,typename R = ut_detail::unused> -class callback1 { -public: - // Constructors - callback1() {} -#ifdef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR - callback1( callback1 const& rhs ) : m_impl( rhs.m_impl ) {} -#endif - - template<typename Functor> - callback1( Functor f ) - : m_impl( new ut_detail::callback1_impl_t<R,T1,Functor>( f ) ) {} - - void operator=( callback1 const& rhs ) { m_impl = rhs.m_impl; } - - template<typename Functor> - void operator=( Functor f ) { m_impl.reset( new ut_detail::callback1_impl_t<R,T1,Functor>( f ) ); } - - R operator()( T1 t1 ) const { return m_impl->invoke( t1 ); } - - bool operator!() const { return !m_impl; } - -private: - // Data members - boost::shared_ptr<ut_detail::callback1_impl<R,T1> > m_impl; -}; - -// ************************************************************************** // -// ************** unit_test::callback2 ************** // -// ************************************************************************** // - -namespace ut_detail { - -template<typename R, typename T1,typename T2> -struct callback2_impl { - virtual ~callback2_impl() {} - - virtual R invoke( T1 t1, T2 t2 ) = 0; -}; - -//____________________________________________________________________________// - -template<typename R, typename T1, typename T2, typename Functor> -struct callback2_impl_t : callback2_impl<R,T1,T2> { - // Constructor - explicit callback2_impl_t( Functor f ) : m_f( f ) {} - - virtual R invoke( T1 t1, T2 t2 ) { return invoker<R>().template invoke<Functor,T1,T2>( m_f, t1, t2 ); } - -private: - // Data members - Functor m_f; -}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -template<typename T1,typename T2, typename R = ut_detail::unused> -class callback2 { -public: - // Constructors - callback2() {} -#ifdef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR - callback2( callback2 const& rhs ) : m_impl( rhs.m_impl ) {} -#endif - - template<typename Functor> - callback2( Functor f ) : m_impl( new ut_detail::callback2_impl_t<R,T1,T2,Functor>( f ) ) {} - - void operator=( callback2 const& rhs ) { m_impl = rhs.m_impl; } - - template<typename Functor> - void operator=( Functor f ) { m_impl.reset( new ut_detail::callback2_impl_t<R,T1,T2,Functor>( f ) ); } - - R operator()( T1 t1, T2 t2 ) const { return m_impl->invoke( t1, t2 ); } - - bool operator!() const { return !m_impl; } - -private: - // Data members - boost::shared_ptr<ut_detail::callback2_impl<R,T1,T2> > m_impl; -}; - -// ************************************************************************** // -// ************** unit_test::callback3 ************** // -// ************************************************************************** // - -namespace ut_detail { - -template<typename R, typename T1, typename T2, typename T3> -struct callback3_impl { - virtual ~callback3_impl() {} - - virtual R invoke( T1 t1, T2 t2, T3 t3 ) = 0; -}; - -//____________________________________________________________________________// - -template<typename R, typename T1, typename T2, typename T3, typename Functor> -struct callback3_impl_t : callback3_impl<R,T1,T2,T3> { - // Constructor - explicit callback3_impl_t( Functor f ) : m_f( f ) {} - - virtual R invoke( T1 t1, T2 t2, T3 t3 ) { return invoker<R>().invoke( m_f, t1, t2, t3 ); } - -private: - // Data members - Functor m_f; -}; - -//____________________________________________________________________________// - -} // namespace ut_detail - -template<typename T1,typename T2, typename T3, typename R = ut_detail::unused> -class callback3 { -public: - // Constructors - callback3() {} -#ifdef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR - callback3( callback3 const& rhs ) : m_impl( rhs.m_impl ) {} -#endif - - template<typename Functor> - callback3( Functor f ) - : m_impl( new ut_detail::callback3_impl_t<R,T1,T2,T3,Functor>( f ) ) {} - - void operator=( callback3 const& rhs ) { m_impl = rhs.m_impl; } - - template<typename Functor> - void operator=( Functor f ) { m_impl.reset( new ut_detail::callback3_impl_t<R,T1,T2,T3,Functor>( f ) ); } - - R operator()( T1 t1, T2 t2, T3 t3 ) const { return m_impl->invoke( t1, t2, t3 ); } - - bool operator!() const { return !m_impl; } - -private: - // Data members - boost::shared_ptr<ut_detail::callback3_impl<R,T1,T2,T3> > m_impl; -}; - -} // namespace unit_test - -} // namespace boost - -#undef BOOST_CALLBACK_EXPLICIT_COPY_CONSTRUCTOR - -//____________________________________________________________________________// - -#include <boost/test/detail/enable_warnings.hpp> - -#endif // BOOST_TEST_CALLBACK_020505GER diff --git a/boost/test/utils/class_properties.hpp b/boost/test/utils/class_properties.hpp index d2070dc97a..1781a17dd0 100644 --- a/boost/test/utils/class_properties.hpp +++ b/boost/test/utils/class_properties.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2001-2008. +// (C) Copyright Gennadiy Rozental 2001-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,12 +9,12 @@ // // Version : $Revision$ // -// Description : simple facility that mimmic notion of read-only read-write +// Description : simple facility that mimmic notion of read-only read-write // properties in C++ classes. Original idea by Henrik Ravn. // *************************************************************************** -#ifndef BOOST_TEST_CLASS_PROPERTIES_HPP_071894GER -#define BOOST_TEST_CLASS_PROPERTIES_HPP_071894GER +#ifndef BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP +#define BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP // Boost.Test #include <boost/test/detail/config.hpp> @@ -36,7 +36,6 @@ //____________________________________________________________________________// namespace boost { - namespace unit_test { // ************************************************************************** // @@ -116,28 +115,6 @@ DEFINE_PROPERTY_FREE_BINARY_OPERATOR( != ) #undef DEFINE_PROPERTY_FREE_BINARY_OPERATOR -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - -#define DEFINE_PROPERTY_LOGICAL_OPERATOR( op ) \ -template<class PropertyType> \ -inline bool \ -operator op( bool b, class_property<PropertyType> const& p ) \ -{ \ - return b op p.get(); \ -} \ -template<class PropertyType> \ -inline bool \ -operator op( class_property<PropertyType> const& p, bool b ) \ -{ \ - return b op p.get(); \ -} \ -/**/ - -DEFINE_PROPERTY_LOGICAL_OPERATOR( && ) -DEFINE_PROPERTY_LOGICAL_OPERATOR( || ) - -#endif - // ************************************************************************** // // ************** readonly_property ************** // // ************************************************************************** // @@ -209,13 +186,10 @@ public: //____________________________________________________________________________// } // unit_test - } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> #undef BOOST_TEST_NO_PROTECTED_USING -#endif // BOOST_TEST_CLASS_PROPERTIES_HPP_071894GER +#endif // BOOST_TEST_UTILS_CLASS_PROPERTIES_HPP diff --git a/boost/test/utils/custom_manip.hpp b/boost/test/utils/custom_manip.hpp index 52705a9703..43b581df16 100644 --- a/boost/test/utils/custom_manip.hpp +++ b/boost/test/utils/custom_manip.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : simple helpers for creating cusom output manipulators // *************************************************************************** -#ifndef BOOST_TEST_CUSTOM_MANIP_HPP_071894GER -#define BOOST_TEST_CUSTOM_MANIP_HPP_071894GER +#ifndef BOOST_TEST_UTILS_CUSTOM_MANIP_HPP +#define BOOST_TEST_UTILS_CUSTOM_MANIP_HPP // STL #include <iosfwd> @@ -23,7 +23,6 @@ //____________________________________________________________________________// namespace boost { - namespace unit_test { // ************************************************************************** // @@ -53,11 +52,8 @@ operator<<( std::ostream& ostr, custom_manip<Uniq> const& ) { return custom_prin //____________________________________________________________________________// } // namespace unit_test - } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TEST_CUSTOM_MANIP_HPP_071894GER +#endif // BOOST_TEST_UTILS_CUSTOM_MANIP_HPP diff --git a/boost/test/utils/fixed_mapping.hpp b/boost/test/utils/fixed_mapping.hpp index e8139337bb..299a77b789 100644 --- a/boost/test/utils/fixed_mapping.hpp +++ b/boost/test/utils/fixed_mapping.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2001-2008. +// (C) Copyright Gennadiy Rozental 2001-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : fixed sized mapping with specified invalid value // *************************************************************************** -#ifndef BOOST_TEST_FIXED_MAPPING_HPP_071894GER -#define BOOST_TEST_FIXED_MAPPING_HPP_071894GER +#ifndef BOOST_TEST_UTILS_FIXED_MAPPING_HPP +#define BOOST_TEST_UTILS_FIXED_MAPPING_HPP // Boost #include <boost/preprocessor/repetition/repeat.hpp> @@ -32,7 +32,6 @@ //____________________________________________________________________________// namespace boost { - namespace unit_test { // configurable maximum fixed sized mapping size supported by this header. @@ -107,11 +106,8 @@ private: }; } // namespace unit_test - } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> #undef MAX_MAP_SIZE @@ -120,5 +116,5 @@ private: #undef CONSTR_DECL #undef CONTRUCTORS -#endif // BOOST_TEST_FIXED_MAPPING_HPP_071894GER +#endif // BOOST_TEST_UTILS_FIXED_MAPPING_HPP diff --git a/boost/test/utils/foreach.hpp b/boost/test/utils/foreach.hpp index da32ae300f..d57b628cd3 100644 --- a/boost/test/utils/foreach.hpp +++ b/boost/test/utils/foreach.hpp @@ -1,5 +1,5 @@ // (C) Copyright Eric Niebler 2004-2005 -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // 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) @@ -11,14 +11,14 @@ // Version : $Revision$ // // Description : this is an abridged version of an excelent BOOST_FOREACH facility -// presented by Eric Niebler. I am so fond of it so I can't wait till it -// going to be accepted into Boost. Also I need version with less number of dependencies -// and more portable. This version doesn't support rvalues and will reeveluate it's +// presented by Eric Niebler. I am so fond of it so I can't wait till it +// going to be accepted into Boost. Also I need version with less number of dependencies +// and more portable. This version doesn't support rvalues and will reeveluate it's // parameters, but should be good enough for my purposes. // *************************************************************************** -#ifndef BOOST_TEST_FOREACH_HPP_021005GER -#define BOOST_TEST_FOREACH_HPP_021005GER +#ifndef BOOST_TEST_UTILS_FOREACH_HPP +#define BOOST_TEST_UTILS_FOREACH_HPP // Boost.Test #include <boost/test/detail/config.hpp> @@ -35,9 +35,7 @@ //____________________________________________________________________________// namespace boost { - namespace unit_test { - namespace for_each { // ************************************************************************** // @@ -178,6 +176,28 @@ next( static_any_t cur, C const&, mpl::true_ ) //____________________________________________________________________________// // ************************************************************************** // +// ************** prev ************** // +// ************************************************************************** // + +template<typename C> +inline void +prev( static_any_t cur, C&, mpl::false_ ) +{ + --static_any_cast<BOOST_DEDUCED_TYPENAME C::iterator>( cur ); +} + +//____________________________________________________________________________// + +template<typename C> +inline void +prev( static_any_t cur, C const&, mpl::true_ ) +{ + --static_any_cast<BOOST_DEDUCED_TYPENAME C::const_iterator>( cur ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // // ************** deref ************** // // ************************************************************************** // @@ -233,6 +253,13 @@ deref( static_any_t cur, C const&, ::boost::type<RefType>, mpl::true_ ) BOOST_TEST_FE_IS_CONST( COL ) ) \ /**/ +#define BOOST_TEST_FE_PREV( COL ) \ + ::boost::unit_test::for_each::prev( \ + BOOST_TEST_FE_CUR_VAR, \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + #define BOOST_FOREACH_NOOP(COL) \ ((void)&(COL)) @@ -266,16 +293,24 @@ for( bool BOOST_TEST_FE_CON_VAR = true; !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ /**/ +#define BOOST_TEST_REVERSE_FOREACH( RefType, var, COL ) \ +if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_END( COL ) ) {} else \ +if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \ +for( bool BOOST_TEST_FE_CON_VAR = true; \ + BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); ) \ + \ + if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ + if( (BOOST_TEST_FE_PREV( COL ), false) ) {} else \ + for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ + !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ +/**/ + //____________________________________________________________________________// } // namespace for_each - } // namespace unit_test - } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TEST_FOREACH_HPP_021005GER +#endif // BOOST_TEST_UTILS_FOREACH_HPP diff --git a/boost/test/utils/is_cstring.hpp b/boost/test/utils/is_cstring.hpp new file mode 100644 index 0000000000..5172246c67 --- /dev/null +++ b/boost/test/utils/is_cstring.hpp @@ -0,0 +1,58 @@ +// (C) Copyright Gennadiy Rozental 2012-2014. +// 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) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines the is_cstring type trait +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP +#define BOOST_TEST_UTILS_IS_CSTRING_HPP + +// Boost +#include <boost/mpl/bool.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/decay.hpp> +#include <boost/type_traits/remove_pointer.hpp> + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** is_cstring ************** // +// ************************************************************************** // + +namespace ut_detail { + +template<typename T> +struct is_cstring_impl : public mpl::false_ {}; + +template<typename T> +struct is_cstring_impl<T const*> : public is_cstring_impl<T*> {}; + +template<typename T> +struct is_cstring_impl<T const* const> : public is_cstring_impl<T*> {}; + +template<> +struct is_cstring_impl<char*> : public mpl::true_ {}; + +template<> +struct is_cstring_impl<wchar_t*> : public mpl::true_ {}; + +} // namespace ut_detail + +template<typename T> +struct is_cstring : public ut_detail::is_cstring_impl<typename decay<T>::type> {}; + +} // namespace unit_test +} // namespace boost + +#endif // BOOST_TEST_UTILS_IS_CSTRING_HPP diff --git a/boost/test/utils/is_forward_iterable.hpp b/boost/test/utils/is_forward_iterable.hpp new file mode 100644 index 0000000000..8b46b1b268 --- /dev/null +++ b/boost/test/utils/is_forward_iterable.hpp @@ -0,0 +1,152 @@ +// (C) Copyright Gennadiy Rozental 2012-2014. +// 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) + +// See http://www.boost.org/libs/test for the library home page. +// +//! @file +//! Defines the is_forward_iterable collection type trait +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP +#define BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP + +#if defined(BOOST_NO_CXX11_DECLTYPE) || defined(BOOST_NO_CXX11_NULLPTR) || defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) + #define BOOST_TEST_FWD_ITERABLE_CXX03 +#endif + + +#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) +// Boost +#include <boost/mpl/bool.hpp> + +// STL +#include <list> +#include <vector> +#include <map> +#include <set> + +#else + +// Boost +#include <boost/utility/declval.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/test/utils/is_cstring.hpp> + +// STL +#include <utility> +#include <type_traits> + +#endif +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** is_forward_iterable ************** // +// ************************************************************************** // + +#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) && !defined(BOOST_TEST_DOXYGEN_DOC__) +template<typename T> +struct is_forward_iterable : public mpl::false_ {}; + +template<typename T> +struct is_forward_iterable<T const> : public is_forward_iterable<T> {}; + +template<typename T> +struct is_forward_iterable<T&> : public is_forward_iterable<T> {}; + +template<typename T, typename A> +struct is_forward_iterable< std::vector<T, A> > : public mpl::true_ {}; + +template<typename T, typename A> +struct is_forward_iterable< std::list<T, A> > : public mpl::true_ {}; + +template<typename K, typename V, typename C, typename A> +struct is_forward_iterable< std::map<K, V, C, A> > : public mpl::true_ {}; + +template<typename K, typename C, typename A> +struct is_forward_iterable< std::set<K, C, A> > : public mpl::true_ {}; + +#else + +namespace ut_detail { + + template<typename T> + struct is_present : public mpl::true_ {}; + + // some compiler do not implement properly decltype non expression involving members (eg. VS2013) + // a workaround is to use -> decltype syntax. + template <class T> + struct has_member_size { + private: + struct nil_t {}; + template<typename U> static auto test(U*) -> decltype( boost::declval<U>().size() ); + template<typename> static nil_t test(...); + + public: + static bool const value = !std::is_same< decltype(test<T>(nullptr)), nil_t>::value; + }; + + template <class T> + struct has_member_begin { + private: + struct nil_t {}; + template<typename U> static auto test(U*) -> decltype( boost::declval<U>().begin() ); + template<typename> static nil_t test(...); + public: + static bool const value = !std::is_same< decltype(test<T>(nullptr)), nil_t>::value; + }; + + template <class T> + struct has_member_end { + private: + struct nil_t {}; + template<typename U> static auto test(U*) -> decltype( boost::declval<U>().end() ); + template<typename> static nil_t test(...); + public: + static bool const value = !std::is_same< decltype(test<T>(nullptr)), nil_t>::value; + }; + + template <class T, class enabled = void> + struct is_forward_iterable_impl : std::false_type + {}; + + template <class T> + struct is_forward_iterable_impl< + T, + typename std::enable_if< + is_present<typename T::const_iterator>::value && + is_present<typename T::value_type>::value && + has_member_size<T>::value && + has_member_begin<T>::value && + has_member_end<T>::value && + !is_cstring<T>::value + >::type + > : std::true_type + {}; + + +} // namespace ut_detail + + +/*! Indicates that a specific type implements the forward iterable concept. + */ +template<typename T> +struct is_forward_iterable { + typedef typename std::remove_reference<T>::type T_ref; + typedef ut_detail::is_forward_iterable_impl<T_ref> is_fwd_it_t; + typedef mpl::bool_<is_fwd_it_t::value> type; + enum { value = is_fwd_it_t::value }; +}; + +#endif /* defined(BOOST_TEST_FWD_ITERABLE_CXX03) */ + +} // namespace unit_test +} // namespace boost + +#endif // BOOST_TEST_UTILS_IS_FORWARD_ITERABLE_HPP diff --git a/boost/test/utils/iterator/ifstream_line_iterator.hpp b/boost/test/utils/iterator/ifstream_line_iterator.hpp index d41b09d8f8..9a2154828c 100644 --- a/boost/test/utils/iterator/ifstream_line_iterator.hpp +++ b/boost/test/utils/iterator/ifstream_line_iterator.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,11 +9,11 @@ // // Version : $Revision$ // -// Description : +// Description : // *************************************************************************** -#ifndef BOOST_IFSTREAM_LINE_ITERATOR_HPP_071894GER -#define BOOST_IFSTREAM_LINE_ITERATOR_HPP_071894GER +#ifndef BOOST_TEST_UTILS_IFSTREAM_LINE_ITERATOR_HPP +#define BOOST_TEST_UTILS_IFSTREAM_LINE_ITERATOR_HPP // Boost #include <boost/test/utils/iterator/istream_line_iterator.hpp> @@ -87,6 +87,7 @@ public: #ifdef BOOST_MSVC # pragma warning(default: 4355) +# pragma warning(pop) #endif typedef basic_ifstream_line_iterator<char> ifstream_line_iterator; @@ -100,5 +101,5 @@ typedef basic_ifstream_line_iterator<wchar_t> wifstream_line_iterator; #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_IFSTREAM_LINE_ITERATOR_HPP_071894GER +#endif // BOOST_TEST_UTILS_IFSTREAM_LINE_ITERATOR_HPP diff --git a/boost/test/utils/iterator/input_iterator_facade.hpp b/boost/test/utils/iterator/input_iterator_facade.hpp index 6ce07b2af2..a160808971 100644 --- a/boost/test/utils/iterator/input_iterator_facade.hpp +++ b/boost/test/utils/iterator/input_iterator_facade.hpp @@ -1,19 +1,16 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. // -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : Input iterator facade +//!@file +//! Input iterator facade // *************************************************************************** -#ifndef BOOST_INPUT_ITERATOR_FACADE_HPP_071894GER -#define BOOST_INPUT_ITERATOR_FACADE_HPP_071894GER +#ifndef BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP +#define BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP // Boost #include <boost/iterator/iterator_facade.hpp> @@ -80,7 +77,7 @@ private: // iterator facade interface implementation void increment() { - // we make post-end incrementation indefinetly safe + // we make post-end incrementation indefinetly safe if( m_valid ) m_valid = input_iterator_core_access::get( *static_cast<Derived*>(this) ); } @@ -105,5 +102,5 @@ private: #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_INPUT_ITERATOR_FACADE_HPP_071894GER +#endif // BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP diff --git a/boost/test/utils/iterator/istream_line_iterator.hpp b/boost/test/utils/iterator/istream_line_iterator.hpp index 5aa517d7c8..f75be9ca77 100644 --- a/boost/test/utils/iterator/istream_line_iterator.hpp +++ b/boost/test/utils/iterator/istream_line_iterator.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,11 +9,11 @@ // // Version : $Revision$ // -// Description : +// Description : // *************************************************************************** -#ifndef BOOST_ISTREAM_LINE_ITERATOR_HPP_071894GER -#define BOOST_ISTREAM_LINE_ITERATOR_HPP_071894GER +#ifndef BOOST_TEST_UTILS_ISTREAM_LINE_ITERATOR_HPP +#define BOOST_TEST_UTILS_ISTREAM_LINE_ITERATOR_HPP // Boost #include <boost/test/utils/basic_cstring/basic_cstring.hpp> @@ -58,7 +58,7 @@ public: this->init(); } explicit basic_istream_line_iterator( istream_type& input ) - : m_input_stream( &input ) + : m_input_stream( &input ) , m_delimeter( input.widen( '\n' ) ) { this->init(); @@ -89,5 +89,5 @@ typedef basic_istream_line_iterator<wchar_t> wistream_line_iterator; #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_ISTREAM_LINE_ITERATOR_HPP_071894GER +#endif // BOOST_TEST_UTILS_ISTREAM_LINE_ITERATOR_HPP diff --git a/boost/test/utils/iterator/token_iterator.hpp b/boost/test/utils/iterator/token_iterator.hpp index 001507847d..c41f071739 100644 --- a/boost/test/utils/iterator/token_iterator.hpp +++ b/boost/test/utils/iterator/token_iterator.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : token iterator for string and range tokenization // *************************************************************************** -#ifndef BOOST_TOKEN_ITERATOR_HPP_071894GER -#define BOOST_TOKEN_ITERATOR_HPP_071894GER +#ifndef BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP +#define BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP // Boost #include <boost/config.hpp> @@ -47,7 +47,7 @@ namespace unit_test { // ************** ti_delimeter_type ************** // // ************************************************************************** // -enum ti_delimeter_type { +enum ti_delimeter_type { dt_char, // character is delimeter if it among explicit list of some characters dt_ispunct, // character is delimeter if it satisfies ispunct functor dt_isspace, // character is delimeter if it satisfies isspace functor @@ -93,7 +93,7 @@ public: void set_delimeters( Src d ) { nfp::optionally_assign( m_delimeters, d ); - + if( !m_delimeters.is_empty() ) m_type = dt_char; } @@ -135,7 +135,7 @@ struct token_assigner { template<typename Iterator, typename C, typename T> static void assign( Iterator b, Iterator e, std::basic_string<C,T>& t ) { for( ; b != e; ++b ) t += *b; } - + template<typename Iterator, typename C> static void assign( Iterator b, Iterator e, basic_cstring<C>& t ) { t.assign( b, e ); } #else @@ -151,7 +151,7 @@ struct token_assigner { template<> struct token_assigner<single_pass_traversal_tag> { template<typename Iterator, typename Token> - static void assign( Iterator b, Iterator e, Token& t ) {} + static void assign( Iterator /*b*/, Iterator /*e*/, Token& /*t*/ ) {} template<typename Iterator, typename Token> static void append_move( Iterator& b, Token& t ) { t += *b; ++b; } @@ -213,7 +213,7 @@ protected: nfp::optionally_assign( m_tokens_left, m, max_tokens ); } - template<typename Iter> + template<typename Iter> bool get( Iter& begin, Iter end ) { typedef ut_detail::token_assigner<BOOST_DEDUCED_TYPENAME iterator_traversal<Iter>::type> Assigner; @@ -240,22 +240,22 @@ protected: Assigner::append_move( begin, this->m_value ); --m_tokens_left; - } + } else { // m_keep_empty_tokens is true check_point = begin; if( begin == end ) { - if( m_token_produced ) + if( m_token_produced ) return false; m_token_produced = true; } if( m_is_kept( *begin ) ) { - if( m_token_produced ) + if( m_token_produced ) Assigner::append_move( begin, this->m_value ); m_token_produced = !m_token_produced; - } + } else if( !m_token_produced && m_is_dropped( *begin ) ) m_token_produced = true; else { @@ -414,5 +414,5 @@ make_range_token_iterator( Iter begin, Iter end, Modifier const& m ) #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TOKEN_ITERATOR_HPP_071894GER +#endif // BOOST_TEST_UTILS_TOKEN_ITERATOR_HPP diff --git a/boost/test/utils/lazy_ostream.hpp b/boost/test/utils/lazy_ostream.hpp index 87d96602f9..8aef34133b 100644 --- a/boost/test/utils/lazy_ostream.hpp +++ b/boost/test/utils/lazy_ostream.hpp @@ -1,19 +1,15 @@ -// (C) Copyright Gennadiy Rozental 2008. +// (C) Copyright Gennadiy Rozental 2008-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. // -// File : $RCSfile$ -// -// Version : $Revision$ -// // Description : contains definition for all test tools in test toolbox // *************************************************************************** -#ifndef BOOST_TEST_LAZY_OSTREAM_HPP_070708GER -#define BOOST_TEST_LAZY_OSTREAM_HPP_070708GER +#ifndef BOOST_TEST_UTILS_LAZY_OSTREAM_HPP +#define BOOST_TEST_UTILS_LAZY_OSTREAM_HPP // Boost.Test #include <boost/test/detail/config.hpp> @@ -30,11 +26,12 @@ // ************************************************************************** // namespace boost { - namespace unit_test { class lazy_ostream { public: + virtual ~lazy_ostream() {} + static lazy_ostream& instance() { static lazy_ostream inst; return inst; } friend std::ostream& operator<<( std::ostream& ostr, lazy_ostream const& o ) { return o( ostr ); } @@ -45,13 +42,7 @@ public: // actual printing interface; to be accessed only by this class and children virtual std::ostream& operator()( std::ostream& ostr ) const { return ostr; } protected: - explicit lazy_ostream( bool empty = true ) : m_empty( empty ) {} - - // protected destructor to make sure right one is called -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) -public: -#endif - BOOST_TEST_PROTECTED_VIRTUAL ~lazy_ostream() {} + explicit lazy_ostream( bool p_empty = true ) : m_empty( p_empty ) {} private: // Data members @@ -60,32 +51,43 @@ private: //____________________________________________________________________________// -template<typename T> +template<typename PrevType, typename T, typename StorageT=T const&> class lazy_ostream_impl : public lazy_ostream { public: - lazy_ostream_impl( lazy_ostream const& prev, T value ) + lazy_ostream_impl( PrevType const& prev, T const& value ) : lazy_ostream( false ) , m_prev( prev ) , m_value( value ) - {} -private: + { + } + virtual std::ostream& operator()( std::ostream& ostr ) const { return m_prev(ostr) << m_value; } - +private: // Data members - lazy_ostream const& m_prev; - T m_value; + PrevType const& m_prev; + StorageT m_value; }; //____________________________________________________________________________// template<typename T> -inline lazy_ostream_impl<T const&> +inline lazy_ostream_impl<lazy_ostream,T> operator<<( lazy_ostream const& prev, T const& v ) { - return lazy_ostream_impl<T const&>( prev, v ); + return lazy_ostream_impl<lazy_ostream,T>( prev, v ); +} + +//____________________________________________________________________________// + +template<typename PrevPrevType, typename TPrev, typename T> +inline lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,T> +operator<<( lazy_ostream_impl<PrevPrevType,TPrev> const& prev, T const& v ) +{ + typedef lazy_ostream_impl<PrevPrevType,TPrev> PrevType; + return lazy_ostream_impl<PrevType,T>( prev, v ); } //____________________________________________________________________________// @@ -93,22 +95,36 @@ operator<<( lazy_ostream const& prev, T const& v ) #if BOOST_TEST_USE_STD_LOCALE template<typename R,typename S> -inline lazy_ostream_impl<R& (BOOST_TEST_CALL_DECL *)(S&)> +inline lazy_ostream_impl<lazy_ostream,R& (BOOST_TEST_CALL_DECL *)(S&),R& (BOOST_TEST_CALL_DECL *)(S&)> operator<<( lazy_ostream const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) { - return lazy_ostream_impl<R& (BOOST_TEST_CALL_DECL *)(S&)>( prev, man ); + typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&); + + return lazy_ostream_impl<lazy_ostream,ManipType,ManipType>( prev, man ); +} + +//____________________________________________________________________________// + +template<typename PrevPrevType, typename TPrev,typename R,typename S> +inline lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,R& (BOOST_TEST_CALL_DECL *)(S&),R& (BOOST_TEST_CALL_DECL *)(S&)> +operator<<( lazy_ostream_impl<PrevPrevType,TPrev> const& prev, R& (BOOST_TEST_CALL_DECL *man)(S&) ) +{ + typedef R& (BOOST_TEST_CALL_DECL * ManipType)(S&); + + return lazy_ostream_impl<lazy_ostream_impl<PrevPrevType,TPrev>,ManipType,ManipType>( prev, man ); } //____________________________________________________________________________// #endif -} // namespace unit_test +#define BOOST_TEST_LAZY_MSG( M ) (::boost::unit_test::lazy_ostream::instance() << M) +} // namespace unit_test } // namespace boost //____________________________________________________________________________// #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TEST_LAZY_OSTREAM_HPP_070708GER +#endif // BOOST_TEST_UTILS_LAZY_OSTREAM_HPP diff --git a/boost/test/utils/named_params.hpp b/boost/test/utils/named_params.hpp index 0a6277ce12..0e66dc39c5 100644 --- a/boost/test/utils/named_params.hpp +++ b/boost/test/utils/named_params.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,29 +12,32 @@ // Description : facilities for named function parameters support // *************************************************************************** -#ifndef BOOST_TEST_NAMED_PARAM_022505GER -#define BOOST_TEST_NAMED_PARAM_022505GER +#ifndef BOOST_TEST_UTILS_NAMED_PARAM +#define BOOST_TEST_UTILS_NAMED_PARAM // Boost #include <boost/config.hpp> #include <boost/detail/workaround.hpp> +#include <boost/mpl/bool.hpp> // Boost.Test #include <boost/test/utils/rtti.hpp> #include <boost/test/utils/assign_op.hpp> #include <boost/type_traits/remove_reference.hpp> +#include <boost/type_traits/remove_cv.hpp> + +#include <boost/test/detail/throw_exception.hpp> #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// namespace boost { - namespace nfp { // named function parameters // ************************************************************************** // -// ************** forward declarations ************** // +// ************** forward declarations ************** // // ************************************************************************** // template<typename T, typename unique_id,typename RefType> struct named_parameter; @@ -52,16 +55,17 @@ struct access_to_invalid_parameter {}; //____________________________________________________________________________// -inline void -report_access_to_invalid_parameter() +inline void +report_access_to_invalid_parameter(bool v) { - throw access_to_invalid_parameter(); + if(v) + BOOST_TEST_IMPL_THROW( access_to_invalid_parameter() ); } //____________________________________________________________________________// // ************************************************************************** // -// ************** nil ************** // +// ************** nil ************** // // ************************************************************************** // struct nil { @@ -71,35 +75,35 @@ struct nil { #else operator T const&() const #endif - { report_access_to_invalid_parameter(); static T* v = 0; return *v; } + { report_access_to_invalid_parameter(true); static T* v = 0; return *v; } template<typename T> T any_cast() const - { report_access_to_invalid_parameter(); static typename remove_reference<T>::type* v = 0; return *v; } + { report_access_to_invalid_parameter(true); static typename remove_reference<T>::type* v = 0; return *v; } template<typename Arg1> nil operator()( Arg1 const& ) - { report_access_to_invalid_parameter(); return nil(); } + { report_access_to_invalid_parameter(true); return nil(); } template<typename Arg1,typename Arg2> nil operator()( Arg1 const&, Arg2 const& ) - { report_access_to_invalid_parameter(); return nil(); } + { report_access_to_invalid_parameter(true); return nil(); } template<typename Arg1,typename Arg2,typename Arg3> nil operator()( Arg1 const&, Arg2 const&, Arg3 const& ) - { report_access_to_invalid_parameter(); return nil(); } + { report_access_to_invalid_parameter(true); return nil(); } // Visitation support template<typename Visitor> - void apply_to( Visitor& V ) const {} + void apply_to( Visitor& /*v*/ ) const {} static nil& inst() { static nil s_inst; return s_inst; } private: nil() {} }; - + // ************************************************************************** // -// ************** named_parameter_base ************** // +// ************** named_parameter_base ************** // // ************************************************************************** // template<typename Derived> @@ -112,11 +116,11 @@ struct named_parameter_base { //____________________________________________________________________________// // ************************************************************************** // -// ************** named_parameter_combine ************** // +// ************** named_parameter_combine ************** // // ************************************************************************** // template<typename NP, typename Rest = nil> -struct named_parameter_combine +struct named_parameter_combine : Rest , named_parameter_base<named_parameter_combine<NP,Rest> > { typedef typename NP::ref_type res_type; @@ -164,10 +168,10 @@ private: } // namespace nfp_detail // ************************************************************************** // -// ************** named_parameter ************** // +// ************** named_parameter ************** // // ************************************************************************** // -template<typename T, typename unique_id,typename ReferenceType=T&> +template<typename T, typename unique_id, typename ReferenceType=T&> struct named_parameter : nfp_detail::named_parameter_base<named_parameter<T, unique_id,ReferenceType> > { @@ -177,7 +181,7 @@ struct named_parameter typedef unique_id id; // Constructor - explicit named_parameter( ref_type v ) + explicit named_parameter( ref_type v ) : m_value( v ) , m_erased( false ) {} @@ -216,7 +220,7 @@ private: //____________________________________________________________________________// // ************************************************************************** // -// ************** no_params ************** // +// ************** no_params ************** // // ************************************************************************** // namespace nfp_detail { @@ -230,7 +234,7 @@ nfp_detail::no_params_type no_params( '\0' ); //____________________________________________________________________________// // ************************************************************************** // -// ************** keyword ************** // +// ************** keyword ************** // // ************************************************************************** // template<typename unique_id, bool required = false> @@ -252,7 +256,7 @@ struct keyword { //____________________________________________________________________________// // ************************************************************************** // -// ************** typed_keyword ************** // +// ************** typed_keyword ************** // // ************************************************************************** // template<typename T, typename unique_id, bool required = false> @@ -281,14 +285,14 @@ struct typed_keyword<bool,unique_id,false> //____________________________________________________________________________// // ************************************************************************** // -// ************** optionally_assign ************** // +// ************** optionally_assign ************** // // ************************************************************************** // template<typename T> inline void optionally_assign( T&, nfp_detail::nil ) { - nfp_detail::report_access_to_invalid_parameter(); + nfp_detail::report_access_to_invalid_parameter(true); } //____________________________________________________________________________// @@ -319,11 +323,48 @@ optionally_assign( T& target, Params const& p, Keyword k ) //____________________________________________________________________________// -} // namespace nfp +// ************************************************************************** // +// ************** is_named_params ************** // +// ************************************************************************** // + +template<typename T> +struct is_named_params : public boost::mpl::false_ {}; +template<typename T, typename unique_id, typename ReferenceType> +struct is_named_params<named_parameter<T,unique_id,ReferenceType> > : public boost::mpl::true_ {}; + +template<typename NP, typename Rest> +struct is_named_params<nfp_detail::named_parameter_combine<NP,Rest> > : public boost::mpl::true_ {}; + +// ************************************************************************** // +// ************** param_type ************** // +// ************************************************************************** // + +template<typename Params,typename KeywordType,typename DefaultType=void> +struct param_type { + typedef DefaultType type; +}; + +template<typename NP,typename Rest,typename Keyword,typename DefaultType> +struct param_type<nfp_detail::named_parameter_combine<NP,Rest>,Keyword,DefaultType> : param_type<Rest,Keyword,DefaultType> { +}; + +template<typename T, typename unique_id, typename ReferenceType,bool required,typename DefaultType> +struct param_type<named_parameter<T,unique_id,ReferenceType>,keyword<unique_id,required>,DefaultType> { + typedef typename boost::remove_cv<T>::type type; +}; + +template<typename T, typename unique_id, typename ReferenceType,typename Rest,bool required,typename DefaultType> +struct param_type<nfp_detail::named_parameter_combine<named_parameter<T,unique_id,ReferenceType>,Rest>, + keyword<unique_id,required>, + DefaultType> { + typedef typename boost::remove_cv<T>::type type; +}; + +} // namespace nfp } // namespace boost #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TEST_NAMED_PARAM_022505GER +#endif // BOOST_TEST_UTILS_NAMED_PARAM diff --git a/boost/test/utils/nullstream.hpp b/boost/test/utils/nullstream.hpp index deca6ed15f..b4cedd0842 100644 --- a/boost/test/utils/nullstream.hpp +++ b/boost/test/utils/nullstream.hpp @@ -1,7 +1,7 @@ -// (C) Copyright Gennadiy Rozental 2002-2008. -// (C) Copyright Daryle Walker 2000-2001. +// (C) Copyright Gennadiy Rozental 2002-2014. +// (C) Copyright Daryle Walker 2000-2001. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -13,13 +13,15 @@ // Description : simulate /dev/null stream // *************************************************************************** -#ifndef BOOST_NULLSTREAM_HPP_071894GER -#define BOOST_NULLSTREAM_HPP_071894GER +#ifndef BOOST_TEST_UTILS_NULLSTREAM_HPP +#define BOOST_TEST_UTILS_NULLSTREAM_HPP +// STL #include <ostream> // for std::basic_ostream #include <streambuf> // for std::basic_streambuf #include <string> // for std::char_traits +// Boost #include <boost/utility/base_from_member.hpp> #include <boost/test/detail/suppress_warnings.hpp> @@ -86,6 +88,7 @@ public: #ifdef BOOST_MSVC # pragma warning(default: 4355) +# pragma warning(pop) #endif typedef basic_onullstream<char> onullstream; @@ -97,4 +100,4 @@ typedef basic_onullstream<wchar_t> wonullstream; #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_NULLSTREAM_HPP_071894GER +#endif // BOOST_TEST_UTILS_NULLSTREAM_HPP diff --git a/boost/test/utils/rtti.hpp b/boost/test/utils/rtti.hpp index f795a2cbe4..42f2bc648b 100644 --- a/boost/test/utils/rtti.hpp +++ b/boost/test/utils/rtti.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,13 +12,13 @@ // Description : simple facilities for accessing type information at runtime // *************************************************************************** -#ifndef BOOST_TEST_RTTI_HPP_062604GER -#define BOOST_TEST_RTTI_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RTTI_HPP +#define BOOST_TEST_UTILS_RTTI_HPP +// C Runtime #include <cstddef> namespace boost { - namespace rtti { // ************************************************************************** // @@ -43,7 +43,7 @@ private: //____________________________________________________________________________// -template<typename T> +template<typename T> inline id_t type_id() { @@ -58,7 +58,6 @@ type_id() //____________________________________________________________________________// } // namespace rtti - } // namespace boost -#endif // BOOST_RT_RTTI_HPP_062604GER +#endif // BOOST_TEST_UTILS_RTTI_HPP diff --git a/boost/test/utils/runtime/argument.hpp b/boost/test/utils/runtime/argument.hpp index d0f420aab7..b5133e23c3 100644 --- a/boost/test/utils/runtime/argument.hpp +++ b/boost/test/utils/runtime/argument.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : model of actual argument (both typed and abstract interface) // *************************************************************************** -#ifndef BOOST_RT_ARGUMENT_HPP_062604GER -#define BOOST_RT_ARGUMENT_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP +#define BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -29,7 +29,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { // ************************************************************************** // // ************** runtime::argument ************** // @@ -105,8 +105,8 @@ arg_value( argument& arg_ ) //____________________________________________________________________________// -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_ARGUMENT_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_ARGUMENT_HPP diff --git a/boost/test/utils/runtime/cla/argument_factory.hpp b/boost/test/utils/runtime/cla/argument_factory.hpp index 19ccc08c0f..6683540612 100644 --- a/boost/test/utils/runtime/cla/argument_factory.hpp +++ b/boost/test/utils/runtime/cla/argument_factory.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : generic typed_argument_factory implementation // *************************************************************************** -#ifndef BOOST_RT_CLA_ARGUMENT_FACTORY_HPP_062604GER -#define BOOST_RT_CLA_ARGUMENT_FACTORY_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_FACTORY_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_FACTORY_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -33,15 +33,13 @@ #include <boost/test/utils/runtime/cla/iface/argument_factory.hpp> -// Boost.Test -#include <boost/test/utils/callback.hpp> - // Boost #include <boost/optional.hpp> +#include <boost/function/function2.hpp> namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -72,7 +70,7 @@ struct typed_argument_factory : public argument_factory { typed_argument_factory() : m_value_interpreter( rt_cla_detail::default_value_interpreter() ) {} - BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~typed_argument_factory() {} + BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~typed_argument_factory() {} // properties modification template<typename Modifier> @@ -82,24 +80,24 @@ struct typed_argument_factory : public argument_factory { optionally_assign( m_value_interpreter, m, interpreter ); if( m.has( default_value ) ) { - BOOST_RT_PARAM_VALIDATE_LOGIC( !m_value_generator, - BOOST_RT_PARAM_LITERAL( "multiple value generators for parameter" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !m_value_generator, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "multiple value generators for parameter" ) ); T const& dv_ref = m[default_value]; m_value_generator = rt_cla_detail::const_generator<T>( dv_ref ); } if( m.has( default_refer_to ) ) { - BOOST_RT_PARAM_VALIDATE_LOGIC( !m_value_generator, - BOOST_RT_PARAM_LITERAL( "multiple value generators for parameter" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !m_value_generator, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "multiple value generators for parameter" ) ); cstring ref_id = m[default_refer_to]; m_value_generator = rt_cla_detail::ref_generator<T>( ref_id ); } if( m.has( assign_to ) ) { - BOOST_RT_PARAM_VALIDATE_LOGIC( !m_value_handler, - BOOST_RT_PARAM_LITERAL( "multiple value handlers for parameter" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !m_value_handler, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "multiple value handlers for parameter" ) ); m_value_handler = rt_cla_detail::assigner<T>( m[assign_to] ); } @@ -112,9 +110,9 @@ struct typed_argument_factory : public argument_factory { // !! private? // Data members - unit_test::callback2<parameter const&,T&> m_value_handler; - unit_test::callback2<parser const&,boost::optional<T>&> m_value_generator; - unit_test::callback2<argv_traverser&,boost::optional<T>&> m_value_interpreter; + boost::function<void (parameter const&,T&)> m_value_handler; + boost::function<void (parser const&,boost::optional<T>&)> m_value_generator; + boost::function<void (argv_traverser&,boost::optional<T>&)> m_value_interpreter; }; //____________________________________________________________________________// @@ -125,23 +123,23 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr ) { boost::optional<T> value; - try { + BOOST_TEST_IMPL_TRY { m_value_interpreter( tr, value ); } - catch( ... ) { // !! should we do that? - BOOST_RT_PARAM_TRACE( "Fail to parse argument value" ); + BOOST_TEST_IMPL_CATCHALL() { // !! should we do that? + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Fail to parse argument value" ); if( !p.p_optional_value ) - throw; + BOOST_TEST_IMPL_RETHROW; } argument_ptr actual_arg = p.actual_argument(); - BOOST_RT_CLA_VALIDATE_INPUT( !!value || p.p_optional_value, tr, - BOOST_RT_PARAM_LITERAL( "Argument value missing for parameter " ) << p.id_2_report() ); + BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( !!value || p.p_optional_value, tr, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Argument value missing for parameter " ) << p.id_2_report() ); - BOOST_RT_CLA_VALIDATE_INPUT( !actual_arg || p.p_multiplicable, tr, - BOOST_RT_PARAM_LITERAL( "Unexpected repetition of the parameter " ) << p.id_2_report() ); + BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( !actual_arg || p.p_multiplicable, tr, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Unexpected repetition of the parameter " ) << p.id_2_report() ); if( !!value && !!m_value_handler ) m_value_handler( p, *value ); @@ -154,7 +152,7 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr ) typedef std::list<boost::optional<T> > optional_list; if( !actual_arg ) - actual_arg.reset( p.p_optional_value + actual_arg.reset( p.p_optional_value ? static_cast<argument*>(new typed_argument<optional_list>( p )) : static_cast<argument*>(new typed_argument<std::list<T> >( p )) ); @@ -165,7 +163,7 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr ) } else { std::list<T>& values = arg_value<std::list<T> >( *actual_arg ); - + values.push_back( *value ); } } @@ -176,7 +174,7 @@ typed_argument_factory<T>::produce_using( parameter& p, argv_traverser& tr ) //____________________________________________________________________________// template<typename T> -inline argument_ptr +inline argument_ptr typed_argument_factory<T>::produce_using( parameter& p, parser const& pa ) { argument_ptr actual_arg; @@ -211,8 +209,8 @@ typed_argument_factory<T>::argument_usage_info( format_stream& fs ) } // namespace boost -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace cla -#endif // BOOST_RT_CLA_ARGUMENT_FACTORY_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_FACTORY_HPP diff --git a/boost/test/utils/runtime/cla/argv_traverser.cpp b/boost/test/utils/runtime/cla/argv_traverser.cpp index a7a44f7fd9..9716b8fb9c 100644 --- a/boost/test/utils/runtime/cla/argv_traverser.cpp +++ b/boost/test/utils/runtime/cla/argv_traverser.cpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,5 +12,5 @@ // Description : offline implementation for argc/argv traverser // *************************************************************************** -#define BOOST_RT_PARAM_INLINE +#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE #include <boost/test/utils/runtime/cla/argv_traverser.ipp> diff --git a/boost/test/utils/runtime/cla/argv_traverser.hpp b/boost/test/utils/runtime/cla/argv_traverser.hpp index 58cf2fe5f7..6f6e03dfc8 100644 --- a/boost/test/utils/runtime/cla/argv_traverser.hpp +++ b/boost/test/utils/runtime/cla/argv_traverser.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : defines facility to hide input traversing details // *************************************************************************** -#ifndef BOOST_RT_CLA_ARGV_TRAVERSER_HPP_062604GER -#define BOOST_RT_CLA_ARGV_TRAVERSER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -27,7 +27,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -84,15 +84,17 @@ private: } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#ifndef BOOST_RT_PARAM_OFFLINE +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE -# define BOOST_RT_PARAM_INLINE inline -# include <boost/test/utils/runtime/cla/argv_traverser.ipp> +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE +# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline +#endif +# include <boost/test/utils/runtime/cla/argv_traverser.ipp> #endif -#endif // BOOST_RT_CLA_ARGV_TRAVERSER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_HPP diff --git a/boost/test/utils/runtime/cla/argv_traverser.ipp b/boost/test/utils/runtime/cla/argv_traverser.ipp index 2b5e3818b3..d1ae93be82 100644 --- a/boost/test/utils/runtime/cla/argv_traverser.ipp +++ b/boost/test/utils/runtime/cla/argv_traverser.ipp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : implements facility to hide input traversing details // *************************************************************************** -#ifndef BOOST_RT_CLA_ARGV_TRAVERSER_IPP_070604GER -#define BOOST_RT_CLA_ARGV_TRAVERSER_IPP_070604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_IPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_IPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/trace.hpp> @@ -30,7 +30,7 @@ namespace std { using ::memcpy; } namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -38,21 +38,23 @@ namespace cla { // ************** runtime::cla::argv_traverser ************** // // ************************************************************************** // -BOOST_RT_PARAM_INLINE +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE argv_traverser::argv_traverser() -: p_ignore_mismatch( false ), p_separator( BOOST_RT_PARAM_LITERAL( ' ' ) ) +: p_ignore_mismatch( false ), p_separator( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' ) ) { } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void argv_traverser::init( int argc, char_type** argv ) { + m_buffer.clear(); + for( int index = 1; index < argc; ++index ) { m_buffer += argv[index]; if( index != argc-1 ) - m_buffer += BOOST_RT_PARAM_LITERAL( ' ' ); + m_buffer += BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' ); } m_remainder.reset( new char_type[m_buffer.size()+1] ); @@ -60,14 +62,14 @@ argv_traverser::init( int argc, char_type** argv ) m_work_buffer = m_buffer; m_commited_end = m_work_buffer.begin(); - BOOST_RT_PARAM_TRACE( "Input buffer: " << m_buffer ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Input buffer: " << m_buffer ); next_token(); } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void argv_traverser::remainder( int& argc, char_type** argv ) { argc = 1; @@ -75,15 +77,16 @@ argv_traverser::remainder( int& argc, char_type** argv ) while(pos < m_remainder_size ) { argv[argc++] = m_remainder.get() + pos; - pos = std::find( m_remainder.get() + pos, m_remainder.get() + m_remainder_size, - BOOST_RT_PARAM_LITERAL( ' ' ) ) - m_remainder.get(); - m_remainder[pos++] = BOOST_RT_PARAM_LITERAL( '\0' ); + pos = static_cast<size_t>(std::find( m_remainder.get() + pos, m_remainder.get() + m_remainder_size, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' ) ) - + m_remainder.get()); + m_remainder[pos++] = BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '\0' ); } } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE cstring +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE cstring argv_traverser::token() const { return m_token; @@ -91,7 +94,7 @@ argv_traverser::token() const //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void argv_traverser::next_token() { if( m_work_buffer.is_empty() ) @@ -108,7 +111,7 @@ argv_traverser::next_token() //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE cstring +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE cstring argv_traverser::input() const { return m_work_buffer; @@ -116,7 +119,7 @@ argv_traverser::input() const //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void argv_traverser::trim( std::size_t size ) { m_work_buffer.trim_left( size ); @@ -131,7 +134,7 @@ argv_traverser::trim( std::size_t size ) //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool argv_traverser::match_front( cstring str ) { return m_work_buffer.size() < str.size() ? false : m_work_buffer.substr( 0, str.size() ) == str; @@ -139,7 +142,7 @@ argv_traverser::match_front( cstring str ) //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool argv_traverser::match_front( char_type c ) { return first_char( m_work_buffer ) == c; @@ -147,7 +150,7 @@ argv_traverser::match_front( char_type c ) //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool argv_traverser::eoi() const { return m_work_buffer.is_empty(); @@ -155,7 +158,7 @@ argv_traverser::eoi() const //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void argv_traverser::commit() { m_commited_end = m_work_buffer.begin(); @@ -163,7 +166,7 @@ argv_traverser::commit() //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void argv_traverser::rollback() { m_work_buffer.assign( m_commited_end, m_work_buffer.end() ); @@ -174,15 +177,15 @@ argv_traverser::rollback() //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE std::size_t +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE std::size_t argv_traverser::input_pos() const { - return m_work_buffer.begin() - m_commited_end; + return static_cast<std::size_t>(m_work_buffer.begin() - m_commited_end); } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool argv_traverser::handle_mismatch() { if( !p_ignore_mismatch ) @@ -202,8 +205,8 @@ argv_traverser::handle_mismatch() } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_ARGV_TRAVERSER_IPP_070604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGV_TRAVERSER_IPP diff --git a/boost/test/utils/runtime/cla/basic_parameter.hpp b/boost/test/utils/runtime/cla/basic_parameter.hpp index 8b826bba0a..817b12a301 100644 --- a/boost/test/utils/runtime/cla/basic_parameter.hpp +++ b/boost/test/utils/runtime/cla/basic_parameter.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : generic custom parameter generator // *************************************************************************** -#ifndef BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER -#define BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_BASIC_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_BASIC_PARAMETER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -28,7 +28,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -40,7 +40,7 @@ template<typename T, typename IdPolicy> class basic_parameter : private base_from_member<IdPolicy>, public typed_parameter<T> { public: // Constructors - explicit basic_parameter( cstring n ) + explicit basic_parameter( cstring n ) : base_from_member<IdPolicy>() , typed_parameter<T>( base_from_member<IdPolicy>::member ) { @@ -59,7 +59,7 @@ public: //____________________________________________________________________________// -#define BOOST_RT_CLA_NAMED_PARAM_GENERATORS( param_type ) \ +#define BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAM_GENERATORS( param_type ) \ template<typename T> \ inline shared_ptr<param_type ## _t<T> > \ param_type( cstring name = cstring() ) \ @@ -78,8 +78,8 @@ param_type( cstring name = cstring() ) } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_BASIC_PARAMETER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_BASIC_PARAMETER_HPP diff --git a/boost/test/utils/runtime/cla/char_parameter.cpp b/boost/test/utils/runtime/cla/char_parameter.cpp index 017402e8e7..6e85fe4136 100644 --- a/boost/test/utils/runtime/cla/char_parameter.cpp +++ b/boost/test/utils/runtime/cla/char_parameter.cpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,5 +12,5 @@ // Description : offline implementation of char parameter // *************************************************************************** -#define BOOST_RT_PARAM_INLINE +#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE #include <boost/test/utils/runtime/cla/char_parameter.ipp> diff --git a/boost/test/utils/runtime/cla/char_parameter.hpp b/boost/test/utils/runtime/cla/char_parameter.hpp index 425c24f3f9..0e2928b1af 100644 --- a/boost/test/utils/runtime/cla/char_parameter.hpp +++ b/boost/test/utils/runtime/cla/char_parameter.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : defines model of parameter with single char name // *************************************************************************** -#ifndef BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER -#define BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -24,7 +24,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -36,7 +36,7 @@ class char_name_policy : public basic_naming_policy { public: // Constructor char_name_policy(); - BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~char_name_policy() {} + BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~char_name_policy() {} // policy interface virtual bool conflict_with( identification_policy const& ) const; @@ -47,7 +47,7 @@ public: { basic_naming_policy::accept_modifier( m ); - BOOST_RT_PARAM_VALIDATE_LOGIC( p_name->size() <= 1, "Invalid parameter name " << p_name ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( p_name->size() <= 1, "Invalid parameter name " << p_name ); } }; @@ -84,15 +84,17 @@ char_parameter( char_type name ) } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#ifndef BOOST_RT_PARAM_OFFLINE +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE -# define BOOST_RT_PARAM_INLINE inline -# include <boost/test/utils/runtime/cla/char_parameter.ipp> +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE +# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline +#endif +# include <boost/test/utils/runtime/cla/char_parameter.ipp> #endif -#endif // BOOST_RT_CLA_CHAR_PARAMETER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_HPP diff --git a/boost/test/utils/runtime/cla/char_parameter.ipp b/boost/test/utils/runtime/cla/char_parameter.ipp index db4d0c1ed1..398ce79ac4 100644 --- a/boost/test/utils/runtime/cla/char_parameter.ipp +++ b/boost/test/utils/runtime/cla/char_parameter.ipp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : implements model of parameter with single char name // *************************************************************************** -#ifndef BOOST_RT_CLA_CHAR_PARAMETER_IPP_062904GER -#define BOOST_RT_CLA_CHAR_PARAMETER_IPP_062904GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_IPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_IPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -22,7 +22,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -30,19 +30,19 @@ namespace cla { // ************** char_name_policy ************** // // ************************************************************************** // -BOOST_RT_PARAM_INLINE +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE char_name_policy::char_name_policy() : basic_naming_policy( rtti::type_id<char_name_policy>() ) { - assign_op( p_prefix.value, BOOST_RT_PARAM_CSTRING_LITERAL( "-" ), 0 ); + assign_op( p_prefix.value, BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "-" ), 0 ); } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool char_name_policy::conflict_with( identification_policy const& id ) const { - return id.p_type_id == p_type_id && + return id.p_type_id == p_type_id && p_name == static_cast<char_name_policy const&>( id ).p_name; } @@ -50,8 +50,8 @@ char_name_policy::conflict_with( identification_policy const& id ) const } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_CHAR_PARAMETER_IPP_062904GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_CHAR_PARAMETER_IPP diff --git a/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp b/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp index 0d59595612..a70b6d1fb7 100644 --- a/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp +++ b/boost/test/utils/runtime/cla/detail/argument_value_usage.hpp @@ -1,10 +1,9 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied warranty, -// and with no claim as to its suitability for any purpose. - -// See http://www.boost.org for updates, documentation, and revision history. +// (C) Copyright Gennadiy Rozental 2005-2014. +// 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) + +// See http://www.boost.org/libs/test for the library home page. // // File : $RCSfile$ // @@ -13,8 +12,8 @@ // Description : argument usage printing helpers // *************************************************************************** -#ifndef BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER -#define BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_VALUE_USAGE_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_VALUE_USAGE_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -32,7 +31,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -47,7 +46,7 @@ template<typename T> inline void argument_value_usage( format_stream& fs, long, T* = 0 ) { - fs << BOOST_RT_PARAM_CSTRING_LITERAL( "<value>" ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "<value>" ); } //____________________________________________________________________________// @@ -57,7 +56,7 @@ template<typename T> inline void argument_value_usage( format_stream& fs, int, std::list<T>* = 0 ) { - fs << BOOST_RT_PARAM_CSTRING_LITERAL( "(<value1>, ..., <valueN>)" ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "(<value1>, ..., <valueN>)" ); } //____________________________________________________________________________// @@ -66,7 +65,7 @@ argument_value_usage( format_stream& fs, int, std::list<T>* = 0 ) inline void argument_value_usage( format_stream& fs, int, bool* = 0 ) { - fs << BOOST_RT_PARAM_CSTRING_LITERAL( "yes|y|no|n" ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "yes|y|no|n" ); } //____________________________________________________________________________// @@ -75,8 +74,8 @@ argument_value_usage( format_stream& fs, int, bool* = 0 ) } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_ARGUMENT_VALUE_USAGE_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ARGUMENT_VALUE_USAGE_HPP diff --git a/boost/test/utils/runtime/cla/dual_name_parameter.cpp b/boost/test/utils/runtime/cla/dual_name_parameter.cpp index c715de349e..ab034ff04c 100644 --- a/boost/test/utils/runtime/cla/dual_name_parameter.cpp +++ b/boost/test/utils/runtime/cla/dual_name_parameter.cpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,5 +12,5 @@ // Description : offline implementation of generic parameter with dual naming // *************************************************************************** -#define BOOST_RT_PARAM_INLINE +#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE #include <boost/test/utils/runtime/cla/dual_name_parameter.ipp> diff --git a/boost/test/utils/runtime/cla/dual_name_parameter.hpp b/boost/test/utils/runtime/cla/dual_name_parameter.hpp index 26ac657c86..789b67ad1d 100644 --- a/boost/test/utils/runtime/cla/dual_name_parameter.hpp +++ b/boost/test/utils/runtime/cla/dual_name_parameter.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : defines model of generic parameter with dual naming // *************************************************************************** -#ifndef BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER -#define BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -76,21 +76,23 @@ public: //____________________________________________________________________________// -BOOST_RT_CLA_NAMED_PARAM_GENERATORS( dual_name_parameter ) +BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAM_GENERATORS( dual_name_parameter ) //____________________________________________________________________________// } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#ifndef BOOST_RT_PARAM_OFFLINE +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE -# define BOOST_RT_PARAM_INLINE inline -# include <boost/test/utils/runtime/cla/dual_name_parameter.ipp> +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE +# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline +#endif +# include <boost/test/utils/runtime/cla/dual_name_parameter.ipp> #endif -#endif // BOOST_RT_CLA_DUAL_NAME_PARAMETER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_HPP diff --git a/boost/test/utils/runtime/cla/dual_name_parameter.ipp b/boost/test/utils/runtime/cla/dual_name_parameter.ipp index 6e3a37f58d..e39d132d62 100644 --- a/boost/test/utils/runtime/cla/dual_name_parameter.ipp +++ b/boost/test/utils/runtime/cla/dual_name_parameter.ipp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : implements model of generic parameter with dual naming // *************************************************************************** -#ifndef BOOST_RT_CLA_DUAL_NAME_PARAMETER_IPP_062904GER -#define BOOST_RT_CLA_DUAL_NAME_PARAMETER_IPP_062904GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_IPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_IPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -31,11 +31,11 @@ namespace cla { // ************** dual_name_policy ************** // // ************************************************************************** // -BOOST_RT_PARAM_INLINE +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE dual_name_policy::dual_name_policy() { - m_primary.accept_modifier( prefix = BOOST_RT_PARAM_CSTRING_LITERAL( "--" ) ); - m_secondary.accept_modifier( prefix = BOOST_RT_PARAM_CSTRING_LITERAL( "-" ) ); + m_primary.accept_modifier( prefix = BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "--" ) ); + m_secondary.accept_modifier( prefix = BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "-" ) ); } //____________________________________________________________________________// @@ -46,8 +46,8 @@ template<typename K> inline void split( string_name_policy& snp, char_name_policy& cnp, cstring src, K const& k ) { - cstring::iterator sep = std::find( src.begin(), src.end(), BOOST_RT_PARAM_LITERAL( '|' ) ); - + cstring::iterator sep = std::find( src.begin(), src.end(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '|' ) ); + if( sep != src.begin() ) snp.accept_modifier( k = cstring( src.begin(), sep ) ); @@ -57,7 +57,7 @@ split( string_name_policy& snp, char_name_policy& cnp, cstring src, K const& k ) } // local namespace -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void dual_name_policy::set_prefix( cstring src ) { split( m_primary, m_secondary, src, prefix ); @@ -65,7 +65,7 @@ dual_name_policy::set_prefix( cstring src ) //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void dual_name_policy::set_name( cstring src ) { split( m_primary, m_secondary, src, name ); @@ -73,7 +73,7 @@ dual_name_policy::set_name( cstring src ) //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void dual_name_policy::set_separator( cstring src ) { split( m_primary, m_secondary, src, separator ); @@ -83,8 +83,8 @@ dual_name_policy::set_separator( cstring src ) } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_DUAL_NAME_PARAMETER_IPP_062904GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_DUAL_NAME_PARAMETER_IPP diff --git a/boost/test/utils/runtime/cla/fwd.hpp b/boost/test/utils/runtime/cla/fwd.hpp index b5039339d8..df02974345 100644 --- a/boost/test/utils/runtime/cla/fwd.hpp +++ b/boost/test/utils/runtime/cla/fwd.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : cla subsystem forward declarations // *************************************************************************** -#ifndef BOOST_RT_CLA_FWD_HPP_062604GER -#define BOOST_RT_CLA_FWD_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_FWD_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_FWD_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -48,8 +48,8 @@ class positional_parameter_base; } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_FWD_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_FWD_HPP diff --git a/boost/test/utils/runtime/cla/id_policy.cpp b/boost/test/utils/runtime/cla/id_policy.cpp index c3a5ab8273..b000e26f94 100644 --- a/boost/test/utils/runtime/cla/id_policy.cpp +++ b/boost/test/utils/runtime/cla/id_policy.cpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,5 +12,5 @@ // Description : some generic identification policies offline implementation // *************************************************************************** -#define BOOST_RT_PARAM_INLINE +#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE #include <boost/test/utils/runtime/cla/id_policy.ipp> diff --git a/boost/test/utils/runtime/cla/id_policy.hpp b/boost/test/utils/runtime/cla/id_policy.hpp index 596805ea21..3308b07c61 100644 --- a/boost/test/utils/runtime/cla/id_policy.hpp +++ b/boost/test/utils/runtime/cla/id_policy.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Use, modification, and distribution are subject to 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) @@ -12,8 +12,8 @@ // Description : some generic identification policies definition // *************************************************************************** -#ifndef BOOST_RT_CLA_ID_POLICY_HPP_062604GER -#define BOOST_RT_CLA_ID_POLICY_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -30,7 +30,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -65,7 +65,7 @@ protected: explicit basic_naming_policy( rtti::id_t dyn_type ) : identification_policy( dyn_type ) {} - BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~basic_naming_policy() {} + BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~basic_naming_policy() {} // Naming policy interface virtual bool match_prefix( argv_traverser& tr ) const; @@ -102,11 +102,11 @@ public: } virtual void usage_info( format_stream& fs ) const { - fs << BOOST_RT_PARAM_LITERAL( '{' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '{' ); m_primary.usage_info( fs ); - fs << BOOST_RT_PARAM_LITERAL( '|' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '|' ); m_secondary.usage_info( fs ); - fs << BOOST_RT_PARAM_LITERAL( '}' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '}' ); } virtual bool matching( parameter const& p, argv_traverser& tr, bool primary ) const { @@ -122,7 +122,7 @@ public: } protected: - BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~dual_id_policy() {} + BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~dual_id_policy() {} // Data members PrimaryId m_primary; @@ -131,15 +131,17 @@ protected: } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#ifndef BOOST_RT_PARAM_OFFLINE +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE -# define BOOST_RT_PARAM_INLINE inline -# include <boost/test/utils/runtime/cla/id_policy.ipp> +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE +# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline +#endif +# include <boost/test/utils/runtime/cla/id_policy.ipp> #endif -#endif // BOOST_RT_CLA_ID_POLICY_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_HPP diff --git a/boost/test/utils/runtime/cla/id_policy.ipp b/boost/test/utils/runtime/cla/id_policy.ipp index 5498b9a8d0..879ccfd1e1 100644 --- a/boost/test/utils/runtime/cla/id_policy.ipp +++ b/boost/test/utils/runtime/cla/id_policy.ipp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : some generic identification policies implementation // *************************************************************************** -#ifndef BOOST_RT_CLA_ID_POLICY_IPP_062904GER -#define BOOST_RT_CLA_ID_POLICY_IPP_062904GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_IPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_IPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -31,18 +31,18 @@ namespace cla { // ************** basic_naming_policy ************** // // ************************************************************************** // -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void basic_naming_policy::usage_info( format_stream& fs ) const { fs << p_prefix << p_name << p_separator; if( p_separator->empty() ) - fs << BOOST_RT_PARAM_LITERAL( ' ' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' ); } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool basic_naming_policy::match_prefix( argv_traverser& tr ) const { if( !tr.match_front( p_prefix.get() ) ) @@ -53,8 +53,8 @@ basic_naming_policy::match_prefix( argv_traverser& tr ) const } //____________________________________________________________________________// - -BOOST_RT_PARAM_INLINE bool + +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool basic_naming_policy::match_name( argv_traverser& tr ) const { if( !tr.match_front( p_name.get() ) ) @@ -65,8 +65,8 @@ basic_naming_policy::match_name( argv_traverser& tr ) const } //____________________________________________________________________________// - -BOOST_RT_PARAM_INLINE bool + +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool basic_naming_policy::match_separator( argv_traverser& tr, bool optional_value ) const { if( p_separator->empty() ) { @@ -92,12 +92,12 @@ basic_naming_policy::match_separator( argv_traverser& tr, bool optional_value ) //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool basic_naming_policy::matching( parameter const& p, argv_traverser& tr, bool ) const { if( !match_prefix( tr ) ) return false; - + if( !match_name( tr ) ) return false; @@ -111,8 +111,8 @@ basic_naming_policy::matching( parameter const& p, argv_traverser& tr, bool ) co } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_ID_POLICY_IPP_062904GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_ID_POLICY_IPP diff --git a/boost/test/utils/runtime/cla/iface/argument_factory.hpp b/boost/test/utils/runtime/cla/iface/argument_factory.hpp index 03669e0cc0..cbca713bd3 100644 --- a/boost/test/utils/runtime/cla/iface/argument_factory.hpp +++ b/boost/test/utils/runtime/cla/iface/argument_factory.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : defines interface for argument_factory // *************************************************************************** -#ifndef BOOST_RT_CLA_IFACE_ARGUMENT_FACTORY_HPP_062604GER -#define BOOST_RT_CLA_IFACE_ARGUMENT_FACTORY_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ARGUMENT_FACTORY_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ARGUMENT_FACTORY_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -44,8 +44,8 @@ protected: } // namespace boost -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace cla -#endif // BOOST_RT_CLA_IFACE_ARGUMENT_FACTORY_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ARGUMENT_FACTORY_HPP diff --git a/boost/test/utils/runtime/cla/iface/id_policy.hpp b/boost/test/utils/runtime/cla/iface/id_policy.hpp index 1e2d684c25..5fa13e6bc7 100644 --- a/boost/test/utils/runtime/cla/iface/id_policy.hpp +++ b/boost/test/utils/runtime/cla/iface/id_policy.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Use, modification, and distribution are subject to 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) @@ -12,8 +12,8 @@ // Description : defines interface for identification_policy // *************************************************************************** -#ifndef BOOST_RT_CLA_IFACE_ID_POLICY_HPP_062604GER -#define BOOST_RT_CLA_IFACE_ID_POLICY_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ID_POLICY_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ID_POLICY_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -26,7 +26,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -66,8 +66,8 @@ protected: } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_IFACE_ID_POLICY_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_IFACE_ID_POLICY_HPP diff --git a/boost/test/utils/runtime/cla/modifier.hpp b/boost/test/utils/runtime/cla/modifier.hpp index 08924e2f94..4b55536b73 100644 --- a/boost/test/utils/runtime/cla/modifier.hpp +++ b/boost/test/utils/runtime/cla/modifier.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : parameter modifiers // *************************************************************************** -#ifndef BOOST_RT_CLA_MODIFIER_HPP_062604GER -#define BOOST_RT_CLA_MODIFIER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_MODIFIER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_MODIFIER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -62,8 +62,8 @@ nfp::keyword<struct assign_to_t> assign_to; } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_MODIFIER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_MODIFIER_HPP diff --git a/boost/test/utils/runtime/cla/named_parameter.cpp b/boost/test/utils/runtime/cla/named_parameter.cpp index 1b91059fd0..7e94722dc9 100644 --- a/boost/test/utils/runtime/cla/named_parameter.cpp +++ b/boost/test/utils/runtime/cla/named_parameter.cpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,5 +12,5 @@ // Description : offline implementation of named parameter // *************************************************************************** -#define BOOST_RT_PARAM_INLINE +#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE #include <boost/test/utils/runtime/cla/named_parameter.ipp> diff --git a/boost/test/utils/runtime/cla/named_parameter.hpp b/boost/test/utils/runtime/cla/named_parameter.hpp index 9f0ac1dae0..be3f9c570b 100644 --- a/boost/test/utils/runtime/cla/named_parameter.hpp +++ b/boost/test/utils/runtime/cla/named_parameter.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : defines model of named parameter // *************************************************************************** -#ifndef BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER -#define BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -35,7 +35,7 @@ class string_name_policy : public basic_naming_policy { public: // Constructor string_name_policy(); - BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~string_name_policy() {} + BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~string_name_policy() {} // policy interface virtual bool responds_to( cstring name ) const; @@ -73,21 +73,23 @@ public: //____________________________________________________________________________// -BOOST_RT_CLA_NAMED_PARAM_GENERATORS( named_parameter ) +BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAM_GENERATORS( named_parameter ) //____________________________________________________________________________// } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#ifndef BOOST_RT_PARAM_OFFLINE +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE -# define BOOST_RT_PARAM_INLINE inline -# include <boost/test/utils/runtime/cla/named_parameter.ipp> +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE +# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline +#endif +# include <boost/test/utils/runtime/cla/named_parameter.ipp> #endif -#endif // BOOST_RT_CLA_NAMED_PARAMETER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_HPP diff --git a/boost/test/utils/runtime/cla/named_parameter.ipp b/boost/test/utils/runtime/cla/named_parameter.ipp index e04348f53b..e59ebdf89c 100644 --- a/boost/test/utils/runtime/cla/named_parameter.ipp +++ b/boost/test/utils/runtime/cla/named_parameter.ipp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : implements model of named parameter // *************************************************************************** -#ifndef BOOST_RT_CLA_NAMED_PARAMETER_IPP_062904GER -#define BOOST_RT_CLA_NAMED_PARAMETER_IPP_062904GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_IPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_IPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -26,7 +26,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -34,17 +34,17 @@ namespace cla { // ************** string_name_policy ************** // // ************************************************************************** // -BOOST_RT_PARAM_INLINE +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE string_name_policy::string_name_policy() : basic_naming_policy( rtti::type_id<string_name_policy>() ) , m_guess_name( false ) { - assign_op( p_prefix.value, BOOST_RT_PARAM_CSTRING_LITERAL( "-" ), 0 ); + assign_op( p_prefix.value, BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "-" ), 0 ); } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool string_name_policy::responds_to( cstring name ) const { std::pair<cstring::iterator,dstring::const_iterator> mm_pos; @@ -61,7 +61,7 @@ string_name_policy::responds_to( cstring name ) const # pragma warning(disable:4244) #endif -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool string_name_policy::conflict_with( identification_policy const& id ) const { if( id.p_type_id == p_type_id ) { @@ -80,16 +80,16 @@ string_name_policy::conflict_with( identification_policy const& id ) const ((m_guess_name && (mm_pos.second == snp.p_name->end()) ) || // that match other guy and I am guessing (snp.m_guess_name && (mm_pos.first == p_name->end()) )); // or me and the other guy is } - + if( id.p_type_id == rtti::type_id<char_name_policy>() ) { char_name_policy const& cnp = static_cast<char_name_policy const&>( id ); - return m_guess_name && - (p_prefix == cnp.p_prefix) && + return m_guess_name && + (p_prefix == cnp.p_prefix) && unit_test::first_char( cstring( p_name ) ) == unit_test::first_char( cstring( cnp.p_name ) ); } - - return false; + + return false; } #ifdef BOOST_MSVC @@ -98,7 +98,7 @@ string_name_policy::conflict_with( identification_policy const& id ) const //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE bool +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE bool string_name_policy::match_name( argv_traverser& tr ) const { if( !m_guess_name ) @@ -107,13 +107,13 @@ string_name_policy::match_name( argv_traverser& tr ) const cstring in = tr.input(); std::pair<cstring::iterator,dstring::const_iterator> mm_pos; - + mm_pos = unit_test::mismatch( in.begin(), in.end(), p_name->begin(), p_name->end() ); if( mm_pos.first == in.begin() ) return false; - tr.trim( mm_pos.first - in.begin() ); + tr.trim( static_cast<std::size_t>(mm_pos.first - in.begin()) ); return true; } @@ -122,8 +122,8 @@ string_name_policy::match_name( argv_traverser& tr ) const } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_NAMED_PARAMETER_IPP_062904GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAMETER_IPP diff --git a/boost/test/utils/runtime/cla/parameter.hpp b/boost/test/utils/runtime/cla/parameter.hpp index 25680db087..9e26d25007 100644 --- a/boost/test/utils/runtime/cla/parameter.hpp +++ b/boost/test/utils/runtime/cla/parameter.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : defines model of formal parameter // *************************************************************************** -#ifndef BOOST_RT_CLA_PARAMETER_HPP_062604GER -#define BOOST_RT_CLA_PARAMETER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_PARAMETER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -32,7 +32,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -40,7 +40,7 @@ namespace cla { // ************** runtime::cla::parameter ************** // // ************************************************************************** // -class parameter : public BOOST_RT_PARAM_NAMESPACE::parameter { +class parameter : public BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::parameter { public: parameter( identification_policy& ID, argument_factory& F, bool optional_value = false ) : p_optional( false ) @@ -78,9 +78,10 @@ public: } // access methods - bool has_argument() const { return m_actual_argument!=0; } + bool has_argument() const { return !!m_actual_argument; } argument const& actual_argument() const { return *m_actual_argument; } argument_ptr actual_argument() { return m_actual_argument; } + void reset() { m_actual_argument.reset(); } // identification interface @@ -88,20 +89,20 @@ public: bool conflict_with( parameter const& p ) const { return (id_2_report() == p.id_2_report() && !id_2_report().is_empty()) || - m_id_policy.conflict_with( p.m_id_policy ) || + m_id_policy.conflict_with( p.m_id_policy ) || ((m_id_policy.p_type_id != p.m_id_policy.p_type_id) && p.m_id_policy.conflict_with( m_id_policy )); } cstring id_2_report() const { return m_id_policy.id_2_report(); } void usage_info( format_stream& fs ) const - { + { m_id_policy.usage_info( fs ); if( p_optional_value ) - fs << BOOST_RT_PARAM_LITERAL( '[' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '[' ); m_arg_factory.argument_usage_info( fs ); if( p_optional_value ) - fs << BOOST_RT_PARAM_LITERAL( ']' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ']' ); } // argument match/produce based on input @@ -143,8 +144,8 @@ operator-( shared_ptr<Parameter> p, Modifier const& m ) } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_PARAMETER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARAMETER_HPP diff --git a/boost/test/utils/runtime/cla/parser.cpp b/boost/test/utils/runtime/cla/parser.cpp index 4d1d7afe97..8efc17d3b2 100644 --- a/boost/test/utils/runtime/cla/parser.cpp +++ b/boost/test/utils/runtime/cla/parser.cpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -9,10 +9,10 @@ // // Version : $Revision$ // -// Description : offline implementation for parser +// Description : offline implementation for parser // *************************************************************************** #include <boost/test/utils/runtime/config.hpp> -#define BOOST_RT_PARAM_INLINE +#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE #include <boost/test/utils/runtime/cla/parser.ipp> diff --git a/boost/test/utils/runtime/cla/parser.hpp b/boost/test/utils/runtime/cla/parser.hpp index f95d26a095..ffe09e4adc 100644 --- a/boost/test/utils/runtime/cla/parser.hpp +++ b/boost/test/utils/runtime/cla/parser.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : defines parser - public interface for CLA parsing and accessing // *************************************************************************** -#ifndef BOOST_RT_CLA_PARSER_HPP_062604GER -#define BOOST_RT_CLA_PARSER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -32,7 +32,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -76,6 +76,7 @@ private: class parser { public: typedef std::list<parameter_ptr>::const_iterator param_iterator; + typedef std::list<parameter_ptr>::size_type param_size_type; // Constructor explicit parser( cstring program_name = cstring() ); @@ -100,10 +101,12 @@ public: // parameters access param_iterator first_param() const; param_iterator last_param() const; + param_size_type num_params() const { return m_parameters.size(); } + void reset(); // arguments access const_argument_ptr operator[]( cstring string_id ) const; - cstring get( cstring string_id ) const; + cstring get( cstring string_id ) const; template<typename T> T const& get( cstring string_id ) const @@ -139,15 +142,17 @@ private: } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#ifndef BOOST_RT_PARAM_OFFLINE +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE -# define BOOST_RT_PARAM_INLINE inline -# include <boost/test/utils/runtime/cla/parser.ipp> +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE +# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline +#endif +# include <boost/test/utils/runtime/cla/parser.ipp> #endif -#endif // BOOST_RT_CLA_PARSER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_HPP diff --git a/boost/test/utils/runtime/cla/parser.ipp b/boost/test/utils/runtime/cla/parser.ipp index 188d303156..b8a4ca4636 100644 --- a/boost/test/utils/runtime/cla/parser.ipp +++ b/boost/test/utils/runtime/cla/parser.ipp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Use, modification, and distribution are subject to 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) @@ -12,8 +12,8 @@ // Description : implements parser - public interface for CLA parsing and accessing // *************************************************************************** -#ifndef BOOST_RT_CLA_PARSER_IPP_062904GER -#define BOOST_RT_CLA_PARSER_IPP_062904GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_IPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_IPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -35,7 +35,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -43,7 +43,7 @@ namespace cla { // ************** runtime::cla::parser ************** // // ************************************************************************** // -BOOST_RT_PARAM_INLINE +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE parser::parser( cstring program_name ) { assign_op( m_program_name, program_name, 0 ); @@ -51,7 +51,7 @@ parser::parser( cstring program_name ) //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE parser::param_iterator +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE parser::param_iterator parser::first_param() const { return m_parameters.begin(); @@ -59,7 +59,7 @@ parser::first_param() const //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE parser::param_iterator +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE parser::param_iterator parser::last_param() const { return m_parameters.end(); @@ -67,25 +67,25 @@ parser::last_param() const //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE argument const& +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE argument const& parser::valid_argument( cstring string_id ) const { const_argument_ptr arg = (*this)[string_id]; - BOOST_RT_PARAM_VALIDATE_LOGIC( !!arg, "Actual argument for parameter " << string_id << " is not present" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !!arg, "Actual argument for parameter " << string_id << " is not present" ); return *arg; } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE parser& +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE parser& parser::operator<<( parameter_ptr new_param ) { BOOST_TEST_FOREACH( parameter_ptr, old_param, m_parameters ) { - BOOST_RT_PARAM_VALIDATE_LOGIC( !old_param->conflict_with( *new_param ), - BOOST_RT_PARAM_LITERAL( "Definition of parameter " ) << new_param->id_2_report() << - BOOST_RT_PARAM_LITERAL( " conflicts with defintion of parameter " ) << old_param->id_2_report() ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !old_param->conflict_with( *new_param ), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Definition of parameter " ) << new_param->id_2_report() << + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " conflicts with defintion of parameter " ) << old_param->id_2_report() ); } m_parameters.push_back( new_param ); @@ -95,12 +95,12 @@ parser::operator<<( parameter_ptr new_param ) //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void parser::parse( int& argc, char_type** argv ) { if( m_program_name.empty() ) { m_program_name.assign( argv[0] ); - dstring::size_type pos = m_program_name.find_last_of( BOOST_RT_PARAM_LITERAL( "/\\" ) ); + dstring::size_type pos = m_program_name.find_last_of( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "/\\" ) ); if( pos != static_cast<dstring::size_type>(cstring::npos) ) m_program_name.erase( 0, pos+1 ); @@ -108,18 +108,18 @@ parser::parse( int& argc, char_type** argv ) m_traverser.init( argc, argv ); - try { + BOOST_TEST_IMPL_TRY { while( !m_traverser.eoi() ) { parameter_ptr found_param; - BOOST_RT_PARAM_TRACE( "Total " << m_parameters.size() << " parameters registered" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Total " << m_parameters.size() << " parameters registered" ); BOOST_TEST_FOREACH( parameter_ptr const&, curr_param, m_parameters ) { - BOOST_RT_PARAM_TRACE( "Try parameter " << curr_param->id_2_report() ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Try parameter " << curr_param->id_2_report() ); if( curr_param->matching( m_traverser, !found_param ) ) { - BOOST_RT_PARAM_TRACE( "Match found" ); - BOOST_RT_CLA_VALIDATE_INPUT( !found_param, (m_traverser.rollback(),m_traverser), "Ambiguous input" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Match found" ); + BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( !found_param, (m_traverser.rollback(),m_traverser), "Ambiguous input" ); found_param = curr_param; } @@ -128,14 +128,14 @@ parser::parse( int& argc, char_type** argv ) } if( !found_param ) { - BOOST_RT_PARAM_TRACE( "No match found" ); - BOOST_RT_CLA_VALIDATE_INPUT( m_traverser.handle_mismatch(), m_traverser, - BOOST_RT_PARAM_LITERAL( "Unexpected input" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "No match found" ); + BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( m_traverser.handle_mismatch(), m_traverser, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Unexpected input" ) ); continue; } - BOOST_RT_PARAM_TRACE( "Parse argument value" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "Parse argument value" ); found_param->produce_argument( m_traverser ); m_traverser.commit(); @@ -145,31 +145,31 @@ parser::parse( int& argc, char_type** argv ) if( !curr_param->p_optional && !curr_param->actual_argument() ) { curr_param->produce_argument( *this ); - BOOST_RT_PARAM_VALIDATE_LOGIC( curr_param->actual_argument(), - BOOST_RT_PARAM_LITERAL( "Required argument for parameter " ) << curr_param->id_2_report() - << BOOST_RT_PARAM_LITERAL( " is missing" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( curr_param->actual_argument(), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Required argument for parameter " ) << curr_param->id_2_report() + << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " is missing" ) ); } } } - catch( bad_lexical_cast const& ) { - BOOST_RT_PARAM_REPORT_LOGIC_ERROR( - BOOST_RT_PARAM_LITERAL( "String to value convertion error during input parsing" ) ); - } + BOOST_TEST_IMPL_CATCH0( bad_lexical_cast ) { + BOOST_TEST_UTILS_RUNTIME_PARAM_REPORT_LOGIC_ERROR( + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "String to value convertion error during input parsing" ) ); + }; m_traverser.remainder( argc, argv ); } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE const_argument_ptr +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE const_argument_ptr parser::operator[]( cstring string_id ) const { parameter_ptr found_param; BOOST_TEST_FOREACH( parameter_ptr const&, curr_param, m_parameters ) { if( curr_param->responds_to( string_id ) ) { - BOOST_RT_PARAM_VALIDATE_LOGIC( !found_param, - BOOST_RT_PARAM_LITERAL( "Ambiguous parameter string id: " ) << string_id ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !found_param, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Ambiguous parameter string id: " ) << string_id ); found_param = curr_param; } @@ -180,7 +180,7 @@ parser::operator[]( cstring string_id ) const //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE cstring +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE cstring parser::get( cstring string_id ) const { return get<cstring>( string_id ); @@ -188,46 +188,46 @@ parser::get( cstring string_id ) const //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void parser::usage( out_stream& ostr ) { if( m_program_name.empty() ) - assign_op( m_program_name, BOOST_RT_PARAM_CSTRING_LITERAL( "<program>" ), 0 ); + assign_op( m_program_name, BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "<program>" ), 0 ); format_stream fs; fs << m_program_name; BOOST_TEST_FOREACH( parameter_ptr const&, curr_param, m_parameters ) { - fs << BOOST_RT_PARAM_LITERAL( ' ' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ' ' ); if( curr_param->p_optional ) - fs << BOOST_RT_PARAM_LITERAL( '[' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '[' ); curr_param->usage_info( fs ); if( curr_param->p_optional ) - fs << BOOST_RT_PARAM_LITERAL( ']' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ']' ); if( curr_param->p_multiplicable ) { - fs << BOOST_RT_PARAM_CSTRING_LITERAL( " ... " ); - + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( " ... " ); + if( curr_param->p_optional ) - fs << BOOST_RT_PARAM_LITERAL( '[' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '[' ); curr_param->usage_info( fs ); if( curr_param->p_optional ) - fs << BOOST_RT_PARAM_LITERAL( ']' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ']' ); } } - ostr << BOOST_RT_PARAM_CSTRING_LITERAL( "Usage:\n" ) << fs.str() << std::endl; + ostr << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "Usage:\n" ) << fs.str() << std::endl; } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void parser::help( out_stream& ostr ) { usage( ostr ); @@ -239,20 +239,29 @@ parser::help( out_stream& ostr ) continue; if( need_where ) { - ostr << BOOST_RT_PARAM_CSTRING_LITERAL( "where:\n" ); + ostr << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "where:\n" ); need_where = false; } - ostr << curr_param->id_2_report() << BOOST_RT_PARAM_CSTRING_LITERAL( " - " ) << curr_param->p_description << std::endl; + ostr << curr_param->id_2_report() << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( " - " ) << curr_param->p_description << std::endl; } } //____________________________________________________________________________// +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void +parser::reset() +{ + BOOST_TEST_FOREACH( parameter_ptr const&, param, m_parameters ) + param->reset(); +} + +//____________________________________________________________________________// + } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_PARSER_IPP_062904GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_PARSER_IPP diff --git a/boost/test/utils/runtime/cla/positional_parameter.hpp b/boost/test/utils/runtime/cla/positional_parameter.hpp index 60da845627..f378743dd5 100644 --- a/boost/test/utils/runtime/cla/positional_parameter.hpp +++ b/boost/test/utils/runtime/cla/positional_parameter.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : positional parameter model // *************************************************************************** -#ifndef BOOST_RT_CLA_POSITIONAL_PARAMETER_HPP_062604GER -#define BOOST_RT_CLA_POSITIONAL_PARAMETER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_POSITIONAL_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_POSITIONAL_PARAMETER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -22,7 +22,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -35,17 +35,17 @@ public: trivial_id_policy() : identification_policy( rtti::type_id<trivial_id_policy>() ) {} - BOOST_RT_PARAM_UNNEEDED_VIRTUAL ~trivial_id_policy() {} + BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL ~trivial_id_policy() {} virtual bool responds_to( cstring name ) const { return m_name == name; } virtual bool conflict_with( identification_policy const& ) const { return false; } virtual cstring id_2_report() const { return m_name; } virtual void usage_info( format_stream& fs ) const - { + { if( !m_name.empty() ) - fs << BOOST_RT_PARAM_LITERAL( '<' ) << m_name << BOOST_RT_PARAM_LITERAL( '>' ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '<' ) << m_name << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '>' ); else - fs << BOOST_RT_PARAM_CSTRING_LITERAL( "<value>" ); + fs << BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "<value>" ); } virtual bool matching( parameter const& p, argv_traverser&, bool primary ) const @@ -80,12 +80,12 @@ public: //____________________________________________________________________________// -BOOST_RT_CLA_NAMED_PARAM_GENERATORS( positional_parameter ) +BOOST_TEST_UTILS_RUNTIME_CLA_NAMED_PARAM_GENERATORS( positional_parameter ) } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_POSITIONAL_PARAMETER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_POSITIONAL_PARAMETER_HPP diff --git a/boost/test/utils/runtime/cla/typed_parameter.hpp b/boost/test/utils/runtime/cla/typed_parameter.hpp index 3d4c57b23a..70c5bbc009 100644 --- a/boost/test/utils/runtime/cla/typed_parameter.hpp +++ b/boost/test/utils/runtime/cla/typed_parameter.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : generic typed parameter model // *************************************************************************** -#ifndef BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER -#define BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_TYPED_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_TYPED_PARAMETER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -29,7 +29,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -40,8 +40,8 @@ namespace cla { template<typename T> class typed_parameter : public cla::parameter { public: - explicit typed_parameter( identification_policy& ID ) - : cla::parameter( ID, m_arg_factory, rtti::type_id<T>() == rtti::type_id<bool>() ) + explicit typed_parameter( identification_policy& ID ) + : cla::parameter( ID, m_arg_factory, rtti::type_id<T>() == rtti::type_id<bool>() ) {} // parameter properties modification @@ -52,8 +52,8 @@ public: m_arg_factory.accept_modifier( m ); - BOOST_RT_PARAM_VALIDATE_LOGIC( !p_optional || !m_arg_factory.m_value_generator, - BOOST_RT_PARAM_LITERAL( "can't define a value generator for optional parameter " ) << id_2_report() ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !p_optional || !m_arg_factory.m_value_generator, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "can't define a value generator for optional parameter " ) << id_2_report() ); } private: @@ -63,8 +63,8 @@ private: } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_TYPED_PARAMETER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_TYPED_PARAMETER_HPP diff --git a/boost/test/utils/runtime/cla/validation.cpp b/boost/test/utils/runtime/cla/validation.cpp index f5c1e6669a..7f19a5ca45 100644 --- a/boost/test/utils/runtime/cla/validation.cpp +++ b/boost/test/utils/runtime/cla/validation.cpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,5 +12,5 @@ // Description : input validation helpers offline implementation // *************************************************************************** -#define BOOST_RT_PARAM_INLINE +#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE #include <boost/test/utils/runtime/cla/validation.ipp> diff --git a/boost/test/utils/runtime/cla/validation.hpp b/boost/test/utils/runtime/cla/validation.hpp index 57a7f2459f..8a3da14c5b 100644 --- a/boost/test/utils/runtime/cla/validation.hpp +++ b/boost/test/utils/runtime/cla/validation.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : input validation helpers definition // *************************************************************************** -#ifndef BOOST_RT_CLA_VALIDATION_HPP_062604GER -#define BOOST_RT_CLA_VALIDATION_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -22,7 +22,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -34,22 +34,24 @@ void report_input_error( argv_traverser const& tr, format_stream& msg ); //____________________________________________________________________________// -#define BOOST_RT_CLA_VALIDATE_INPUT( b, tr, msg ) \ - if( b ) ; else ::boost::BOOST_RT_PARAM_NAMESPACE::cla::report_input_error( tr, format_stream().ref() << msg ) +#define BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATE_INPUT( b, tr, msg ) \ + if( b ) ; else ::boost::BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::cla::report_input_error( tr, format_stream().ref() << msg ) //____________________________________________________________________________// } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#ifndef BOOST_RT_PARAM_OFFLINE +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE -# define BOOST_RT_PARAM_INLINE inline -# include <boost/test/utils/runtime/cla/validation.ipp> +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE +# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline +#endif +# include <boost/test/utils/runtime/cla/validation.ipp> #endif -#endif // BOOST_RT_CLA_VALIDATION_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_HPP diff --git a/boost/test/utils/runtime/cla/validation.ipp b/boost/test/utils/runtime/cla/validation.ipp index 9728bd6702..9d8cd27b4a 100644 --- a/boost/test/utils/runtime/cla/validation.ipp +++ b/boost/test/utils/runtime/cla/validation.ipp @@ -1,35 +1,31 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. // -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : input validation helpers implementation +//! @file +//! @brief Input validation helpers implementation // *************************************************************************** -#ifndef BOOST_RT_CLA_VALIDATION_IPP_070604GER -#define BOOST_RT_CLA_VALIDATION_IPP_070604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_IPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_IPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> #include <boost/test/utils/runtime/cla/argv_traverser.hpp> #include <boost/test/utils/runtime/cla/validation.hpp> -#include <boost/test/utils/runtime/validation.hpp> // BOOST_RT_PARAM_NAMESPACE::logic_error +#include <boost/test/utils/runtime/validation.hpp> // BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error -// Boost +// Boost.Test #include <boost/test/utils/basic_cstring/io.hpp> - -// STL +#include <boost/test/detail/throw_exception.hpp> namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -37,29 +33,29 @@ namespace cla { // ************** runtime::cla::validation ************** // // ************************************************************************** // -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void report_input_error( argv_traverser const& tr, format_stream& msg ) { if( tr.eoi() ) - msg << BOOST_RT_PARAM_LITERAL( " at the end of input" ); + msg << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " at the end of input" ); else { - msg << BOOST_RT_PARAM_LITERAL( " in the following position: " ); + msg << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " in the following position: " ); if( tr.input().size() > 5 ) - msg << tr.input().substr( 0, 5 ) << BOOST_RT_PARAM_LITERAL( "..." ); + msg << tr.input().substr( 0, 5 ) << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "..." ); else msg << tr.input(); } - throw BOOST_RT_PARAM_NAMESPACE::logic_error( msg.str() ); + BOOST_TEST_IMPL_THROW( BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error( msg.str() ) ); } //____________________________________________________________________________// } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_VALIDATION_IPP_070604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_VALIDATION_IPP diff --git a/boost/test/utils/runtime/cla/value_generator.hpp b/boost/test/utils/runtime/cla/value_generator.hpp index ab15c9b551..0efc25def1 100644 --- a/boost/test/utils/runtime/cla/value_generator.hpp +++ b/boost/test/utils/runtime/cla/value_generator.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : specific value generators // *************************************************************************** -#ifndef BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER -#define BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_GENERATOR_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_GENERATOR_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -74,8 +74,8 @@ private: } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_VALUE_GENERATOR_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_GENERATOR_HPP diff --git a/boost/test/utils/runtime/cla/value_handler.hpp b/boost/test/utils/runtime/cla/value_handler.hpp index fbf99667aa..38792602ac 100644 --- a/boost/test/utils/runtime/cla/value_handler.hpp +++ b/boost/test/utils/runtime/cla/value_handler.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : specific value handlers // *************************************************************************** -#ifndef BOOST_RT_CLA_VALUE_HANDLER_HPP_062604GER -#define BOOST_RT_CLA_VALUE_HANDLER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_HANDLER_HPP +#define BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_HANDLER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -22,7 +22,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace cla { @@ -50,8 +50,8 @@ private: } // namespace cla -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CLA_VALUE_HANDLER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CLA_VALUE_HANDLER_HPP diff --git a/boost/test/utils/runtime/config.hpp b/boost/test/utils/runtime/config.hpp index 771a8ee7af..dfa9ae30de 100644 --- a/boost/test/utils/runtime/config.hpp +++ b/boost/test/utils/runtime/config.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : Runtime.Param library configuration // *************************************************************************** -#ifndef BOOST_RT_CONFIG_HPP_062604GER -#define BOOST_RT_CONFIG_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CONFIG_HPP +#define BOOST_TEST_UTILS_RUNTIME_CONFIG_HPP // Boost #include <boost/config.hpp> @@ -34,26 +34,28 @@ #include <string> #include <cstdlib> +#ifdef __SUNPRO_CC + #include <stdlib.h> +#endif + //____________________________________________________________________________// -#ifndef BOOST_RT_PARAM_CUSTOM_STRING -# ifndef BOOST_RT_PARAM_WIDE_STRING -# define BOOST_RT_PARAM_NAMESPACE runtime +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_CUSTOM_STRING +# ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_WIDE_STRING +# define BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE runtime # else -# define BOOST_RT_PARAM_NAMESPACE wide_runtime +# define BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE wide_runtime # endif #endif -#ifdef __SUNPRO_CC -extern int putenv(char*); -#endif + namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { -#ifndef BOOST_RT_PARAM_CUSTOM_STRING -# ifndef BOOST_RT_PARAM_WIDE_STRING +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_CUSTOM_STRING +# ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_WIDE_STRING typedef char char_type; typedef std::string dstring; @@ -72,6 +74,10 @@ typedef std::basic_ostream<char_type> out_stream; #pragma warning(disable:4996) // putenv #endif +#if defined(__MINGW32__) +extern "C" int putenv( const char * ); +#endif + #ifndef UNDER_CE #if defined(__COMO__) && 0 inline void @@ -97,15 +103,15 @@ putenv_impl( cstring name, cstring value ) #endif #endif -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif -#define BOOST_RT_PARAM_LITERAL( l ) l -#define BOOST_RT_PARAM_CSTRING_LITERAL( l ) cstring( l, sizeof( l ) - 1 ) -#define BOOST_RT_PARAM_GETENV getenv -#define BOOST_RT_PARAM_PUTENV ::boost::BOOST_RT_PARAM_NAMESPACE::putenv_impl -#define BOOST_RT_PARAM_EXCEPTION_INHERIT_STD +#define BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( l ) l +#define BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( l ) cstring( l, sizeof( l ) - 1 ) +#define BOOST_TEST_UTILS_RUNTIME_PARAM_GETENV getenv +#define BOOST_TEST_UTILS_RUNTIME_PARAM_PUTENV ::boost::BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::putenv_impl +#define BOOST_TEST_UTILS_RUNTIME_PARAM_EXCEPTION_INHERIT_STD //____________________________________________________________________________// @@ -133,24 +139,24 @@ putenv_impl( cstring name, cstring value ) } #endif -#define BOOST_RT_PARAM_LITERAL( l ) L ## l -#define BOOST_RT_PARAM_CSTRING_LITERAL( l ) cstring( L ## l, sizeof( L ## l )/sizeof(wchar_t) - 1 ) -#define BOOST_RT_PARAM_GETENV wgetenv -#define BOOST_RT_PARAM_PUTENV putenv_impl +#define BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( l ) L ## l +#define BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( l ) cstring( L ## l, sizeof( L ## l )/sizeof(wchar_t) - 1 ) +#define BOOST_TEST_UTILS_RUNTIME_PARAM_GETENV wgetenv +#define BOOST_TEST_UTILS_RUNTIME_PARAM_PUTENV putenv_impl # endif #endif #ifdef __GNUC__ -#define BOOST_RT_PARAM_UNNEEDED_VIRTUAL virtual +#define BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL virtual #else -#define BOOST_RT_PARAM_UNNEEDED_VIRTUAL +#define BOOST_TEST_UTILS_RUNTIME_PARAM_UNNEEDED_VIRTUAL #endif //____________________________________________________________________________// -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CONFIG_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CONFIG_HPP diff --git a/boost/test/utils/runtime/configuration.hpp b/boost/test/utils/runtime/configuration.hpp index 4c133bdea2..bf731736ee 100644 --- a/boost/test/utils/runtime/configuration.hpp +++ b/boost/test/utils/runtime/configuration.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : abstract interface for the formal parameter // *************************************************************************** -#ifndef BOOST_RT_CONFIGURATION_HPP_062604GER -#define BOOST_RT_CONFIGURATION_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_CONFIGURATION_HPP +#define BOOST_TEST_UTILS_RUNTIME_CONFIGURATION_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -22,7 +22,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { // ************************************************************************** // // ************** runtime::configuration ************** // @@ -54,8 +54,8 @@ public: private: }; -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_CONFIGURATION_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_CONFIGURATION_HPP diff --git a/boost/test/utils/runtime/env/environment.cpp b/boost/test/utils/runtime/env/environment.cpp index a7a0fdf0c2..ddf47b342c 100644 --- a/boost/test/utils/runtime/env/environment.cpp +++ b/boost/test/utils/runtime/env/environment.cpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2004-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -9,7 +9,7 @@ // // Version : $Revision$ // -// Description : implements offline model of program environment +// Description : implements offline model of program environment // *************************************************************************** #include <boost/test/utils/runtime/config.hpp> @@ -19,5 +19,5 @@ # pragma warning(disable: 4701) // local environment 'result' may be used without having been initialized #endif -#define BOOST_RT_PARAM_INLINE +#define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE #include <boost/test/utils/runtime/env/environment.ipp> diff --git a/boost/test/utils/runtime/env/environment.hpp b/boost/test/utils/runtime/env/environment.hpp index f3170ff53a..62b2ae6dc1 100644 --- a/boost/test/utils/runtime/env/environment.hpp +++ b/boost/test/utils/runtime/env/environment.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,11 +9,11 @@ // // Version : $Revision$ // -// Description : defines and implements inline model of program environment +// Description : defines and implements inline model of program environment // *************************************************************************** -#ifndef BOOST_RT_ENV_ENVIRONMENT_HPP_062604GER -#define BOOST_RT_ENV_ENVIRONMENT_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_HPP +#define BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_HPP #ifdef UNDER_CE #error Windows CE does not support environment variables. @@ -29,15 +29,12 @@ #include <boost/test/utils/runtime/env/modifier.hpp> #include <boost/test/utils/runtime/env/variable.hpp> -// Boost.Test -#include <boost/test/utils/callback.hpp> - // Boost #include <boost/optional.hpp> namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { // ************************************************************************** // // ************** runtime::environment implementation ************** // @@ -56,7 +53,7 @@ init_new_var( cstring var_name, Modifiers m = nfp::no_params ) cstring str_value = sys_read_var( new_vd.m_var_name ); if( !str_value.is_empty() ) { - try { + BOOST_TEST_IMPL_TRY { boost::optional<T> value; if( m.has( interpreter ) ) @@ -70,7 +67,7 @@ init_new_var( cstring var_name, Modifiers m = nfp::no_params ) arg_value<T>( *new_vd.m_value ) = *value; } } - catch( ... ) { // !! could we do that + BOOST_TEST_IMPL_CATCHALL() { // !! could we do that // !! should we report an error? } } @@ -158,15 +155,17 @@ namespace environment { namespace env = environment; -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#ifndef BOOST_RT_PARAM_OFFLINE +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_OFFLINE -#define BOOST_RT_PARAM_INLINE inline -#include <boost/test/utils/runtime/env/environment.ipp> +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE +# define BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE inline +#endif +# include <boost/test/utils/runtime/env/environment.ipp> #endif -#endif // BOOST_RT_ENV_ENVIRONMENT_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_HPP diff --git a/boost/test/utils/runtime/env/environment.ipp b/boost/test/utils/runtime/env/environment.ipp index 5a320003f7..6baf72f430 100644 --- a/boost/test/utils/runtime/env/environment.ipp +++ b/boost/test/utils/runtime/env/environment.ipp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,11 +9,11 @@ // // Version : $Revision$ // -// Description : implements model of program environment +// Description : implements model of program environment // *************************************************************************** -#ifndef BOOST_RT_ENV_ENVIRONMENT_IPP_062904GER -#define BOOST_RT_ENV_ENVIRONMENT_IPP_062904GER +#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_IPP +#define BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_IPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -31,7 +31,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace environment { @@ -44,10 +44,10 @@ namespace rt_env_detail { typedef std::map<cstring,rt_env_detail::variable_data> registry; typedef std::list<dstring> keys; -BOOST_RT_PARAM_INLINE registry& s_registry() { static registry instance; return instance; } -BOOST_RT_PARAM_INLINE keys& s_keys() { static keys instance; return instance; } +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE registry& s_registry() { static registry instance; return instance; } +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE keys& s_keys() { static keys instance; return instance; } -BOOST_RT_PARAM_INLINE variable_data& +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE variable_data& new_var_record( cstring var_name ) { // save the name in list of keys @@ -57,15 +57,15 @@ new_var_record( cstring var_name ) // create and return new record variable_data& new_var_data = s_registry()[key]; - + new_var_data.m_var_name = key; - + return new_var_data; } //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE variable_data* +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE variable_data* find_var_record( cstring var_name ) { registry::iterator it = s_registry().find( var_name ); @@ -75,41 +75,41 @@ find_var_record( cstring var_name ) //____________________________________________________________________________// -#ifdef BOOST_MSVC -#pragma warning(push) +#ifdef BOOST_MSVC +#pragma warning(push) #pragma warning(disable:4996) // getenv #endif -BOOST_RT_PARAM_INLINE cstring +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE cstring sys_read_var( cstring var_name ) { using namespace std; - return BOOST_RT_PARAM_GETENV( var_name.begin() ); + return BOOST_TEST_UTILS_RUNTIME_PARAM_GETENV( var_name.begin() ); } -#ifdef BOOST_MSVC -#pragma warning(pop) +#ifdef BOOST_MSVC +#pragma warning(pop) #endif //____________________________________________________________________________// -BOOST_RT_PARAM_INLINE void +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE void sys_write_var( cstring var_name, format_stream& var_value ) { - BOOST_RT_PARAM_PUTENV( var_name, cstring( var_value.str() ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_PUTENV( var_name, cstring( var_value.str() ) ); } //____________________________________________________________________________// } // namespace rt_env_detail -BOOST_RT_PARAM_INLINE variable_base +BOOST_TEST_UTILS_RUNTIME_PARAM_INLINE variable_base var( cstring var_name ) { rt_env_detail::variable_data* vd = rt_env_detail::find_var_record( var_name ); - BOOST_RT_PARAM_VALIDATE_LOGIC( !!vd, - BOOST_RT_PARAM_LITERAL( "First access to the environment variable " ) - << var_name << BOOST_RT_PARAM_LITERAL( " should be typed" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !!vd, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "First access to the environment variable " ) + << var_name << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " should be typed" ) ); return variable_base( *vd ); } @@ -118,8 +118,8 @@ var( cstring var_name ) } // namespace environment -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_ENV_ENVIRONMENT_IPP_062904GER +#endif // BOOST_TEST_UTILS_RUNTIME_ENV_ENVIRONMENT_IPP_062904GER diff --git a/boost/test/utils/runtime/env/fwd.hpp b/boost/test/utils/runtime/env/fwd.hpp index dff5dfd299..438795ea8f 100644 --- a/boost/test/utils/runtime/env/fwd.hpp +++ b/boost/test/utils/runtime/env/fwd.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : environment subsystem forward declarations // *************************************************************************** -#ifndef BOOST_RT_ENV_FWD_HPP_062604GER -#define BOOST_RT_ENV_FWD_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_FWD_HPP +#define BOOST_TEST_UTILS_RUNTIME_ENV_FWD_HPP #ifdef UNDER_CE #error Windows CE does not support environment variables. @@ -24,13 +24,20 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace environment { +template<typename T> +class variable; + class variable_base; variable_base var( cstring var_name ); +template<typename T> +inline variable<T> + var( cstring var_name ); + namespace rt_env_detail { struct variable_data; @@ -47,8 +54,8 @@ template <typename T> class variable; } // namespace environment -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_ENV_FWD_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_ENV_FWD_HPP diff --git a/boost/test/utils/runtime/env/modifier.hpp b/boost/test/utils/runtime/env/modifier.hpp index cdd6be908f..536461a549 100644 --- a/boost/test/utils/runtime/env/modifier.hpp +++ b/boost/test/utils/runtime/env/modifier.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Use, modification, and distribution are subject to 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) @@ -12,8 +12,8 @@ // Description : defines variable modifiers // *************************************************************************** -#ifndef BOOST_RT_ENV_MODIFIER_HPP_062604GER -#define BOOST_RT_ENV_MODIFIER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_MODIFIER_HPP +#define BOOST_TEST_UTILS_RUNTIME_ENV_MODIFIER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace environment { @@ -40,8 +40,8 @@ nfp::keyword<struct interpreter_t> interpreter; } // local namespace } // namespace environment -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_ENV_MODIFIER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_ENV_MODIFIER_HPP diff --git a/boost/test/utils/runtime/env/variable.hpp b/boost/test/utils/runtime/env/variable.hpp index 8e8b0a0737..df776a619a 100644 --- a/boost/test/utils/runtime/env/variable.hpp +++ b/boost/test/utils/runtime/env/variable.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : defines model of program environment variable // *************************************************************************** -#ifndef BOOST_RT_ENV_VARIABLE_HPP_062604GER -#define BOOST_RT_ENV_VARIABLE_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_ENV_VARIABLE_HPP +#define BOOST_TEST_UTILS_RUNTIME_ENV_VARIABLE_HPP #ifdef UNDER_CE #error Windows CE does not support environment variables. @@ -32,7 +32,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace environment { @@ -74,7 +74,7 @@ public: res.reset(); } - bool has_value() const { return m_data->m_value!=0; } + bool has_value() const { return !!m_data->m_value; } cstring name() const { return m_data->m_var_name; } protected: @@ -95,7 +95,7 @@ public: template<typename Modifiers> explicit variable( cstring var_name, Modifiers const& m ); - explicit variable( rt_env_detail::variable_data& data ) + explicit variable( rt_env_detail::variable_data& data ) : variable_base( data ) {} // other variable assignment @@ -179,7 +179,7 @@ operator!=( V const& v, variable<T> ev ) } // namespace environment -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost @@ -195,7 +195,7 @@ operator!=( V const& v, variable<T> ev ) namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace environment { @@ -216,8 +216,8 @@ variable<T>::variable( cstring var_name, Modifiers const& m ) } // namespace environment -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_ENV_VARIABLE_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_ENV_VARIABLE_HPP diff --git a/boost/test/utils/runtime/file/config_file.cpp b/boost/test/utils/runtime/file/config_file.cpp index d369d79504..1e13d66eee 100644 --- a/boost/test/utils/runtime/file/config_file.cpp +++ b/boost/test/utils/runtime/file/config_file.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Use, modification, and distribution are subject to 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) @@ -26,7 +26,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace file { @@ -60,7 +60,7 @@ operator<<( std::ostream& os, parameter const& p ) param_namespace::param_namespace( cstring name, param_namespace const* parent ) : p_parent( parent ) { - assign_op( p_name.value, name ); + assign_op( p_name.value, name, 0 ); } //____________________________________________________________________________// @@ -69,8 +69,8 @@ void param_namespace::insert_param( cstring param_name, cstring param_value ) { BOOST_TEST_FOREACH( parameter const&, p, m_parameters ) - BOOST_RT_PARAM_VALIDATE_LOGIC( p.p_name != param_name, - BOOST_RT_PARAM_LITERAL( "Duplicate parameter " ) << param_name ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( p.p_name != param_name, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Duplicate parameter " ) << param_name ); m_parameters.push_back( parameter( param_name, param_value, *this ) ); } @@ -133,7 +133,7 @@ get_param_value( param_namespace const& where_from, return res; } - + param_namespace const* sns = get_param_subns( where_from, name_part1 ); return sns ? get_param_value( *sns, name_part2, name_part3, name_part4, name_part5 ) @@ -153,13 +153,13 @@ get_requ_param_value( param_namespace const& where_from, boost::optional<cstring> v = get_param_value( where_from, name_part1, name_part2, name_part3, name_part4, name_part5 ); #define APPEND_PART( part ) (part.is_empty() ? "" : "::") << (part.is_empty() ? cstring() : part) - BOOST_RT_PARAM_VALIDATE_LOGIC( !!v, BOOST_RT_PARAM_LITERAL( "Required parameter " ) - << name_part1 + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !!v, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Required parameter " ) + << name_part1 << APPEND_PART( name_part2 ) << APPEND_PART( name_part3 ) << APPEND_PART( name_part4 ) << APPEND_PART( name_part5 ) - << BOOST_RT_PARAM_LITERAL( " value is missing" ) ); + << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( " value is missing" ) ); #undef APPEND_PART return *v; @@ -186,7 +186,7 @@ get_param_subns( param_namespace const& where_from, cstring namespace_name ) //____________________________________________________________________________// void -param_namespace::load_impl( config_file_iterator cf_it, +param_namespace::load_impl( config_file_iterator cf_it, cstring value_marker, cstring value_delimeter, cstring namespace_delimeter ) { using namespace unit_test; @@ -242,7 +242,7 @@ config_file::config_file( cstring file_name ) } // namespace file -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost diff --git a/boost/test/utils/runtime/file/config_file.hpp b/boost/test/utils/runtime/file/config_file.hpp index f9c71b8138..e7baf08bf2 100644 --- a/boost/test/utils/runtime/file/config_file.hpp +++ b/boost/test/utils/runtime/file/config_file.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Use, modification, and distribution are subject to 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) @@ -12,8 +12,8 @@ // Description : defines models configuration file, it's parameter and parameter namespaces // *************************************************************************** -#ifndef BOOST_RT_FILE_CONFIG_FILE_HPP_010105GER -#define BOOST_RT_FILE_CONFIG_FILE_HPP_010105GER +#ifndef BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_HPP +#define BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -32,7 +32,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace file { @@ -65,7 +65,7 @@ namespace { nfp::typed_keyword<cstring, struct value_marker_t> value_marker; nfp::typed_keyword<cstring, struct value_delimeter_t> value_delimeter; nfp::typed_keyword<cstring, struct namespace_delimeter_t> namespace_delimeter; -} // local namespace +} // local namespace // ************************************************************************** // // ************** runtime::file::param_namespace ************** // @@ -86,9 +86,9 @@ public: template<typename Modifier> void load( config_file_iterator cf_it, Modifier const& m ) { - cstring vm = m.has( value_marker ) ? m[value_marker] : BOOST_RT_PARAM_CSTRING_LITERAL( "\"" ); - cstring vd = m.has( value_delimeter ) ? m[value_delimeter] : BOOST_RT_PARAM_CSTRING_LITERAL( "= \t\n\r" ); - cstring nd = m.has( namespace_delimeter ) ? m[namespace_delimeter] : BOOST_RT_PARAM_CSTRING_LITERAL( "::" ); + cstring vm = m.has( value_marker ) ? m[value_marker] : BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "\"" ); + cstring vd = m.has( value_delimeter ) ? m[value_delimeter] : BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "= \t\n\r" ); + cstring nd = m.has( namespace_delimeter ) ? m[namespace_delimeter] : BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "::" ); load_impl( cf_it, vm, vd, nd ); } @@ -126,7 +126,7 @@ protected: explicit param_namespace( cstring name, param_namespace const* parent = 0 ); private: - void load_impl( config_file_iterator cf_it, + void load_impl( config_file_iterator cf_it, cstring value_marker_, cstring value_delimeter_, cstring namespace_delimeter_ ); // Data members @@ -175,8 +175,8 @@ public: } // namespace file -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_FILE_CONFIG_FILE_HPP_010105GER +#endif // BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_HPP_010105GER diff --git a/boost/test/utils/runtime/file/config_file_iterator.cpp b/boost/test/utils/runtime/file/config_file_iterator.cpp index a81a0c83e5..5d6cbdf7dc 100644 --- a/boost/test/utils/runtime/file/config_file_iterator.cpp +++ b/boost/test/utils/runtime/file/config_file_iterator.cpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Use, modification, and distribution are subject to 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) @@ -24,9 +24,9 @@ // Boost -#include <boost/utility.hpp> #include <boost/scoped_array.hpp> #include <boost/bind.hpp> +#include <boost/noncopyable.hpp> // Boost.Test #include <boost/test/utils/basic_cstring/compare.hpp> @@ -45,7 +45,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace file { @@ -71,7 +71,7 @@ struct symbol_to_value_map : std::map<cstring, ValueType> { m_name_store.erase( it ); - erase( name ); + this->erase( name ); } private: @@ -106,7 +106,7 @@ is_valid_identifier( cstring const& source ) return false; while( ++it < source.end() ) { - if( !std::isalnum( *it ) && *it != BOOST_RT_PARAM_LITERAL( '_' ) && *it != BOOST_RT_PARAM_LITERAL( '-' ) ) + if( !std::isalnum( *it ) && *it != BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '_' ) && *it != BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '-' ) ) return false; } @@ -158,7 +158,7 @@ include_level::include_level( cstring file_name, cstring path_separators, includ } } - BOOST_RT_PARAM_VALIDATE_LOGIC( m_stream.is_open(), BOOST_RT_PARAM_LITERAL( "can't open file " ) << file_name ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_stream.is_open(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "can't open file " ) << file_name ); } //____________________________________________________________________________// @@ -234,21 +234,21 @@ struct config_file_iterator::Impl : noncopyable { //____________________________________________________________________________// config_file_iterator::Impl::Impl() -: m_path_separators( BOOST_RT_PARAM_LITERAL( "/\\" ) ) -, m_line_delimeter( BOOST_RT_PARAM_LITERAL( '\n' ) ) -, m_sl_comment_delimeter( BOOST_RT_PARAM_LITERAL( "#" ) ) -, m_command_delimeter( BOOST_RT_PARAM_LITERAL( "$" ) ) -, m_line_beak( BOOST_RT_PARAM_LITERAL( "\\" ) ) -, m_macro_ref_begin( BOOST_RT_PARAM_LITERAL( "$" ) ) -, m_macro_ref_end( BOOST_RT_PARAM_LITERAL( "$" ) ) - -, m_include_kw( BOOST_RT_PARAM_LITERAL( "include" ) ) -, m_define_kw( BOOST_RT_PARAM_LITERAL( "define" ) ) -, m_undef_kw( BOOST_RT_PARAM_LITERAL( "undef" ) ) -, m_ifdef_kw( BOOST_RT_PARAM_LITERAL( "ifdef" ) ) -, m_ifndef_kw( BOOST_RT_PARAM_LITERAL( "ifndef" ) ) -, m_else_kw( BOOST_RT_PARAM_LITERAL( "else" ) ) -, m_endif_kw( BOOST_RT_PARAM_LITERAL( "endif" ) ) +: m_path_separators( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "/\\" ) ) +, m_line_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( '\n' ) ) +, m_sl_comment_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "#" ) ) +, m_command_delimeter( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) ) +, m_line_beak( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "\\" ) ) +, m_macro_ref_begin( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) ) +, m_macro_ref_end( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "$" ) ) + +, m_include_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "include" ) ) +, m_define_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "define" ) ) +, m_undef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "undef" ) ) +, m_ifdef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "ifdef" ) ) +, m_ifndef_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "ifndef" ) ) +, m_else_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "else" ) ) +, m_endif_kw( BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "endif" ) ) , m_buffer_size( 8192 ) @@ -338,9 +338,9 @@ config_file_iterator::Impl::get_next_line( cstring& line ) return true; // 110 // } - BOOST_RT_PARAM_VALIDATE_LOGIC( !broken_line, BOOST_RT_PARAM_LITERAL( "broken line is not completed" ) ); - BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() == 0, - BOOST_RT_PARAM_LITERAL( "matching endif command is missing" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( !broken_line, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "broken line is not completed" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() == 0, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "matching endif command is missing" ) ); return false; } @@ -359,14 +359,14 @@ config_file_iterator::Impl::get_macro_value( cstring macro_name, bool ignore_mis env::get( macro_name, macro_value ); #endif - BOOST_RT_PARAM_VALIDATE_LOGIC( macro_value || ignore_missing || !m_detect_missing_macro, - BOOST_RT_PARAM_LITERAL( "Unknown macro \"" ) << macro_name << BOOST_RT_PARAM_LITERAL( "\"" ) ); - + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( macro_value || ignore_missing || !m_detect_missing_macro, + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Unknown macro \"" ) << macro_name << BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "\"" ) ); + if( !macro_value ) { if( !ignore_missing ) macro_value = cstring(); } - else + else m_symbols_table.add( macro_name, *macro_value ); return macro_value; @@ -386,7 +386,7 @@ config_file_iterator::Impl::process_command_line( cstring line ) command_handler_map::const_iterator it = m_command_handler_map.find( *tit ); - BOOST_RT_PARAM_VALIDATE_LOGIC( it != m_command_handler_map.end(), BOOST_RT_PARAM_LITERAL( "Invalid command " ) << *tit ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( it != m_command_handler_map.end(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "Invalid command " ) << *tit ); ++tit; @@ -405,13 +405,13 @@ config_file_iterator::Impl::process_include( cstring line ) string_token_iterator tit( line, kept_delimeters = dt_none ); - BOOST_RT_PARAM_VALIDATE_LOGIC( tit != string_token_iterator(), - BOOST_RT_PARAM_LITERAL( "include file name missing" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( tit != string_token_iterator(), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "include file name missing" ) ); cstring include_file_name = *tit; - BOOST_RT_PARAM_VALIDATE_LOGIC( ++tit == string_token_iterator(), - BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of include command" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( ++tit == string_token_iterator(), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of include command" ) ); substitute_macros( include_file_name ); @@ -431,8 +431,8 @@ config_file_iterator::Impl::process_define( cstring line ) string_token_iterator tit( line, (kept_delimeters = dt_none, max_tokens = 2 )); cstring macro_name = *tit; - BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ), - BOOST_RT_PARAM_LITERAL( "invalid macro name" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) ); cstring macro_value = *(++tit); substitute_macros( macro_value ); @@ -449,8 +449,8 @@ config_file_iterator::Impl::process_undef( cstring line ) return; cstring macro_name = line; - BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ), - BOOST_RT_PARAM_LITERAL( "invalid macro name" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) ); m_symbols_table.remove( macro_name ); } @@ -465,8 +465,8 @@ config_file_iterator::Impl::process_ifdef( cstring line ) return; cstring macro_name = line; - BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ), - BOOST_RT_PARAM_LITERAL( "invalid macro name" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) ); if( !get_macro_value( macro_name ) ) m_inactive_ifdef_level = m_conditional_states.size(); @@ -482,8 +482,8 @@ config_file_iterator::Impl::process_ifndef( cstring line ) return; cstring macro_name = line; - BOOST_RT_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ), - BOOST_RT_PARAM_LITERAL( "invalid macro name" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( is_valid_identifier( macro_name ), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "invalid macro name" ) ); if( get_macro_value( macro_name ) ) m_inactive_ifdef_level = m_conditional_states.size(); @@ -494,12 +494,12 @@ config_file_iterator::Impl::process_ifndef( cstring line ) void config_file_iterator::Impl::process_else( cstring line ) { - BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0 && m_conditional_states.back(), - BOOST_RT_PARAM_LITERAL( "else without matching if" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0 && m_conditional_states.back(), + BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "else without matching if" ) ); m_inactive_ifdef_level = m_conditional_states.size() == m_inactive_ifdef_level ? 0 : m_conditional_states.size(); - BOOST_RT_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of else command" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of else command" ) ); } //____________________________________________________________________________// @@ -507,13 +507,13 @@ config_file_iterator::Impl::process_else( cstring line ) void config_file_iterator::Impl::process_endif( cstring line ) { - BOOST_RT_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0, BOOST_RT_PARAM_LITERAL( "endif without matching if" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( m_conditional_states.size() > 0, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "endif without matching if" ) ); if( m_conditional_states.size() == m_inactive_ifdef_level ) m_inactive_ifdef_level = 0; m_conditional_states.pop_back(); - BOOST_RT_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_RT_PARAM_LITERAL( "unexpected tokens at the end of endif command" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( line.is_empty(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "unexpected tokens at the end of endif command" ) ); } //____________________________________________________________________________// @@ -531,7 +531,7 @@ config_file_iterator::Impl::substitute_macros( cstring& where ) pos = where.find( m_macro_ref_end ); - BOOST_RT_PARAM_VALIDATE_LOGIC( pos != cstring::npos, BOOST_RT_PARAM_LITERAL( "incomplete macro reference" ) ); + BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( pos != cstring::npos, BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( "incomplete macro reference" ) ); cstring value = *get_macro_value( where.substr( 0, pos ), false ); m_post_subst_line.append( value.begin(), value.size() ); @@ -562,18 +562,18 @@ config_file_iterator::construct() void config_file_iterator::load( cstring file_name ) { - m_pimpl->m_curr_level.reset( new include_level( file_name, m_pimpl->m_path_separators ) ); - m_pimpl->m_buffer.reset( new char[m_pimpl->m_buffer_size] ); - - register_command_handler( m_pimpl->m_include_kw, bind( &Impl::process_include, m_pimpl.get(), _1 ) ); - register_command_handler( m_pimpl->m_define_kw, bind( &Impl::process_define, m_pimpl.get(), _1 ) ); - register_command_handler( m_pimpl->m_undef_kw, bind( &Impl::process_undef, m_pimpl.get(), _1 ) ); - register_command_handler( m_pimpl->m_ifdef_kw, bind( &Impl::process_ifdef, m_pimpl.get(), _1 ) ); - register_command_handler( m_pimpl->m_ifndef_kw, bind( &Impl::process_ifndef, m_pimpl.get(), _1 ) ); - register_command_handler( m_pimpl->m_else_kw, bind( &Impl::process_else, m_pimpl.get(), _1 ) ); - register_command_handler( m_pimpl->m_endif_kw, bind( &Impl::process_endif, m_pimpl.get(), _1 ) ); - - init(); + m_pimpl->m_curr_level.reset( new include_level( file_name, m_pimpl->m_path_separators ) ); + m_pimpl->m_buffer.reset( new char[m_pimpl->m_buffer_size] ); + + register_command_handler( m_pimpl->m_include_kw, boost::bind( &Impl::process_include, m_pimpl.get(), _1 ) ); + register_command_handler( m_pimpl->m_define_kw, boost::bind( &Impl::process_define, m_pimpl.get(), _1 ) ); + register_command_handler( m_pimpl->m_undef_kw, boost::bind( &Impl::process_undef, m_pimpl.get(), _1 ) ); + register_command_handler( m_pimpl->m_ifdef_kw, boost::bind( &Impl::process_ifdef, m_pimpl.get(), _1 ) ); + register_command_handler( m_pimpl->m_ifndef_kw, boost::bind( &Impl::process_ifndef, m_pimpl.get(), _1 ) ); + register_command_handler( m_pimpl->m_else_kw, boost::bind( &Impl::process_else, m_pimpl.get(), _1 ) ); + register_command_handler( m_pimpl->m_endif_kw, boost::bind( &Impl::process_endif, m_pimpl.get(), _1 ) ); + + init(); } //____________________________________________________________________________// @@ -606,31 +606,31 @@ void config_file_iterator::set_parameter( rtti::id_t id, cstring value ) { BOOST_RTTI_SWITCH( id ) { - BOOST_RTTI_CASE( cfg_detail::path_separators_t ) + BOOST_RTTI_CASE( cfg_detail::path_separators_t ) assign_op( m_pimpl->m_path_separators , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::sl_comment_delimeter_t ) + BOOST_RTTI_CASE( cfg_detail::sl_comment_delimeter_t ) assign_op( m_pimpl->m_sl_comment_delimeter , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::command_delimeter_t ) + BOOST_RTTI_CASE( cfg_detail::command_delimeter_t ) assign_op( m_pimpl->m_command_delimeter , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::line_beak_t ) + BOOST_RTTI_CASE( cfg_detail::line_beak_t ) assign_op( m_pimpl->m_line_beak , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::macro_ref_begin_t ) + BOOST_RTTI_CASE( cfg_detail::macro_ref_begin_t ) assign_op( m_pimpl->m_macro_ref_begin , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::macro_ref_end_t ) + BOOST_RTTI_CASE( cfg_detail::macro_ref_end_t ) assign_op( m_pimpl->m_macro_ref_end , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::include_kw_t ) + BOOST_RTTI_CASE( cfg_detail::include_kw_t ) assign_op( m_pimpl->m_include_kw , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::define_kw_t ) + BOOST_RTTI_CASE( cfg_detail::define_kw_t ) assign_op( m_pimpl->m_define_kw , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::undef_kw_t ) + BOOST_RTTI_CASE( cfg_detail::undef_kw_t ) assign_op( m_pimpl->m_undef_kw , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::ifdef_kw_t ) + BOOST_RTTI_CASE( cfg_detail::ifdef_kw_t ) assign_op( m_pimpl->m_ifdef_kw , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::ifndef_kw_t ) + BOOST_RTTI_CASE( cfg_detail::ifndef_kw_t ) assign_op( m_pimpl->m_ifndef_kw , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::else_kw_t ) + BOOST_RTTI_CASE( cfg_detail::else_kw_t ) assign_op( m_pimpl->m_else_kw , value, 0 ); - BOOST_RTTI_CASE( cfg_detail::endif_kw_t ) + BOOST_RTTI_CASE( cfg_detail::endif_kw_t ) assign_op( m_pimpl->m_endif_kw , value, 0 ); } } @@ -641,7 +641,7 @@ void config_file_iterator::set_parameter( rtti::id_t id, bool value ) { BOOST_RTTI_SWITCH( id ) { - BOOST_RTTI_CASE( cfg_detail::trim_leading_spaces_t ) + BOOST_RTTI_CASE( cfg_detail::trim_leading_spaces_t ) m_pimpl->m_trim_leading_spaces = value; BOOST_RTTI_CASE( cfg_detail::trim_trailing_spaces_t ) m_pimpl->m_trim_trailing_spaces = value; @@ -658,7 +658,7 @@ void config_file_iterator::set_parameter( rtti::id_t id, char_type value ) { BOOST_RTTI_SWITCH( id ) { - BOOST_RTTI_CASE( cfg_detail::line_delimeter_t ) + BOOST_RTTI_CASE( cfg_detail::line_delimeter_t ) m_pimpl->m_line_delimeter = value; } } @@ -669,7 +669,7 @@ void config_file_iterator::set_parameter( rtti::id_t id, std::size_t value ) { BOOST_RTTI_SWITCH( id ) { - BOOST_RTTI_CASE( cfg_detail::buffer_size_t ) + BOOST_RTTI_CASE( cfg_detail::buffer_size_t ) m_pimpl->m_buffer_size = value; } } @@ -678,7 +678,7 @@ config_file_iterator::set_parameter( rtti::id_t id, std::size_t value ) } // namespace file -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost diff --git a/boost/test/utils/runtime/file/config_file_iterator.hpp b/boost/test/utils/runtime/file/config_file_iterator.hpp index 23d4a94f22..6c6273fca1 100644 --- a/boost/test/utils/runtime/file/config_file_iterator.hpp +++ b/boost/test/utils/runtime/file/config_file_iterator.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. -// Use, modification, and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// (C) Copyright Gennadiy Rozental 2005-2014. +// Use, modification, and distribution are subject to 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) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : flexible configuration file iterator definition // *************************************************************************** -#ifndef BOOST_RT_FILE_CONFIG_FILE_ITERATOR_HPP_062604GER -#define BOOST_RT_FILE_CONFIG_FILE_ITERATOR_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_ITERATOR_HPP +#define BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_ITERATOR_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -22,19 +22,19 @@ // Boost.Test #include <boost/test/utils/iterator/input_iterator_facade.hpp> -#include <boost/test/utils/callback.hpp> #include <boost/test/utils/named_params.hpp> // Boost #include <boost/shared_ptr.hpp> +#include <boost/function.hpp> namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { namespace file { -// Public typedef +// Public typedef typedef std::pair<dstring,long> location; // ************************************************************************** // @@ -99,7 +99,7 @@ class config_file_iterator : public unit_test::input_iterator_facade<config_file typedef unit_test::input_iterator_facade<config_file_iterator,cstring,cstring> base; public: // Public typedefs - typedef unit_test::callback1<cstring> command_handler; + typedef boost::function<void (cstring)> command_handler; // Constructors config_file_iterator() {} @@ -159,8 +159,8 @@ private: } // namespace file -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_FILE_CONFIG_FILE_ITERATOR_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_FILE_CONFIG_FILE_ITERATOR_HPP diff --git a/boost/test/utils/runtime/fwd.hpp b/boost/test/utils/runtime/fwd.hpp index aafdf69d17..2647184c5d 100644 --- a/boost/test/utils/runtime/fwd.hpp +++ b/boost/test/utils/runtime/fwd.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : global framework level forward declaration // *************************************************************************** -#ifndef BOOST_RT_FWD_HPP_062604GER -#define BOOST_RT_FWD_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_FWD_HPP +#define BOOST_TEST_UTILS_RUNTIME_FWD_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -23,7 +23,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { class parameter; @@ -34,8 +34,8 @@ typedef shared_ptr<argument const> const_argument_ptr; template<typename T> class value_interpreter; template<typename T> class typed_argument; -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_FWD_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_FWD_HPP diff --git a/boost/test/utils/runtime/interpret_argument_value.hpp b/boost/test/utils/runtime/interpret_argument_value.hpp index f767e7a29b..016caa017f 100644 --- a/boost/test/utils/runtime/interpret_argument_value.hpp +++ b/boost/test/utils/runtime/interpret_argument_value.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,8 +12,8 @@ // Description : default algorithms for string to specific type convertions // *************************************************************************** -#ifndef BOOST_RT_INTERPRET_ARGUMENT_VALUE_HPP_062604GER -#define BOOST_RT_INTERPRET_ARGUMENT_VALUE_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_INTERPRET_ARGUMENT_VALUE_HPP +#define BOOST_TEST_UTILS_RUNTIME_INTERPRET_ARGUMENT_VALUE_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> @@ -33,7 +33,7 @@ namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { // ************************************************************************** // // ************** runtime::interpret_argument_value ************** // @@ -45,11 +45,11 @@ template<typename T> struct interpret_argument_value_impl { static bool _( cstring source, boost::optional<T>& res ) { - BOOST_RT_PARAM_TRACE( "In interpret_argument_value_impl<" << typeid(T).name() << ">" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value_impl<" << typeid(T).name() << ">" ); res = lexical_cast<T>( source ); - BOOST_RT_PARAM_TRACE( "String " << source << " is interpreted as " << *res ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "String " << source << " is interpreted as " << *res ); return true; } }; @@ -62,7 +62,7 @@ template<> struct interpret_argument_value_impl<dstring> { static bool _( cstring source, boost::optional<dstring>& res ) { - BOOST_RT_PARAM_TRACE( "In interpret_argument_value_impl<dstring>" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value_impl<dstring>" ); res = dstring(); assign_op( *res, source, 0 ); @@ -78,7 +78,7 @@ template<> struct interpret_argument_value_impl<cstring> { static bool _( cstring source, boost::optional<cstring>& res ) { - BOOST_RT_PARAM_TRACE( "In interpret_argument_value_impl<cstring>" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value_impl<cstring>" ); res = source; @@ -93,14 +93,14 @@ template<> struct interpret_argument_value_impl<bool> { static bool _( cstring source, boost::optional<bool>& res ) { - BOOST_RT_PARAM_TRACE( "In interpret_argument_value_impl<bool>" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value_impl<bool>" ); - static literal_cstring YES( BOOST_RT_PARAM_CSTRING_LITERAL( "YES" ) ); - static literal_cstring Y( BOOST_RT_PARAM_CSTRING_LITERAL( "Y" ) ); - static literal_cstring NO( BOOST_RT_PARAM_CSTRING_LITERAL( "NO" ) ); - static literal_cstring N( BOOST_RT_PARAM_CSTRING_LITERAL( "N" ) ); - static literal_cstring one( BOOST_RT_PARAM_CSTRING_LITERAL( "1" ) ); - static literal_cstring zero( BOOST_RT_PARAM_CSTRING_LITERAL( "0" ) ); + static literal_cstring YES( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "YES" ) ); + static literal_cstring Y( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "Y" ) ); + static literal_cstring NO( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "NO" ) ); + static literal_cstring N( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "N" ) ); + static literal_cstring one( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "1" ) ); + static literal_cstring zero( BOOST_TEST_UTILS_RUNTIME_PARAM_CSTRING_LITERAL( "0" ) ); source.trim(); @@ -114,7 +114,7 @@ struct interpret_argument_value_impl<bool> { } else { res = true; - return false; + return source.is_empty(); } } }; @@ -135,13 +135,13 @@ template<typename T> inline bool interpret_argument_value( cstring source, boost::optional<std::list<T> >& res, int ) { - BOOST_RT_PARAM_TRACE( "In interpret_argument_value<std::list<T>>" ); + BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( "In interpret_argument_value<std::list<T>>" ); res = std::list<T>(); while( !source.is_empty() ) { // !! should we use token_iterator - cstring::iterator single_value_end = std::find( source.begin(), source.end(), BOOST_RT_PARAM_LITERAL( ',' ) ); + cstring::iterator single_value_end = std::find( source.begin(), source.end(), BOOST_TEST_UTILS_RUNTIME_PARAM_LITERAL( ',' ) ); boost::optional<T> value; interpret_argument_value( cstring( source.begin(), single_value_end ), value, 0 ); @@ -156,8 +156,8 @@ interpret_argument_value( cstring source, boost::optional<std::list<T> >& res, i //____________________________________________________________________________// -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_INTERPRET_ARGUMENT_VALUE_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_INTERPRET_ARGUMENT_VALUE_HPP diff --git a/boost/test/utils/runtime/parameter.hpp b/boost/test/utils/runtime/parameter.hpp index b914a9b4e5..2dd4ba725c 100644 --- a/boost/test/utils/runtime/parameter.hpp +++ b/boost/test/utils/runtime/parameter.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,15 +12,15 @@ // Description : abstract interface for the formal parameter // *************************************************************************** -#ifndef BOOST_RT_PARAMETER_HPP_062604GER -#define BOOST_RT_PARAMETER_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP +#define BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { // ************************************************************************** // // ************** runtime::parameter ************** // @@ -31,8 +31,8 @@ public: virtual ~parameter() {} }; -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_PARAMETER_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_PARAMETER_HPP diff --git a/boost/test/utils/runtime/trace.hpp b/boost/test/utils/runtime/trace.hpp index 5c4e2a7c05..17a169b283 100644 --- a/boost/test/utils/runtime/trace.hpp +++ b/boost/test/utils/runtime/trace.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,19 +12,19 @@ // Description : optional internal tracing // *************************************************************************** -#ifndef BOOST_RT_TRACE_HPP_062604GER -#define BOOST_RT_TRACE_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_TRACE_HPP +#define BOOST_TEST_UTILS_RUNTIME_TRACE_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> -#ifdef BOOST_RT_PARAM_DEBUG +#ifdef BOOST_TEST_UTILS_RUNTIME_PARAM_DEBUG #include <iostream> -# define BOOST_RT_PARAM_TRACE( str ) std::cerr << str << std::endl +# define BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( str ) std::cerr << str << std::endl #else -# define BOOST_RT_PARAM_TRACE( str ) +# define BOOST_TEST_UTILS_RUNTIME_PARAM_TRACE( str ) #endif -#endif // BOOST_RT_TRACE_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_TRACE_HPP diff --git a/boost/test/utils/runtime/validation.hpp b/boost/test/utils/runtime/validation.hpp index bcfbc9f062..54163dc6a6 100644 --- a/boost/test/utils/runtime/validation.hpp +++ b/boost/test/utils/runtime/validation.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,33 +12,34 @@ // Description : defines exceptions and validation tools // *************************************************************************** -#ifndef BOOST_RT_VALIDATION_HPP_062604GER -#define BOOST_RT_VALIDATION_HPP_062604GER +#ifndef BOOST_TEST_UTILS_RUNTIME_VALIDATION_HPP +#define BOOST_TEST_UTILS_RUNTIME_VALIDATION_HPP // Boost.Runtime.Parameter #include <boost/test/utils/runtime/config.hpp> // Boost.Test #include <boost/test/utils/class_properties.hpp> +#include <boost/test/detail/throw_exception.hpp> // Boost #include <boost/shared_ptr.hpp> // STL -#ifdef BOOST_RT_PARAM_EXCEPTION_INHERIT_STD +#ifdef BOOST_TEST_UTILS_RUNTIME_PARAM_EXCEPTION_INHERIT_STD #include <stdexcept> #endif namespace boost { -namespace BOOST_RT_PARAM_NAMESPACE { +namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE { // ************************************************************************** // // ************** runtime::logic_error ************** // // ************************************************************************** // -class logic_error -#ifdef BOOST_RT_PARAM_EXCEPTION_INHERIT_STD +class logic_error +#ifdef BOOST_TEST_UTILS_RUNTIME_PARAM_EXCEPTION_INHERIT_STD : public std::exception #endif { @@ -46,10 +47,12 @@ class logic_error public: // Constructor // !! could we eliminate shared_ptr explicit logic_error( cstring msg ) : m_msg( new dstring( msg.begin(), msg.size() ) ) {} - ~logic_error() throw() {} + ~logic_error() BOOST_NOEXCEPT_OR_NOTHROW + {} dstring const& msg() const { return *m_msg; } - virtual char_type const* what() const throw() { return m_msg->c_str(); } + virtual char_type const* what() const BOOST_NOEXCEPT_OR_NOTHROW + { return m_msg->c_str(); } private: dstring_ptr m_msg; @@ -62,21 +65,21 @@ private: inline void report_logic_error( format_stream& msg ) { - throw BOOST_RT_PARAM_NAMESPACE::logic_error( msg.str() ); + BOOST_TEST_IMPL_THROW( BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::logic_error( msg.str() ) ); } //____________________________________________________________________________// -#define BOOST_RT_PARAM_REPORT_LOGIC_ERROR( msg ) \ - boost::BOOST_RT_PARAM_NAMESPACE::report_logic_error( format_stream().ref() << msg ) +#define BOOST_TEST_UTILS_RUNTIME_PARAM_REPORT_LOGIC_ERROR( msg ) \ + boost::BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE::report_logic_error( format_stream().ref() << msg ) -#define BOOST_RT_PARAM_VALIDATE_LOGIC( b, msg ) \ - if( b ) {} else BOOST_RT_PARAM_REPORT_LOGIC_ERROR( msg ) +#define BOOST_TEST_UTILS_RUNTIME_PARAM_VALIDATE_LOGIC( b, msg ) \ + if( b ) {} else BOOST_TEST_UTILS_RUNTIME_PARAM_REPORT_LOGIC_ERROR( msg ) //____________________________________________________________________________// -} // namespace BOOST_RT_PARAM_NAMESPACE +} // namespace BOOST_TEST_UTILS_RUNTIME_PARAM_NAMESPACE } // namespace boost -#endif // BOOST_RT_VALIDATION_HPP_062604GER +#endif // BOOST_TEST_UTILS_RUNTIME_VALIDATION_HPP diff --git a/boost/test/utils/setcolor.hpp b/boost/test/utils/setcolor.hpp new file mode 100644 index 0000000000..f47ec84d8d --- /dev/null +++ b/boost/test/utils/setcolor.hpp @@ -0,0 +1,117 @@ +// (C) Copyright Gennadiy Rozental 2009-2014. +// 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) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : contains definition for setcolor iostream manipulator +// *************************************************************************** + +#ifndef BOOST_TEST_UTILS_SETCOLOR_HPP +#define BOOST_TEST_UTILS_SETCOLOR_HPP + +// Boost.Test +#include <boost/test/detail/config.hpp> + +// STL +#include <iostream> +#include <cstdio> + +#include <boost/test/detail/suppress_warnings.hpp> + +//____________________________________________________________________________// + +namespace boost { +namespace unit_test { + +// ************************************************************************** // +// ************** term_attr ************** // +// ************************************************************************** // + +struct term_attr { enum _ { + NORMAL = 0, + BRIGHT = 1, + DIM = 2, + UNDERLINE = 4, + BLINK = 5, + REVERSE = 7, + CROSSOUT = 9 +}; }; + +// ************************************************************************** // +// ************** term_color ************** // +// ************************************************************************** // + +struct term_color { enum _ { + BLACK = 0, + RED = 1, + GREEN = 2, + YELLOW = 3, + BLUE = 4, + MAGENTA = 5, + CYAN = 6, + WHITE = 7, + ORIGINAL = 9 +}; }; + +// ************************************************************************** // +// ************** setcolor ************** // +// ************************************************************************** // + +class setcolor { +public: + // Constructor + explicit setcolor( term_attr::_ attr = term_attr::NORMAL, + term_color::_ fg = term_color::ORIGINAL, + term_color::_ bg = term_color::ORIGINAL ) + { + m_command_size = std::sprintf( m_control_command, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40 ); + } + + friend std::ostream& + operator<<( std::ostream& os, setcolor const& sc ) + { + return os.write( sc.m_control_command, sc.m_command_size ); + } + +private: + // Data members + char m_control_command[13]; + int m_command_size; +}; + +// ************************************************************************** // +// ************** scope_setcolor ************** // +// ************************************************************************** // + +struct scope_setcolor { + scope_setcolor() : m_os( 0 ) {} + explicit scope_setcolor( std::ostream& os, + term_attr::_ attr = term_attr::NORMAL, + term_color::_ fg = term_color::ORIGINAL, + term_color::_ bg = term_color::ORIGINAL ) + : m_os( &os ) + { + os << setcolor( attr, fg, bg ); + } + ~scope_setcolor() + { + if( m_os ) + *m_os << setcolor(); + } +private: + // Data members + std::ostream* m_os; +}; + +} // namespace unit_test +} // namespace boost + +#include <boost/test/detail/enable_warnings.hpp> + +#endif // BOOST_TEST_UTILS_SETCOLOR_HPP diff --git a/boost/test/utils/trivial_singleton.hpp b/boost/test/utils/trivial_singleton.hpp index 61cca97e00..818bad73ea 100644 --- a/boost/test/utils/trivial_singleton.hpp +++ b/boost/test/utils/trivial_singleton.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -12,20 +12,19 @@ // Description : simple helpers for creating cusom output manipulators // *************************************************************************** -#ifndef BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER -#define BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER +#ifndef BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP +#define BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP +// Boost.Test #include <boost/config.hpp> #include <boost/detail/workaround.hpp> -#include <boost/noncopyable.hpp> - +// Boost #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// namespace boost { - namespace unit_test { // ************************************************************************** // @@ -33,15 +32,19 @@ namespace unit_test { // ************************************************************************** // template<typename Derived> -class singleton : private boost::noncopyable { +class singleton { public: - static Derived& instance() { static Derived the_inst; return the_inst; } + static Derived& instance() { static Derived the_inst; return the_inst; } + + BOOST_DELETED_FUNCTION(singleton(singleton const&)) + BOOST_DELETED_FUNCTION(singleton& operator=(singleton const&)) + protected: - singleton() {} - ~singleton() {} + BOOST_DEFAULTED_FUNCTION(singleton(), {}) + BOOST_DEFAULTED_FUNCTION(~singleton(), {}) }; -} // namespace unit_test +//____________________________________________________________________________// #define BOOST_TEST_SINGLETON_CONS( type ) \ friend class boost::unit_test::singleton<type>; \ @@ -65,10 +68,12 @@ namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); } #endif +//____________________________________________________________________________// + +} // namespace unit_test } // namespace boost -//____________________________________________________________________________// #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER +#endif // BOOST_TEST_UTILS_TRIVIAL_SIGNLETON_HPP diff --git a/boost/test/utils/wrap_stringstream.hpp b/boost/test/utils/wrap_stringstream.hpp index d1122c8ca8..e42adbd3ad 100644 --- a/boost/test/utils/wrap_stringstream.hpp +++ b/boost/test/utils/wrap_stringstream.hpp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2002-2008. +// (C) Copyright Gennadiy Rozental 2002-2014. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -13,8 +13,8 @@ // to provide the unified interface // *************************************************************************** -#ifndef BOOST_WRAP_STRINGSTREAM_HPP_071894GER -#define BOOST_WRAP_STRINGSTREAM_HPP_071894GER +#ifndef BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP +#define BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP // Boost.Test #include <boost/test/detail/config.hpp> @@ -81,7 +81,7 @@ basic_wrap_stringstream<CharT>::stream() template <typename CharT> inline basic_wrap_stringstream<CharT>& basic_wrap_stringstream<CharT>::ref() -{ +{ return *this; } @@ -114,7 +114,7 @@ operator<<( basic_wrap_stringstream<CharT>& targ, basic_wrap_stringstream<CharT> //____________________________________________________________________________// -#if BOOST_TEST_USE_STD_LOCALE +#if BOOST_TEST_USE_STD_LOCALE template <typename CharT> inline basic_wrap_stringstream<CharT>& @@ -157,8 +157,6 @@ typedef basic_wrap_stringstream<wchar_t> wrap_wstringstream; } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_WRAP_STRINGSTREAM_HPP_071894GER +#endif // BOOST_TEST_UTILS_WRAP_STRINGSTREAM_HPP diff --git a/boost/test/utils/xml_printer.hpp b/boost/test/utils/xml_printer.hpp index ae73cce105..8552a173f9 100644 --- a/boost/test/utils/xml_printer.hpp +++ b/boost/test/utils/xml_printer.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2004-2008. +// (C) Copyright Gennadiy Rozental 2004-2014. // 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) @@ -9,11 +9,11 @@ // // Version : $Revision$ // -// Description : common code used by any agent serving as XML printer +// Description : common code used by any agent serving as OF_XML printer // *************************************************************************** -#ifndef BOOST_TEST_XML_PRINTER_HPP_071894GER -#define BOOST_TEST_XML_PRINTER_HPP_071894GER +#ifndef BOOST_TEST_UTILS_XML_PRINTER_HPP +#define BOOST_TEST_UTILS_XML_PRINTER_HPP // Boost.Test #include <boost/test/utils/basic_cstring/basic_cstring.hpp> @@ -33,7 +33,6 @@ //____________________________________________________________________________// namespace boost { - namespace unit_test { // ************************************************************************** // @@ -82,6 +81,22 @@ print_escaped( std::ostream& where_to, T const& value ) //____________________________________________________________________________// +inline void +print_escaped_cdata( std::ostream& where_to, const_string value ) +{ + static const_string cdata_end( "]]>" ); + + const_string::size_type pos = value.find( cdata_end ); + if( pos == const_string::npos ) + where_to << value; + else { + where_to << value.substr( 0, pos+2 ) << cdata_end + << BOOST_TEST_L( "<![CDATA[" ) << value.substr( pos+2 ); + } +} + +//____________________________________________________________________________// + typedef custom_manip<struct attr_value_t> attr_value; template<typename T> @@ -102,17 +117,16 @@ typedef custom_manip<struct cdata_t> cdata; inline std::ostream& operator<<( custom_printer<cdata> const& p, const_string value ) { - return *p << BOOST_TEST_L( "<![CDATA[" ) << value << BOOST_TEST_L( "]]>" ); + *p << BOOST_TEST_L( "<![CDATA[" ); + print_escaped_cdata( *p, value ); + return *p << BOOST_TEST_L( "]]>" ); } //____________________________________________________________________________// } // namespace unit_test - } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> -#endif // BOOST_TEST_XML_PRINTER_HPP_071894GER +#endif // BOOST_TEST_UTILS_XML_PRINTER_HPP |