00001
00003 #ifndef SLANG_UTIL_H
00004 #define SLANG_UTIL_H
00005
00006 #include <iostream>
00007 #include <string>
00008
00009 namespace Slang {
00010
00019 class Ignora {
00020 public:
00026 Ignora(char terminador, bool limpa = false)
00027 : terminador(terminador), limpa(limpa) {
00028 }
00029 char terminador;
00030 bool limpa;
00031 };
00032
00037 std::istream& operator >> (std::istream& entrada, Ignora const& ignora);
00038
00081 Ignora const il = '\n';
00082
00153 Ignora const ill = Ignora('\n', true);
00155
00156
00161 class Erro {
00162 public:
00165 Erro(std::string const& mensagem)
00166 : mensagem(mensagem) {
00167 }
00169 virtual ~Erro() {
00170 }
00173 virtual operator std::string () const {
00174 return mensagem;
00175 }
00177 std::string mensagem;
00178 };
00179
00184 class ErroAoCarregar : public Erro {
00185 public:
00188 ErroAoCarregar(std::string const& classe)
00189 : Erro(std::string("Erro ao carregar '") + classe + "'") {
00190 }
00191 };
00192
00197 class ErroAoGuardar : public Erro {
00198 public:
00201 ErroAoGuardar(std::string const& classe)
00202 : Erro(std::string("Erro ao guardar '") + classe + "'") {
00203 }
00204 };
00205 }
00206
00207 #endif // SLANG_UTIL_H