diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2011-11-12 06:35:20 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2011-11-12 06:35:20 +0400 |
commit | 8e7693076c39a7e81ea090b107323c92024d6f00 (patch) | |
tree | 64b5a6c793485c67071e135e09579d1ba89988e5 /mert | |
parent | fb3b0f9f62259a6e23b8a2e94484957e38dce335 (diff) |
Add const to stream wrapper classes.
Diffstat (limited to 'mert')
-rw-r--r-- | mert/Util.cpp | 10 | ||||
-rw-r--r-- | mert/Util.h | 12 |
2 files changed, 8 insertions, 14 deletions
diff --git a/mert/Util.cpp b/mert/Util.cpp index b9077a2f6..cb34829e7 100644 --- a/mert/Util.cpp +++ b/mert/Util.cpp @@ -75,12 +75,11 @@ void Tokenize(const char *str, const char delim, } inputfilestream::inputfilestream(const std::string &filePath) - : std::istream(0), - m_streambuf(0) + : std::istream(0), m_streambuf(0) { // check if file is readable std::filebuf* fb = new std::filebuf(); - _good=(fb->open(filePath.c_str(), std::ios::in)!=NULL); + is_good = (fb->open(filePath.c_str(), std::ios::in) != NULL); if (filePath.size() > 3 && filePath.substr(filePath.size() - 3, 3) == ".gz") { @@ -104,12 +103,11 @@ void inputfilestream::close() } outputfilestream::outputfilestream(const std::string &filePath) - : std::ostream(0), - m_streambuf(0) + : std::ostream(0), m_streambuf(0) { // check if file is readable std::filebuf* fb = new std::filebuf(); - _good=(fb->open(filePath.c_str(), std::ios::out)!=NULL); + 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!"); diff --git a/mert/Util.h b/mert/Util.h index 1145694da..3df15e571 100644 --- a/mert/Util.h +++ b/mert/Util.h @@ -64,14 +64,12 @@ class inputfilestream : public std::istream { protected: std::streambuf *m_streambuf; - bool _good; + bool is_good; public: explicit inputfilestream(const std::string &filePath); ~inputfilestream(); - bool good() { - return _good; - } + bool good() const { return is_good; } void close(); }; @@ -79,14 +77,12 @@ class outputfilestream : public std::ostream { protected: std::streambuf *m_streambuf; - bool _good; + bool is_good; public: explicit outputfilestream(const std::string &filePath); ~outputfilestream(); - bool good() { - return _good; - } + bool good() const { return is_good; } void close(); }; |