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 #if 0 /* just to make Emacs auto-indent happy */
30 }
31 #endif
32 
33 class WebPageHeaderGenerator;
34 class WebPageFooterGenerator;
35 
37 {
38  public:
39  WebPageReply(std::string title, std::string page = "");
40 
41  virtual const std::string & body();
42  virtual std::string::size_type body_length();
43  virtual void pack() { pack("", 0, 0); }
44  virtual void pack(std::string active_baseurl,
45  WebPageHeaderGenerator *headergen,
46  WebPageFooterGenerator *footergen);
47 
48  virtual void set_html_header(std::string h);
49 
50  void set_navbar_enabled(bool enabled);
51  bool get_navbar_enabled();
52  void set_footer_enabled(bool enabled);
53  bool get_footer_enabled();
54 
55  protected:
57 
58  protected:
59  /** Title of the page. */
60  std::string _title;
61 
62  private:
63  static const char *PAGE_HEADER;
64  static const char *PAGE_FOOTER;
65 
66  std::string __merged_body;
67  std::string __html_header;
68  bool navbar_enabled_;
69  bool footer_enabled_;
70 };
71 
72 } // end namespace fawkes
73 
74 #endif
virtual void set_html_header(std::string h)
Set HTML header text.
Definition: page_reply.cpp:94
bool get_navbar_enabled()
Is the Fawkes Navigation bar enabled?
Definition: page_reply.cpp:155
std::string _title
Title of the page.
Definition: page_reply.h:60
Fawkes library namespace.
virtual const std::string & body()
Get body.
Definition: page_reply.cpp:138
virtual void pack()
Pack the data.
Definition: page_reply.h:43
bool get_footer_enabled()
Is the Fawkes Webview footer enabled?
Definition: page_reply.cpp:171
Interface for HTML header generator.
Code code() const
Get response code.
Definition: reply.cpp:86
Basic page reply.
Definition: page_reply.h:36
void set_navbar_enabled(bool enabled)
Enable or disable the Fawkes Navigationbar (default enabled)
Definition: page_reply.cpp:147
Interface for HTML footer generator.
void set_footer_enabled(bool enabled)
Enable or disable the Fawkes Webview footer (default enabled)
Definition: page_reply.cpp:163
Code
HTTP response code.
Definition: reply.h:40
virtual std::string::size_type body_length()
Get length of body.
Definition: page_reply.cpp:131
WebPageReply(std::string title, std::string page="")
Constructor.
Definition: page_reply.cpp:63
Static web reply.
Definition: reply.h:133