Project: finder, src: EOFObjectException.h


EOF 例外の送出。FreeBSD 用。
#include <string>
#include <sstream>

class Exception {
  std::string file;
  int line;
  std::string explanation;
 public:
  Exception() {}
  Exception(const char fname[16], int line, const std::string &explanation) : file(fname), line(line), explanation(explanation) {}
  virtual const std::string dump() {
    std::stringstream ss;
    ss << file << "(" << line << "):" << explanation;
    return ss.str();
  }
};

class RuntimeException : virtual public Exception {
 public:
  RuntimeException(const char fname[16], int line, const std::string &explanation) : Exception(fname, line, explanation) {}
};

class EOFObjectException : virtual public RuntimeException {
 public:
   EOFObjectException(const char fname[16], int line, const std::string &explanation) : RuntimeException(fname, line, explanation) {}
};