Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230>2006-10-17 16:02:16 +0400
committerhieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230>2006-10-17 16:02:16 +0400
commit73a21a9fa9b333dc3de262ce3d8b8b8ec1fdee1a (patch)
tree8983939a31f6076b6f854f372ddd188b868e91ab /irstlm/src/gzfilebuf.h
parent01804b708269fdd5abb4f9a963069ea0a80da0ce (diff)
delete this!!
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@892 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'irstlm/src/gzfilebuf.h')
l---------irstlm/src/gzfilebuf.h80
1 files changed, 0 insertions, 80 deletions
diff --git a/irstlm/src/gzfilebuf.h b/irstlm/src/gzfilebuf.h
deleted file mode 120000
index 5e215935a..000000000
--- a/irstlm/src/gzfilebuf.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef _GZFILEBUF_H_
-#define _GZFILEBUF_H_
-
-#include <streambuf>
-#include <zlib.h>
-
-class gzfilebuf : public std::streambuf {
-public:
- gzfilebuf(const char *filename)
- { _gzf = gzopen(filename, "rb");
- setg (_buff+sizeof(int), // beginning of putback area
- _buff+sizeof(int), // read position
- _buff+sizeof(int)); // end position
- }
- ~gzfilebuf() { gzclose(_gzf); }
-protected:
- virtual int_type overflow (int_type c) {
- throw;
- }
-
- // write multiple characters
- virtual
- std::streamsize xsputn (const char* s,
- std::streamsize num) {
- throw;
- }
-
- virtual std::streampos seekpos ( std::streampos sp, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out ){ throw;
- }
-
- //read one character
- virtual int_type underflow () {
- // is read position before end of _buff?
- if (gptr() < egptr()) {
- return traits_type::to_int_type(*gptr());
- }
-
- /* process size of putback area
- * - use number of characters read
- * - but at most four
- */
- unsigned int numPutback = gptr() - eback();
- if (numPutback > sizeof(int)) {
- numPutback = sizeof(int);
- }
-
- /* copy up to four characters previously read into
- * the putback _buff (area of first four characters)
- */
- std::memmove (_buff+(sizeof(int)-numPutback), gptr()-numPutback,
- numPutback);
-
- // read new characters
- int num = gzread(_gzf, _buff+sizeof(int), _buffsize-sizeof(int));
- if (num <= 0) {
- // ERROR or EOF
- return EOF;
- }
-
- // reset _buff pointers
- setg (_buff+(sizeof(int)-numPutback), // beginning of putback area
- _buff+sizeof(int), // read position
- _buff+sizeof(int)+num); // end of buffer
-
- // return next character
- return traits_type::to_int_type(*gptr());
- }
-
- std::streamsize xsgetn (char* s,
- std::streamsize num) {
- return gzread(_gzf,s,num);
- }
-
-private:
- gzFile _gzf;
- static const unsigned int _buffsize = 1024;
- char _buff[_buffsize];
-};
-
-#endif