Equalizer
1.2.1
|
00001 00002 /* Copyright (c) 2010-2011, Stefan Eilemann <eile@eyescale.ch> 00003 * 00004 * This library is free software; you can redistribute it and/or modify it under 00005 * the terms of the GNU Lesser General Public License version 2.1 as published 00006 * by the Free Software Foundation. 00007 * 00008 * This library is distributed in the hope that it will be useful, but WITHOUT 00009 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00010 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00011 * details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this library; if not, write to the Free Software Foundation, Inc., 00015 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00016 */ 00017 00018 #ifndef COBASE_ERRORREGISTRY_H 00019 #define COBASE_ERRORREGISTRY_H 00020 00021 #include <co/base/api.h> 00022 #include <co/base/nonCopyable.h> // base class 00023 #include <co/base/stdExt.h> // hash_map 00024 #include <co/base/types.h> 00025 00026 namespace co 00027 { 00028 namespace base 00029 { 00041 class ErrorRegistry : public NonCopyable 00042 { 00043 public: 00045 ErrorRegistry(); 00046 00048 COBASE_API const std::string& getString( const uint32_t error ) const; 00049 00051 COBASE_API void setString( const uint32_t error, 00052 const std::string& text ); 00053 00055 COBASE_API void eraseString( const uint32_t error ); 00056 00057 bool isEmpty() const { return _errors.empty(); } 00058 00059 private: 00060 typedef stde::hash_map< uint32_t, std::string > ErrorHash; 00061 ErrorHash _errors; 00062 }; 00063 } 00064 } 00065 #endif // COBASE_ERRORREGISTRY_H