aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cutl/compiler/code-stream.hxx6
-rw-r--r--cutl/compiler/context.hxx5
-rw-r--r--cutl/compiler/type-info.hxx3
-rw-r--r--cutl/container/any.hxx4
-rw-r--r--cutl/container/graph.hxx6
-rw-r--r--cutl/exception.cxx17
-rw-r--r--cutl/exception.hxx22
-rw-r--r--cutl/fs/path.hxx4
-rw-r--r--cutl/makefile2
-rw-r--r--cutl/shared-ptr/base.hxx7
-rw-r--r--doc/components.txt2
11 files changed, 64 insertions, 14 deletions
diff --git a/cutl/compiler/code-stream.hxx b/cutl/compiler/code-stream.hxx
index bb8305a..a1a5d1a 100644
--- a/cutl/compiler/code-stream.hxx
+++ b/cutl/compiler/code-stream.hxx
@@ -9,6 +9,8 @@
#include <memory> // std::auto_ptr
#include <ostream>
+#include <cutl/exception.hxx>
+
namespace cutl
{
namespace compiler
@@ -54,8 +56,8 @@ namespace cutl
typedef typename std::basic_streambuf<C>::traits_type traits_type;
typedef typename std::basic_streambuf<C>::int_type int_type;
- struct eof {};
- struct sync {};
+ class eof: exception {};
+ class sync: exception {};
public:
from_streambuf_adapter (std::basic_streambuf<C>& stream)
diff --git a/cutl/compiler/context.hxx b/cutl/compiler/context.hxx
index 4bae010..5f4eb1e 100644
--- a/cutl/compiler/context.hxx
+++ b/cutl/compiler/context.hxx
@@ -10,6 +10,7 @@
#include <string>
#include <cstddef> // std::size_t
+#include <cutl/exception.hxx>
#include <cutl/container/any.hxx>
namespace cutl
@@ -19,8 +20,8 @@ namespace cutl
class context
{
public:
- struct no_entry {};
- struct typing {};
+ struct no_entry: exception {};
+ struct typing: exception {};
public:
context () {}
diff --git a/cutl/compiler/type-info.hxx b/cutl/compiler/type-info.hxx
index f970067..9fa5593 100644
--- a/cutl/compiler/type-info.hxx
+++ b/cutl/compiler/type-info.hxx
@@ -10,6 +10,7 @@
#include <vector>
#include <typeinfo> // std::type_info
+#include <cutl/exception.hxx>
#include <cutl/static-ptr.hxx>
#include <cutl/compiler/type-id.hxx>
@@ -76,7 +77,7 @@ namespace cutl
//
//
- class no_type_info {};
+ class no_type_info: exception {};
type_info const&
lookup (type_id const&);
diff --git a/cutl/container/any.hxx b/cutl/container/any.hxx
index 0c89a38..4fd05b5 100644
--- a/cutl/container/any.hxx
+++ b/cutl/container/any.hxx
@@ -9,6 +9,8 @@
#include <memory> // std::auto_ptr
#include <typeinfo> // std::type_info
+#include <cutl/exception.hxx>
+
namespace cutl
{
namespace container
@@ -16,7 +18,7 @@ namespace cutl
class any
{
public:
- struct typing {};
+ struct typing: exception {};
public:
template <typename X>
diff --git a/cutl/container/graph.hxx b/cutl/container/graph.hxx
index 9d1c716..35650c1 100644
--- a/cutl/container/graph.hxx
+++ b/cutl/container/graph.hxx
@@ -7,12 +7,16 @@
#define CUTL_CONTAINER_GRAPH_HXX
#include <map>
+
+#include <cutl/exception.hxx>
#include <cutl/shared-ptr.hxx>
namespace cutl
{
namespace container
{
+ struct no_edge: exception {};
+
template <typename N, typename E>
class graph
{
@@ -20,8 +24,6 @@ namespace cutl
typedef N node_base;
typedef E edge_base;
- struct no_edge {};
-
public:
template <typename T>
T&
diff --git a/cutl/exception.cxx b/cutl/exception.cxx
new file mode 100644
index 0000000..e8389f7
--- /dev/null
+++ b/cutl/exception.cxx
@@ -0,0 +1,17 @@
+// file : cutl/exception.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#include <typeinfo>
+
+#include <cutl/exception.hxx>
+
+namespace cutl
+{
+ char const* exception::
+ what () const throw ()
+ {
+ return typeid (*this).name ();
+ }
+}
diff --git a/cutl/exception.hxx b/cutl/exception.hxx
new file mode 100644
index 0000000..242057b
--- /dev/null
+++ b/cutl/exception.hxx
@@ -0,0 +1,22 @@
+// file : cutl/exception.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#ifndef CUTL_EXCEPTION_HXX
+#define CUTL_EXCEPTION_HXX
+
+#include <exception>
+
+namespace cutl
+{
+ struct exception: std::exception
+ {
+ // By default return the exception type name ( typeid (*this).name () ).
+ //
+ virtual char const*
+ what () const throw ();
+ };
+}
+
+#endif // CUTL_EXCEPTION_HXX
diff --git a/cutl/fs/path.hxx b/cutl/fs/path.hxx
index a79fc5c..f310d55 100644
--- a/cutl/fs/path.hxx
+++ b/cutl/fs/path.hxx
@@ -9,11 +9,13 @@
#include <string>
#include <iosfwd>
+#include <cutl/exception.hxx>
+
namespace cutl
{
namespace fs
{
- struct invalid_path: std::exception
+ struct invalid_path: exception
{
virtual char const*
what () const throw ();
diff --git a/cutl/makefile b/cutl/makefile
index f5adfce..294bbd5 100644
--- a/cutl/makefile
+++ b/cutl/makefile
@@ -5,7 +5,7 @@
include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
-cxx_tun := shared-ptr/base.cxx
+cxx_tun := exception.cxx shared-ptr/base.cxx
cxx_tun += fs/path.cxx
diff --git a/cutl/shared-ptr/base.hxx b/cutl/shared-ptr/base.hxx
index bb297cb..999c6d0 100644
--- a/cutl/shared-ptr/base.hxx
+++ b/cutl/shared-ptr/base.hxx
@@ -8,7 +8,8 @@
#include <new>
#include <cstddef> // std::size_t
-#include <exception> // std::exception
+
+#include <cutl/exception.hxx>
namespace cutl
{
@@ -36,7 +37,7 @@ operator delete (void*, cutl::share) throw ();
namespace cutl
{
- struct not_shared: std::exception
+ struct not_shared: exception
{
virtual char const*
what () const throw ();
@@ -81,7 +82,7 @@ namespace cutl
template <typename X>
inline std::size_t
- ref_count (X const*);
+ ref_count (X const*);
}
#include <cutl/shared-ptr/base.ixx>
diff --git a/doc/components.txt b/doc/components.txt
index 72a340f..993488a 100644
--- a/doc/components.txt
+++ b/doc/components.txt
@@ -1,6 +1,6 @@
Components
- core: meta/ shared-ptr/ shared-ptr.hxx
+ core: meta/ shared-ptr/ shared-ptr.hxx exception.hxx
container: container/
compiler: compiler/
fs: fs/