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 
33 class WebPageReply : public StaticWebReply
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,
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
fawkes::WebPageHeaderGenerator
Definition: page_header_generator.h:36
fawkes::WebPageReply::set_navbar_enabled
void set_navbar_enabled(bool enabled)
Enable or disable the Fawkes Navigationbar (default enabled)
Definition: page_reply.cpp:147
fawkes::WebPageReply::set_html_header
virtual void set_html_header(std::string h)
Set HTML header text.
Definition: page_reply.cpp:93
fawkes::WebReply::Code
Code
HTTP response code.
Definition: reply.h:43
fawkes::WebPageReply::set_footer_enabled
void set_footer_enabled(bool enabled)
Enable or disable the Fawkes Webview footer (default enabled)
Definition: page_reply.cpp:165
fawkes::WebPageReply::get_navbar_enabled
bool get_navbar_enabled()
Is the Fawkes Navigation bar enabled?
Definition: page_reply.cpp:156
fawkes::WebPageReply::WebPageReply
WebPageReply(std::string title, std::string page="")
Constructor.
Definition: page_reply.cpp:65
fawkes::WebPageReply::body_length
virtual std::string::size_type body_length()
Get length of body.
Definition: page_reply.cpp:131
fawkes
fawkes::WebPageFooterGenerator
Definition: page_footer_generator.h:36
fawkes::WebPageReply::_title
std::string _title
Title of the page.
Definition: page_reply.h:67
fawkes::WebPageReply::get_footer_enabled
bool get_footer_enabled()
Is the Fawkes Webview footer enabled?
Definition: page_reply.cpp:174
fawkes::WebReply::code
Code code() const
Get response code.
Definition: reply.cpp:110
fawkes::WebPageReply::body
virtual const std::string & body()
Get body.
Definition: page_reply.cpp:137
fawkes::WebPageReply::pack
virtual void pack()
Pack the data.
Definition: page_reply.h:47