// // Copyright (C) 2000-2002 Andrey Slepuhin // // libp++ is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // libp++ is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with libp++; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // $Source$ // $Revision$ // $Date$ // Author: Andrey Slepuhin #ifndef __pxx_sys_error_ih__ #define __pxx_sys_error_ih__ #include "pxx_sys_error.hh" #include namespace pxx { // //! Constructor inline SysError::SysError ( int _code, char const* _function /* = null */, char const* _file /* = null */, int _line /* = 0 */ ) : err_code (_code), function (_function), file (_file), line (_line) {} // //! Destructor inline SysError::~SysError () {} // //! Get a code inline int SysError::get_code () const { return err_code; } // //! Print an error message inline void SysError::print () { if (function != null) { fprintf( stderr, "System error in %s at %s:%d\n%s\n", function, file, line, strerror(err_code) ); } else { fprintf(stderr, "%s\n", strerror(err_code)); } } } #endif // __pxx_sys_error_ih__