Panda3D
 All Classes Functions Variables Enumerations
subStreamBuf.h
00001 // Filename: subStreamBuf.h
00002 // Created by:  drose (02Aug02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef SUBSTREAMBUF_H
00016 #define SUBSTREAMBUF_H
00017 
00018 #include "pandabase.h"
00019 #include "streamWrapper.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //       Class : SubStreamBuf
00023 // Description : The streambuf object that implements ISubStream.
00024 ////////////////////////////////////////////////////////////////////
00025 class EXPCL_PANDAEXPRESS SubStreamBuf : public streambuf {
00026 public:
00027   SubStreamBuf();
00028   virtual ~SubStreamBuf();
00029 
00030   void open(IStreamWrapper *source, OStreamWrapper *dest, streampos start, streampos end, bool append);
00031   void close();
00032 
00033   virtual streampos seekoff(streamoff off, ios_seekdir dir, ios_openmode which);
00034   virtual streampos seekpos(streampos pos, ios_openmode which);
00035 
00036 protected:
00037   virtual int overflow(int c);
00038   virtual int sync();
00039   virtual int underflow();
00040 
00041 private:
00042   IStreamWrapper *_source;
00043   OStreamWrapper *_dest;
00044   streampos _start;
00045   streampos _end;
00046   bool _append;
00047   streampos _gpos;
00048   streampos _ppos;
00049   char *_buffer;
00050 };
00051 
00052 #endif
 All Classes Functions Variables Enumerations