Fawkes API Fawkes Development Version

fawkes::WebPageReply Class Reference

Basic page reply. More...

#include <>>

Inheritance diagram for fawkes::WebPageReply:

List of all members.

Public Member Functions

 WebPageReply (std::string title, std::string page="")
 Constructor.
virtual const std::string & body ()
 Get body.
virtual std::string::size_type body_length ()
 Get length of body.
virtual void pack ()
 Pack the data.
virtual void pack (std::string active_baseurl, WebPageHeaderGenerator *headergen, WebPageFooterGenerator *footergen)
 Pack web page reply.

Protected Member Functions

 WebPageReply (response_code_t code)
 Base constructor.

Protected Attributes

std::string _title
 Title of the page.

Detailed Description

Basic page reply.

This reply adds header and footer as appropriate to form a HTML document with logo and navigation.

Author:
Tim Niemueller

Definition at line 36 of file page_reply.h.


Constructor & Destructor Documentation

fawkes::WebPageReply::WebPageReply ( std::string  title,
std::string  body = "" 
)

Constructor.

Parameters:
titletitle of the page
bodyOptional initial body of the page

Definition at line 62 of file page_reply.cpp.

References _title.

fawkes::WebPageReply::WebPageReply ( response_code_t  code) [protected]

Base constructor.

Constructor that does not set a title or anything. Use for sub-classes.

Parameters:
codeHTTP code for this reply

Definition at line 73 of file page_reply.cpp.


Member Function Documentation

const std::string & fawkes::WebPageReply::body ( ) [virtual]

Get body.

Returns:
reference to body.

Reimplemented from fawkes::StaticWebReply.

Definition at line 116 of file page_reply.cpp.

std::string::size_type fawkes::WebPageReply::body_length ( ) [virtual]

Get length of body.

Returns:
body length

Reimplemented from fawkes::StaticWebReply.

Definition at line 109 of file page_reply.cpp.

virtual void fawkes::WebPageReply::pack ( ) [inline, virtual]

Pack the data.

This method is called just before the reply is sent. You can implement this method if you need to compose your reply before body() and body_length() provide valid output.

Reimplemented from fawkes::StaticWebReply.

Definition at line 43 of file page_reply.h.

References pack().

Referenced by pack(), and fawkes::WebRequestDispatcher::queue_static_reply().

void fawkes::WebPageReply::pack ( std::string  active_baseurl,
WebPageHeaderGenerator headergen,
WebPageFooterGenerator footergen 
) [virtual]

Pack web page reply.

This method creates the final page by calling the header and footer generators if supplied (otherwise a standard header is chosen) and the body.

Parameters:
active_baseurlthe active navigation URL, can be used for instance to high-light the current section in the navigation.
headergenheader generator
footergenfooter generator

Definition at line 88 of file page_reply.cpp.

References fawkes::StaticWebReply::_body, _title, fawkes::WebPageFooterGenerator::html_footer(), fawkes::WebPageHeaderGenerator::html_header(), and fawkes::HostInfo::short_name().


Member Data Documentation

std::string fawkes::WebPageReply::_title [protected]

Title of the page.

Definition at line 53 of file page_reply.h.

Referenced by pack(), fawkes::WebErrorPageReply::WebErrorPageReply(), and WebPageReply().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends