]> git.lyx.org Git - lyx.git/blob - boost/boost/format/exceptions.hpp
introduce namespace lyx::support
[lyx.git] / boost / boost / format / exceptions.hpp
1 // -*- C++ -*-
2 //  Boost general library 'format'   ---------------------------
3 //  See http://www.boost.org for updates, documentation, and revision history.
4
5 //  (C) Samuel Krempp 2001
6 //                  krempp@crans.ens-cachan.fr
7 //  Permission to copy, use, modify, sell and
8 //  distribute this software is granted provided this copyright notice appears
9 //  in all copies. This software is provided "as is" without express or implied
10 //  warranty, and with no claim as to its suitability for any purpose.
11
12 // ideas taken from RĂ¼diger Loos's format class
13 // and Karl Nelson's ofstream (also took its parsing code as basis for printf parsing)
14
15 // ------------------------------------------------------------------------------
16 // exceptions.hpp 
17 // ------------------------------------------------------------------------------
18
19
20 #ifndef BOOST_FORMAT_EXCEPTIONS_HPP
21 #define BOOST_FORMAT_EXCEPTIONS_HPP
22
23
24 #include <stdexcept>
25
26
27 namespace boost {
28
29 namespace io {
30
31 // **** exceptions -----------------------------------------------
32
33 class format_error : public std::exception
34 {
35 public:
36   format_error() {}
37   virtual const char *what() const throw()
38   {
39     return "boost::format_error: "
40       "format generic failure";
41   }
42 };
43
44 class bad_format_string : public format_error
45 {
46 public:
47   bad_format_string() {}
48   virtual const char *what() const throw()
49   {
50     return "boost::bad_format_string: "
51       "format-string is ill-formed";
52   }
53 };
54
55 class too_few_args : public format_error
56 {
57 public:
58   too_few_args() {}
59   virtual const char *what() const throw()
60   {
61     return "boost::too_few_args: "
62       "format-string refered to more arguments than were passed";
63   }
64 };
65
66 class too_many_args : public format_error
67 {
68 public:
69   too_many_args() {}
70   virtual const char *what() const throw()
71   {
72     return "boost::too_many_args: "
73       "format-string refered to less arguments than were passed";
74   }
75 };
76
77
78 class  out_of_range : public format_error
79 {
80 public:
81   out_of_range() {}
82   virtual const char *what() const throw()
83   {
84     return "boost::out_of_range: "
85       "tried to refer to an argument (or item) number which is out of range, "
86       "according to the format string.";
87   }
88 };
89
90
91 } // namespace io
92
93 } // namespace boost
94
95
96 #endif // BOOST_FORMAT_EXCEPTIONS_HPP