Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tstreamexception.h"
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
#include "tconvert.h"
Toshihiro Shimizu 890ddd
#include "tstream.h"
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace {
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
std::wstring getLocation(TIStream &is) {
Shinya Kitaoka 120a6e
  return L"File: " + is.getFilePath().getWideString() + L":" +
Shinya Kitaoka 120a6e
         std::to_wstring(is.getLine());
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
std::wstring message(TIStream &is, std::wstring msg) {
Shinya Kitaoka 120a6e
  return getLocation(is) + L"\n" + msg;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
std::wstring message(TIStream &is, std::string msg) {
Shinya Kitaoka 120a6e
  return message(is, ::to_wstring(msg));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
}  // namespace
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TIStreamException::TIStreamException(TIStream &is)
Shinya Kitaoka 120a6e
    : TException(message(is, L"unknown exception")) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TIStreamException::TIStreamException(TIStream &is, const TException &e)
Shinya Kitaoka 120a6e
    : TException(message(is, e.getMessage())) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
TIStreamException::TIStreamException(TIStream &is, std::wstring msg)
Shinya Kitaoka 120a6e
    : TException(message(is, msg)) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 3bfa54
TIStreamException::TIStreamException(TIStream &is, std::string msg)
Shinya Kitaoka 120a6e
    : TException(message(is, msg)) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TIStreamException::~TIStreamException() {}