Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/downloader/chunkedStreamBuf.h

Go to the documentation of this file.
00001 // Filename: chunkedStreamBuf.h
00002 // Created by:  drose (25Sep02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef CHUNKEDSTREAMBUF_H
00020 #define CHUNKEDSTREAMBUF_H
00021 
00022 #include "pandabase.h"
00023 
00024 // This module is not compiled if OpenSSL is not available.
00025 #ifdef HAVE_SSL
00026 
00027 #include "httpChannel.h"
00028 #include "bioStreamPtr.h"
00029 #include "pointerTo.h"
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //       Class : ChunkedStreamBuf
00033 // Description : The streambuf object that implements
00034 //               IChunkedStream.
00035 ////////////////////////////////////////////////////////////////////
00036 // No need to export from DLL.
00037 class ChunkedStreamBuf : public streambuf {
00038 public:
00039   ChunkedStreamBuf();
00040   virtual ~ChunkedStreamBuf();
00041 
00042   void open_read(BioStreamPtr *source, HTTPChannel *doc);
00043   void close_read();
00044 
00045 protected:
00046   virtual int underflow(void);
00047 
00048 private:
00049   size_t read_chars(char *start, size_t length);
00050   bool http_getline(string &str);
00051 
00052   PT(BioStreamPtr) _source;
00053   size_t _chunk_remaining;
00054   bool _done;
00055   string _working_getline;
00056 
00057   PT(HTTPChannel) _doc;
00058   int _read_index;
00059 
00060   friend class IChunkedStream;
00061 };
00062 
00063 #endif  // HAVE_SSL
00064 
00065 #endif

Generated on Fri May 2 00:36:43 2003 for Panda by doxygen1.3