00001 /* 00002 ** socketexception.cc 00003 ** Login : Julien Lemoine <speedblue@happycoders.org> 00004 ** Started on Mon May 12 23:23:27 2003 Julien Lemoine 00005 ** $Id: socketexception.cc,v 1.2 2004/06/01 21:30:53 speedblue Exp $ 00006 ** 00007 ** Copyright (C) 2003,2004 Julien Lemoine 00008 ** This program is free software; you can redistribute it and/or modify 00009 ** it under the terms of the GNU Lesser General Public License as published by 00010 ** the Free Software Foundation; either version 2 of the License, or 00011 ** (at your option) any later version. 00012 ** 00013 ** This program is distributed in the hope that it will be useful, 00014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 ** GNU Lesser General Public License for more details. 00017 ** 00018 ** You should have received a copy of the GNU Lesser General Public License 00019 ** along with this program; if not, write to the Free Software 00020 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #include "socketexception.hh" 00024 00025 namespace Network 00026 { 00027 std::ostream& operator<<(std::ostream& stream, Exception& e) 00028 { 00029 e.print(stream); 00030 return (stream); 00031 } 00032 00033 00034 const std::string& Exception::get_error() const 00035 { 00036 return _error; 00037 } 00038 00039 const char* Exception::get_file() const 00040 { 00041 return _file; 00042 } 00043 00044 int Exception::get_line() const 00045 { 00046 return _line; 00047 } 00048 00049 void Exception::print(std::ostream& stream) const 00050 { 00051 if (_file) 00052 stream << _error << " [" << _file << ":" << _line << "]"<<std::endl; 00053 else 00054 stream << _error << std::endl; 00055 } 00056 00057 }