$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r54825 - in trunk: boost boost/exception libs/exception/test
From: emil_at_[hidden]
Date: 2009-07-08 19:44:30
Author: emildotchevski
Date: 2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
New Revision: 54825
URL: http://svn.boost.org/trac/boost/changeset/54825
Log:
Added commonly used error_info typedefs.
Added boost/exception/all.hpp.
Removed tabs from source files.
Added:
   trunk/boost/exception/all.hpp   (contents, props changed)
   trunk/boost/exception/errinfo_api_function.hpp   (contents, props changed)
   trunk/boost/exception/errinfo_at_line.hpp   (contents, props changed)
   trunk/boost/exception/errinfo_errno.hpp   (contents, props changed)
   trunk/boost/exception/errinfo_file_handle.hpp   (contents, props changed)
   trunk/boost/exception/errinfo_file_name.hpp   (contents, props changed)
   trunk/boost/exception/errinfo_file_open_mode.hpp   (contents, props changed)
   trunk/boost/exception/errinfo_type_info_name.hpp   (contents, props changed)
   trunk/libs/exception/test/all_hpp_test.cpp   (contents, props changed)
   trunk/libs/exception/test/errinfo_api_function_hpp_test.cpp   (contents, props changed)
   trunk/libs/exception/test/errinfo_at_line_hpp_test.cpp   (contents, props changed)
   trunk/libs/exception/test/errinfo_errno_hpp_test.cpp   (contents, props changed)
   trunk/libs/exception/test/errinfo_file_handle_hpp_test.cpp   (contents, props changed)
   trunk/libs/exception/test/errinfo_file_name_hpp_test.cpp   (contents, props changed)
   trunk/libs/exception/test/errinfo_file_open_mode_hpp_test.cpp   (contents, props changed)
   trunk/libs/exception/test/errinfo_type_info_name_hpp_test.cpp   (contents, props changed)
   trunk/libs/exception/test/errinfos_test.cpp   (contents, props changed)
Text files modified: 
   trunk/boost/exception.hpp            |    10 +---------                              
   trunk/libs/exception/test/Jamfile.v2 |     9 +++++++++                               
   2 files changed, 10 insertions(+), 9 deletions(-)
Modified: trunk/boost/exception.hpp
==============================================================================
--- trunk/boost/exception.hpp	(original)
+++ trunk/boost/exception.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -6,14 +6,6 @@
 #ifndef UUID_1D94A7C6054E11DB9804B622A1EF5492
 #define UUID_1D94A7C6054E11DB9804B622A1EF5492
 
-#include <boost/exception/diagnostic_information.hpp>
-#include <boost/exception/error_info.hpp>
-#include <boost/exception/exception.hpp>
-#include <boost/exception/get_error_info.hpp>
-#include <boost/exception/info.hpp>
-#include <boost/exception/info_tuple.hpp>
-#ifndef BOOST_NO_EXCEPTIONS
-#include <boost/exception_ptr.hpp>
-#endif
+#include <boost/exception/all.hpp>
 
 #endif
Added: trunk/boost/exception/all.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception/all.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -0,0 +1,26 @@
+//Copyright (c) 2006-2008 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)
+
+#ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
+#define UUID_316FDA946C0D11DEA9CBAE5255D89593
+
+#include <boost/exception/diagnostic_information.hpp>
+#include <boost/exception/error_info.hpp>
+#include <boost/exception/exception.hpp>
+#include <boost/exception/get_error_info.hpp>
+#include <boost/exception/info.hpp>
+#include <boost/exception/info_tuple.hpp>
+#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>
+#ifndef BOOST_NO_EXCEPTIONS
+#include <boost/exception_ptr.hpp>
+#endif
+
+#endif
Added: trunk/boost/exception/errinfo_api_function.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception/errinfo_api_function.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -0,0 +1,22 @@
+//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)
+
+#ifndef UUID_DDFBB4546C1211DEA4659E9055D89593
+#define UUID_DDFBB4546C1211DEA4659E9055D89593
+
+#include "boost/exception/error_info.hpp"
+
+namespace
+boost
+    {
+    //Usage hint:
+    //if( api_function(....)!=0 )
+    //    BOOST_THROW_EXCEPTION(
+    //        failure() <<
+    //        errinfo_api_function("api_function") );
+    typedef error_info<struct errinfo_api_function_,char const *> errinfo_api_function;
+    }
+
+#endif
Added: trunk/boost/exception/errinfo_at_line.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception/errinfo_at_line.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -0,0 +1,18 @@
+//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)
+
+#ifndef UUID_E7255CE26C1211DE85800C9155D89593
+#define UUID_E7255CE26C1211DE85800C9155D89593
+
+namespace
+boost
+    {
+    template <class Tag,class T> class error_info;
+
+    //Use with parsing errors exceptions, for example in a XML file parser.
+    typedef error_info<struct errinfo_at_line_,int> errinfo_at_line;
+    }
+
+#endif
Added: trunk/boost/exception/errinfo_errno.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception/errinfo_errno.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -0,0 +1,34 @@
+//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)
+
+#ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
+#define UUID_F0EE17BE6C1211DE87FF459155D89593
+
+#include "boost/exception/info.hpp"
+#include <errno.h>
+
+namespace
+boost
+    {
+    typedef error_info<struct errinfo_errno_,int> errinfo_errno;
+
+    //Usage hint:
+    //if( c_function(....)!=0 )
+    //    BOOST_THROW_EXCEPTION(
+    //        failure() <<
+    //        errinfo_errno(errno) <<
+    //        errinfo_api_function("c_function") );
+    inline
+    std::string
+    to_string( errinfo_errno const & e )
+        {
+        std::ostringstream tmp;
+        int v=e.value();
+        tmp << v << ", \"" << strerror(v) << "\"";
+        return tmp.str();
+        }
+    }
+
+#endif
Added: trunk/boost/exception/errinfo_file_handle.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception/errinfo_file_handle.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -0,0 +1,20 @@
+//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)
+
+#ifndef UUID_F79E6EE26C1211DEB26E929155D89593
+#define UUID_F79E6EE26C1211DEB26E929155D89593
+
+#include <stdio.h>
+
+namespace
+boost
+    {
+    template <class> class weak_ptr;
+    template <class Tag,class T> class error_info;
+
+    typedef error_info<struct errinfo_file_handle_,weak_ptr<FILE> > errinfo_file_handle;
+    }
+
+#endif
Added: trunk/boost/exception/errinfo_file_name.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception/errinfo_file_name.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -0,0 +1,26 @@
+//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)
+
+#ifndef UUID_FEE5120A6C1211DE94E8BC9155D89593
+#define UUID_FEE5120A6C1211DE94E8BC9155D89593
+
+#include <string>
+
+namespace
+boost
+    {
+    template <class Tag,class T> class error_info;
+
+    //Usage hint:
+    //FILE * f=fopen(name,mode);
+    //if( !f )
+    //    BOOST_THROW_EXCEPTION(
+    //        file_open_error() <<
+    //        errinfo_file_name(name) <<
+    //        errinfo_file_open_mode(mode) );
+    typedef error_info<struct errinfo_file_name_,std::string> errinfo_file_name;
+    }
+
+#endif
Added: trunk/boost/exception/errinfo_file_open_mode.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception/errinfo_file_open_mode.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -0,0 +1,26 @@
+//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)
+
+#ifndef UUID_056F1F266C1311DE8E74299255D89593
+#define UUID_056F1F266C1311DE8E74299255D89593
+
+#include <string>
+
+namespace
+boost
+    {
+    template <class Tag,class T> class error_info;
+
+    //Usage hint:
+    //FILE * f=fopen(name,mode);
+    //if( !f )
+    //    BOOST_THROW_EXCEPTION(
+    //        file_open_error() <<
+    //        errinfo_file_name(name) <<
+    //        errinfo_file_open_mode(mode) );
+    typedef error_info<struct errinfo_file_open_mode_,std::string> errinfo_file_open_mode;
+    }
+
+#endif
Added: trunk/boost/exception/errinfo_type_info_name.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/exception/errinfo_type_info_name.hpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -0,0 +1,23 @@
+//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)
+
+#ifndef UUID_0E11109E6C1311DEB7EA649255D89593
+#define UUID_0E11109E6C1311DEB7EA649255D89593
+
+#include <string>
+
+namespace
+boost
+    {
+    template <class Tag,class T> class error_info;
+
+    //Usage hint:
+    //BOOST_THROW_EXCEPTION(
+    //    bad_type() <<
+    //    errinfo_type_info_name(typeid(x).name()) );
+    typedef error_info<struct errinfo_type_info_name_,std::string> errinfo_type_info_name;
+    }
+
+#endif
Modified: trunk/libs/exception/test/Jamfile.v2
==============================================================================
--- trunk/libs/exception/test/Jamfile.v2	(original)
+++ trunk/libs/exception/test/Jamfile.v2	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -35,6 +35,7 @@
 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_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 ;
Added: trunk/libs/exception/test/all_hpp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/all_hpp_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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>
Added: trunk/libs/exception/test/errinfo_api_function_hpp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/errinfo_api_function_hpp_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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>
Added: trunk/libs/exception/test/errinfo_at_line_hpp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/errinfo_at_line_hpp_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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>
Added: trunk/libs/exception/test/errinfo_errno_hpp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/errinfo_errno_hpp_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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>
Added: trunk/libs/exception/test/errinfo_file_handle_hpp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/errinfo_file_handle_hpp_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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>
Added: trunk/libs/exception/test/errinfo_file_name_hpp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/errinfo_file_name_hpp_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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>
Added: trunk/libs/exception/test/errinfo_file_open_mode_hpp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/errinfo_file_open_mode_hpp_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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>
Added: trunk/libs/exception/test/errinfo_type_info_name_hpp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/errinfo_type_info_name_hpp_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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>
Added: trunk/libs/exception/test/errinfos_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/exception/test/errinfos_test.cpp	2009-07-08 19:44:28 EDT (Wed, 08 Jul 2009)
@@ -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();
+    }