playererror.h
1/*
2 * Player - One Hell of a Robot Server
3 * Copyright (C) 2000-2003
4 * Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22/********************************************************************
23 *
24 * This library is free software; you can redistribute it and/or
25 * modify it under the terms of the GNU Lesser General Public
26 * License as published by the Free Software Foundation; either
27 * version 2.1 of the License, or (at your option) any later version.
28 *
29 * This library is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 * Lesser General Public License for more details.
33 *
34 * You should have received a copy of the GNU Lesser General Public
35 * License along with this library; if not, write to the Free Software
36 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
37 *
38 ********************************************************************/
39
40#ifndef PLAYERERROR_H
41#define PLAYERERROR_H
42
43#include <string>
44#include <iostream>
45
46#if defined (WIN32)
47 #if defined (PLAYER_STATIC)
48 #define PLAYERCC_EXPORT
49 #elif defined (playerc___EXPORTS)
50 #define PLAYERCC_EXPORT __declspec (dllexport)
51 #else
52 #define PLAYERCC_EXPORT __declspec (dllimport)
53 #endif
54#else
55 #define PLAYERCC_EXPORT
56#endif
57
58namespace PlayerCc
59{
60
66class PLAYERCC_EXPORT PlayerError
67{
68 private:
69
70 // a string describing the error
71 std::string mStr;
72 // a string describing the location of the error in the source
73 std::string mFun;
74 // error code returned by playerc
75 int mCode;
76
77 public:
79 std::string GetErrorStr() const { return(mStr); };
81 std::string GetErrorFun() const { return(mFun); };
83 int GetErrorCode() const { return(mCode); };
84
86 PlayerError(const std::string aFun="",
87 const std::string aStr="",
88 const int aCode=-1);
91};
92
93}
94
95namespace std
96{
97PLAYERCC_EXPORT std::ostream& operator << (std::ostream& os, const PlayerCc::PlayerError& e);
98}
99
100#endif
The C++ exception class.
Definition playererror.h:67
PlayerError(const std::string aFun="", const std::string aStr="", const int aCode=-1)
default constructor
~PlayerError()
default destructor
std::string GetErrorFun() const
the function that threw the error
Definition playererror.h:81
std::string GetErrorStr() const
the error string
Definition playererror.h:79
int GetErrorCode() const
a numerical error code
Definition playererror.h:83