diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2011-11-12 06:44:39 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2011-11-12 06:44:39 +0400 |
commit | ee0345b9b6abc23c46c0eb1cf9114d720d64482c (patch) | |
tree | baa5b83ae4691a02105feb6b5028ca973eb067f7 /mert/Util.cpp | |
parent | 8e7693076c39a7e81ea090b107323c92024d6f00 (diff) |
Move filestream wrapper classes to FileStream.{h,cpp}
Diffstat (limited to 'mert/Util.cpp')
-rw-r--r-- | mert/Util.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/mert/Util.cpp b/mert/Util.cpp index cb34829e7..cded1f1ea 100644 --- a/mert/Util.cpp +++ b/mert/Util.cpp @@ -74,58 +74,7 @@ void Tokenize(const char *str, const char delim, } } -inputfilestream::inputfilestream(const std::string &filePath) - : std::istream(0), m_streambuf(0) -{ - // check if file is readable - std::filebuf* fb = new std::filebuf(); - is_good = (fb->open(filePath.c_str(), std::ios::in) != NULL); - - if (filePath.size() > 3 && - filePath.substr(filePath.size() - 3, 3) == ".gz") { - fb->close(); - delete fb; - m_streambuf = new gzfilebuf(filePath.c_str()); - } else { - m_streambuf = fb; - } - this->init(m_streambuf); -} - -inputfilestream::~inputfilestream() -{ - delete m_streambuf; - m_streambuf = 0; -} - -void inputfilestream::close() -{ -} -outputfilestream::outputfilestream(const std::string &filePath) - : std::ostream(0), m_streambuf(0) -{ - // check if file is readable - std::filebuf* fb = new std::filebuf(); - is_good = (fb->open(filePath.c_str(), std::ios::out) != NULL); - - if (filePath.size() > 3 && filePath.substr(filePath.size() - 3, 3) == ".gz") { - throw runtime_error("Output to a zipped file not supported!"); - } else { - m_streambuf = fb; - } - this->init(m_streambuf); -} - -outputfilestream::~outputfilestream() -{ - delete m_streambuf; - m_streambuf = 0; -} - -void outputfilestream::close() -{ -} int swapbytes(char *p, int sz, int n) { |