playererror.h
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000-2003
00004  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00005  *
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 /********************************************************************
00023  *
00024  *  This library is free software; you can redistribute it and/or
00025  *  modify it under the terms of the GNU Lesser General Public
00026  *  License as published by the Free Software Foundation; either
00027  *  version 2.1 of the License, or (at your option) any later version.
00028  *
00029  *  This library is distributed in the hope that it will be useful,
00030  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00031  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00032  *  Lesser General Public License for more details.
00033  *
00034  *  You should have received a copy of the GNU Lesser General Public
00035  *  License along with this library; if not, write to the Free Software
00036  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00037  *
00038  ********************************************************************/
00039 
00040 #ifndef PLAYERERROR_H
00041 #define PLAYERERROR_H
00042 
00043 #include <string>
00044 #include <iostream>
00045 
00046 #if defined (WIN32)
00047   #if defined (PLAYER_STATIC)
00048     #define PLAYERCC_EXPORT
00049   #elif defined (playerc___EXPORTS)
00050     #define PLAYERCC_EXPORT    __declspec (dllexport)
00051   #else
00052     #define PLAYERCC_EXPORT    __declspec (dllimport)
00053   #endif
00054 #else
00055   #define PLAYERCC_EXPORT
00056 #endif
00057 
00058 namespace PlayerCc
00059 {
00060 
00066 class PLAYERCC_EXPORT PlayerError
00067 {
00068   private:
00069 
00070     // a string describing the error
00071     std::string mStr;
00072     // a string describing the location of the error in the source
00073     std::string mFun;
00074     // error code returned by playerc
00075     int mCode;
00076 
00077   public:
00079     std::string GetErrorStr() const { return(mStr); };
00081     std::string GetErrorFun() const { return(mFun); };
00083     int GetErrorCode() const { return(mCode); };
00084 
00086     PlayerError(const std::string aFun="",
00087                 const std::string aStr="",
00088                 const int aCode=-1);
00090     ~PlayerError();
00091 };
00092 
00093 }
00094 
00095 namespace std
00096 {
00097 PLAYERCC_EXPORT std::ostream& operator << (std::ostream& os, const PlayerCc::PlayerError& e);
00098 }
00099 
00100 #endif