00001 #ifndef ERROS_ERROS_H 00002 #define ERROS_ERROS_H 00003 00005 namespace Erros { 00006 00010 class Erro { 00011 public: 00015 Erro(std::string const& mensagem) 00016 : mensagem(mensagem) { 00017 } 00019 virtual ~Erro() { 00020 } 00023 virtual operator std::string () const { 00024 return mensagem; 00025 } 00027 std::string mensagem; 00028 }; 00029 00033 class ErroAoCarregar : public Erro { 00034 public: 00038 ErroAoCarregar(std::string const& classe) 00039 : Erro(std::string("Erro ao carregar '") + classe + "'") { 00040 } 00041 }; 00042 00045 class ErroAoGuardar : public Erro { 00046 public: 00050 ErroAoGuardar(std::string const& classe) 00051 : Erro(std::string("Erro ao guardar '") + classe + "'") { 00052 } 00053 }; 00054 00055 } 00056 00057 #endif // ERROS_ERROS_H