00001 /* 00002 00003 This file is a part of ErrUt, a small collection of error handling 00004 utilities. 00005 00006 Copyright (c) 2008 Jori Liesenborgs 00007 00008 Contact: jori.liesenborgs@gmail.com 00009 00010 Permission is hereby granted, free of charge, to any person obtaining a 00011 copy of this software and associated documentation files (the "Software"), 00012 to deal in the Software without restriction, including without limitation 00013 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00014 and/or sell copies of the Software, and to permit persons to whom the 00015 Software is furnished to do so, subject to the following conditions: 00016 00017 The above copyright notice and this permission notice shall be included 00018 in all copies or substantial portions of the Software. 00019 00020 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00021 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00022 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00023 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00024 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00025 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 00026 IN THE SOFTWARE. 00027 00028 */ 00029 00034 #ifndef ERRUT_ERRORBASE_H 00035 00036 #define ERRUT_ERRORBASE_H 00037 00038 #include <string> 00039 00040 namespace errut 00041 { 00042 00047 class ErrorBase 00048 { 00049 public: 00051 ErrorBase() { m_objectName = std::string("Unnamed object"); } 00052 00054 ErrorBase(const std::string &objName) { m_objectName = objName; } 00055 00056 virtual ~ErrorBase() { } 00057 00059 std::string getObjectName() const { return m_objectName; } 00060 00062 std::string getErrorString() const { return m_errorString; } 00063 protected: 00065 void setErrorString(const std::string &str) const { m_errorString = str; } 00066 private: 00067 mutable std::string m_errorString; 00068 std::string m_objectName; 00069 }; 00070 00071 } // end namespace 00072 00073 #endif // ERRUT_ERRORBASE_H 00074