00001 /* $Header: /home/hopper/src/cvs/C++/LCore/lcerror.cxx,v 1.4 2002/08/29 00:58:04 hopper Exp $ */ 00002 /* 00003 * Copyright (C) 1991-9 Eric M. Hopper <hopper@omnifarious.mn.org> 00004 * 00005 * This program is free software; you can redistribute it and/or modify it 00006 * under the terms of the GNU Lesser General Public License as published 00007 * by the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 // For a log, see ./ChangeLog 00021 00022 #ifdef __GNUG__ 00023 # pragma implementation "LCoreError.h" 00024 #endif 00025 00026 #include "LCore/LCoreError.h" 00027 #include <iostream> 00028 00029 namespace strmod { 00030 namespace lcore { 00031 00032 ::std::ostream &operator <<(::std::ostream &os, const LCoreError &err) 00033 { 00034 bool out = false; 00035 if (err.getSourceFile()) 00036 { 00037 os << "In " << err.getSourceFile(); 00038 out = true; 00039 } 00040 if (err.getLine() != 0) 00041 { 00042 os << (out ? ", at line " : "At line ") << err.getLine(); 00043 out = true; 00044 } 00045 if (err.getFunc()) 00046 { 00047 os << (out ? ", in function '" : "In function '") << err.getFunc(); 00048 } 00049 os << (out ? ": " : "Error: ") 00050 << (err.getDesc() ? err.getDesc() : "<no description>"); 00051 return os; 00052 } 00053 00054 } // namespace lcore 00055 } // namespace strmod
1.3-rc1