A smarter make install
[ustl.git] / ustdxept.cc
blobfb7a354a236f0e37f7cc992a3121e672b975b5ef
1 // This file is part of the ustl library, an STL implementation.
2 //
3 // Copyright (C) 2005 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
5 //
6 // ustdxept.cc
7 //
9 #include "ustdxept.h"
10 #include "mistream.h"
11 #include "mostream.h"
12 #include "strmsize.h"
13 #include "uiosfunc.h"
14 #include "uspecial.h"
16 namespace ustl {
18 //----------------------------------------------------------------------
20 /// \p arg contains a description of the error.
21 error_message::error_message (const char* arg) throw()
22 : m_Arg ()
24 try { m_Arg = arg; } catch (...) {}
25 set_format (xfmt_ErrorMessage);
28 /// Virtual destructor
29 error_message::~error_message (void) throw()
33 /// Returns a descriptive error message. fmt="%s: %s"
34 void error_message::info (string& msgbuf, const char* fmt) const throw()
36 if (!fmt) fmt = "%s: %s";
37 try { msgbuf.format (fmt, what(), m_Arg.cdata()); } catch (...) {}
40 /// Reads the object from stream \p is.
41 void error_message::read (istream& is)
43 exception::read (is);
44 is >> m_Arg >> ios::align();
47 /// Writes the object to stream \p os.
48 void error_message::write (ostream& os) const
50 exception::write (os);
51 os << m_Arg << ios::align();
54 /// Returns the size of the written object.
55 size_t error_message::stream_size (void) const
57 return (exception::stream_size() + Align (stream_size_of (m_Arg)));
60 //----------------------------------------------------------------------
62 } // namespace ustl