diff Core/HttpServer/BufferHttpSender.h @ 1519:8bd0d897763f

refactoring: IHttpStreamAnswer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2015 13:15:16 +0200
parents 6e7e5ed91c2d
children f938f7779bcb
line wrap: on
line diff
--- a/Core/HttpServer/BufferHttpSender.h	Tue Aug 11 10:36:05 2015 +0200
+++ b/Core/HttpServer/BufferHttpSender.h	Tue Aug 11 13:15:16 2015 +0200
@@ -39,24 +39,13 @@
   {
   private:
     std::string buffer_;
+    bool done_;
 
-  protected:
-    virtual uint64_t GetFileSize()
+  public:
+    BufferHttpSender() : done_(false)
     {
-      return buffer_.size();
     }
 
-    virtual bool SendData(HttpOutput& output)
-    {
-      if (buffer_.size())
-      {
-        output.SendBody(&buffer_[0], buffer_.size());
-      }
-
-      return true;
-    }
-
-  public:
     std::string& GetBuffer() 
     {
       return buffer_;
@@ -66,5 +55,21 @@
     {
       return buffer_;
     }
+
+
+    /**
+     * Implementation of the IHttpStreamAnswer interface.
+     **/
+
+    virtual uint64_t GetContentLength()
+    {
+      return buffer_.size();
+    }
+
+    virtual bool ReadNextChunk();
+
+    virtual const char* GetChunkContent();
+
+    virtual size_t GetChunkSize();
   };
 }