Added commonly used error_info typedefs.

Added boost/exception/all.hpp.
Removed tabs from source files.

[SVN r54825]
This commit is contained in:
Emil Dotchevski
2009-07-08 23:44:28 +00:00
parent a0614793b3
commit bd0ed9f83b
18 changed files with 321 additions and 0 deletions

View File

@ -35,6 +35,7 @@ run diagnostic_information_test.cpp ;
run refcount_ptr_test.cpp ;
run current_exception_cast_test.cpp ;
run no_exceptions_test.cpp : : : <exception-handling>off ;
run errinfos_test.cpp ;
compile-fail exception_fail.cpp ;
compile-fail throw_exception_fail.cpp ;
@ -49,4 +50,12 @@ compile info_hpp_test.cpp ;
compile info_tuple_hpp_test.cpp ;
compile to_string_hpp_test.cpp ;
compile to_string_stub_hpp_test.cpp ;
compile all_hpp_test.cpp ;
compile current_exception_cast_hpp_test.cpp ;
compile errinfo_api_function_hpp_test.cpp ;
compile errinfo_at_line_hpp_test.cpp ;
compile errinfo_errno_hpp_test.cpp ;
compile errinfo_file_handle_hpp_test.cpp ;
compile errinfo_file_name_hpp_test.cpp ;
compile errinfo_file_open_mode_hpp_test.cpp ;
compile errinfo_type_info_name_hpp_test.cpp ;

7
test/all_hpp_test.cpp Normal file
View File

@ -0,0 +1,7 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/all.hpp>
#include <boost/exception/all.hpp>

View File

@ -0,0 +1,7 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/errinfo_api_function.hpp>
#include <boost/exception/errinfo_api_function.hpp>

View File

@ -0,0 +1,7 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/errinfo_at_line.hpp>
#include <boost/exception/errinfo_at_line.hpp>

View File

@ -0,0 +1,7 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/errinfo_errno.hpp>
#include <boost/exception/errinfo_errno.hpp>

View File

@ -0,0 +1,7 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/errinfo_file_handle.hpp>
#include <boost/exception/errinfo_file_handle.hpp>

View File

@ -0,0 +1,7 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/errinfo_file_name.hpp>
#include <boost/exception/errinfo_file_name.hpp>

View File

@ -0,0 +1,7 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/errinfo_file_open_mode.hpp>
#include <boost/exception/errinfo_file_open_mode.hpp>

View File

@ -0,0 +1,7 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/errinfo_type_info_name.hpp>
#include <boost/exception/errinfo_type_info_name.hpp>

61
test/errinfos_test.cpp Normal file
View File

@ -0,0 +1,61 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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)
#include <boost/exception/errinfo_api_function.hpp>
#include <boost/exception/errinfo_at_line.hpp>
#include <boost/exception/errinfo_errno.hpp>
#include <boost/exception/errinfo_file_handle.hpp>
#include <boost/exception/errinfo_file_name.hpp>
#include <boost/exception/errinfo_file_open_mode.hpp>
#include <boost/exception/errinfo_type_info_name.hpp>
#include <boost/exception/info.hpp>
#include <boost/exception/get_error_info.hpp>
#include <boost/throw_exception.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <exception>
struct
test_exception:
virtual boost::exception,
virtual std::exception
{
};
int
main()
{
using namespace boost;
try
{
BOOST_THROW_EXCEPTION(
test_exception() <<
errinfo_api_function("failed_api_function") <<
errinfo_at_line(42) <<
errinfo_errno(errno) <<
errinfo_file_handle(weak_ptr<FILE>()) <<
errinfo_file_name("filename.txt") <<
errinfo_file_open_mode("rb") <<
errinfo_type_info_name(typeid(int).name()) );
BOOST_TEST(false);
}
catch(
exception & e )
{
BOOST_TEST(get_error_info<errinfo_api_function>(e) && *get_error_info<errinfo_api_function>(e)==std::string("failed_api_function"));
BOOST_TEST(get_error_info<errinfo_at_line>(e) && *get_error_info<errinfo_at_line>(e)==42);
BOOST_TEST(get_error_info<errinfo_errno>(e) && *get_error_info<errinfo_errno>(e)==0);
BOOST_TEST(get_error_info<errinfo_file_handle>(e) && get_error_info<errinfo_file_handle>(e)->expired());
BOOST_TEST(get_error_info<errinfo_file_name>(e) && *get_error_info<errinfo_file_name>(e)=="filename.txt");
BOOST_TEST(get_error_info<errinfo_file_open_mode>(e) && *get_error_info<errinfo_file_open_mode>(e)=="rb");
BOOST_TEST(get_error_info<errinfo_type_info_name>(e) && *get_error_info<errinfo_type_info_name>(e)==typeid(int).name());
}
catch(
... )
{
BOOST_TEST(false);
}
return boost::report_errors();
}