2
* This file is part of the Advance project.
4
* Copyright (C) 2002 Andrea Mazzoleni
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
39
error(const char* Afunction, const char* Afile, unsigned Aline) : function(Afunction), file(Afile), line(Aline)
43
const std::string& desc_get() const
48
const std::string& function_get() const
53
const std::string& file_get() const
58
unsigned line_get() const
63
error& operator<<(const char* A)
69
error& operator<<(const std::string& A)
75
error& operator<<(const unsigned A)
78
s << A /* << " (" << std::hex << A << "h)" */ ;
84
class error_invalid : public error {
86
error_invalid() : error()
90
error_invalid& operator<<(const char* A)
96
error_invalid& operator<<(const std::string& A)
102
error_invalid& operator<<(const unsigned A)
104
error::operator<<(A);
109
class error_unsupported : public error {
111
error_unsupported() : error()
115
error_unsupported& operator<<(const char* A)
117
error::operator<<(A);
121
error_unsupported& operator<<(const std::string& A)
123
error::operator<<(A);
127
error_unsupported& operator<<(const unsigned A)
129
error::operator<<(A);
135
error(__PRETTY_FUNCTION__, __FILE__, __LINE__)
137
static inline std::ostream& operator<<(std::ostream& os, const error& e)
141
if (e.function_get().length() || e.file_get().length() || e.line_get())
142
os << " [at " << e.function_get() << ":" << e.file_get() << ":" << e.line_get() << "]";