Fawkes API  Fawkes Development Version
file_reply.h
1 
2 /***************************************************************************
3  * file_reply.h - Web request file reply
4  *
5  * Created: Thu Oct 23 13:47:33 2008
6  * Copyright 2006-2009 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __LIBS_WEBVIEW_FILE_REPLY_H_
24 #define __LIBS_WEBVIEW_FILE_REPLY_H_
25 
26 #include <webview/reply.h>
27 #include <cstdio>
28 
29 namespace fawkes {
30 #if 0 /* just to make Emacs auto-indent happy */
31 }
32 #endif
33 
35 {
36  public:
37  DynamicFileWebReply(const char *filename);
38  DynamicFileWebReply(FILE *file, bool close_when_done = true);
39  virtual ~DynamicFileWebReply();
40 
41  virtual size_t size();
42  virtual size_t next_chunk(size_t pos, char *buffer, size_t buf_max_size);
43 
44  private:
45  void determine_file_size();
46 
47  private:
48  FILE *__file;
49  size_t __size;
50  bool __close_when_done;
51 };
52 
53 } // end namespace fawkes
54 
55 #endif
DynamicFileWebReply(const char *filename)
Constructor.
Definition: file_reply.cpp:47
virtual size_t size()
Total size of the web reply.
Definition: file_reply.cpp:96
Dynamic raw file transfer reply.
Definition: file_reply.h:34
Fawkes library namespace.
virtual ~DynamicFileWebReply()
Destructor.
Definition: file_reply.cpp:76
Dynamic web reply.
Definition: reply.h:123
virtual size_t next_chunk(size_t pos, char *buffer, size_t buf_max_size)
Get data of next chunk.
Definition: file_reply.cpp:102