Fawkes API  Fawkes Development Version
page_reply.h
1 
2 /***************************************************************************
3  * page_reply.h - Web request reply for a normal page
4  *
5  * Created: Thu Oct 23 16:13:48 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_PAGE_REPLY_H_
24 #define _LIBS_WEBVIEW_PAGE_REPLY_H_
25 
26 #include <webview/reply.h>
27 
28 namespace fawkes {
29 
30 class WebPageHeaderGenerator;
31 class WebPageFooterGenerator;
32 
34 {
35 public:
36  WebPageReply(std::string title, std::string page = "");
37 
38  virtual const std::string & body();
39  virtual std::string::size_type body_length();
40  virtual void
41  pack()
42  {
43  pack("", 0, 0);
44  }
45  virtual void pack(std::string active_baseurl,
46  WebPageHeaderGenerator *headergen,
47  WebPageFooterGenerator *footergen);
48 
49  virtual void set_html_header(std::string h);
50 
51  void set_navbar_enabled(bool enabled);
52  bool get_navbar_enabled();
53  void set_footer_enabled(bool enabled);
54  bool get_footer_enabled();
55 
56 protected:
58 
59 protected:
60  /** Title of the page. */
61  std::string _title;
62 
63 private:
64  static const char *PAGE_HEADER;
65  static const char *PAGE_FOOTER;
66 
67  std::string merged_body_;
68  std::string html_header_;
69  bool navbar_enabled_;
70  bool footer_enabled_;
71 };
72 
73 } // end namespace fawkes
74 
75 #endif
Static web reply.
Definition: reply.h:136
Interface for HTML footer generator.
Interface for HTML header generator.
Basic page reply.
Definition: page_reply.h:34
void set_navbar_enabled(bool enabled)
Enable or disable the Fawkes Navigationbar (default enabled)
Definition: page_reply.cpp:141
virtual std::string::size_type body_length()
Get length of body.
Definition: page_reply.cpp:125
virtual void pack()
Pack the data.
Definition: page_reply.h:41
bool get_navbar_enabled()
Is the Fawkes Navigation bar enabled?
Definition: page_reply.cpp:150
void set_footer_enabled(bool enabled)
Enable or disable the Fawkes Webview footer (default enabled)
Definition: page_reply.cpp:159
std::string _title
Title of the page.
Definition: page_reply.h:61
virtual void set_html_header(std::string h)
Set HTML header text.
Definition: page_reply.cpp:87
virtual const std::string & body()
Get body.
Definition: page_reply.cpp:131
WebPageReply(std::string title, std::string page="")
Constructor.
Definition: page_reply.cpp:59
bool get_footer_enabled()
Is the Fawkes Webview footer enabled?
Definition: page_reply.cpp:168
Code code() const
Get response code.
Definition: reply.cpp:104
Code
HTTP response code.
Definition: reply.h:37
Fawkes library namespace.