University of Sheffield   

    The Simons
    Component Library

Introduction   Class Hierarchy   Class Listing   Index of Classes   Index of Methods   Header Files  

WebOutput Class Reference

#include <WebOutput.h>

Inheritance diagram for WebOutput:

TextOutput Output FileStream Stream Object List of all members.

Detailed Description

WebOutput: an output stream for writing text to web pages.

WebOutput is a kind of TextOutput stream for generating web pages, that is used by CGI programs. It adapts TextOutput by redefining the open() and close() methods to print the header and footer text required by web browsers automatically. This ensures that the page is properly formatted even in the event of an Exception. The title of the web page may be supplied at construction or by openOn(), but output is always directed to the standard output stream. Each paired use of openOn() and close() writes to a separate web page. Text formatting and spacing methods are redefined to insert XHTML tags that achieve the same effect. All other methods are inherited from TextOutput.


Public Member Functions

 WebOutput ()
 Construct a default WebOutput stream.

virtual ~WebOutput ()
 Release an unused WebOutput stream.

 WebOutput (StringID)
 Construct a standard WebOutput stream onto the named web page.

virtual ObjectID clone () const
 Clone a copy of this WebOutput.

virtual Void open ()
 Open this WebOutput stream for writing.

virtual Void close ()
 Close this WebOutput stream.

virtual Void openLog ()
 Open this WebOutput stream for appending.

virtual Void openOn (StringID)
 Open this WebOutput on a new web page.

virtual Void openLogOn (StringID)
 Open this WebOutput on a new web page.

StringID page () const
 Return this WebOutput's web page title.

virtual OutputID line ()
 Write an XHTML forced line break tag on the output.

virtual OutputID space ()
 Write an XHTML non-breaking space on the output.

virtual OutputID tab ()
 Write five XHTML non-breaking spaces on the output.


Protected Member Functions

 WebOutput (const WebOutput &)
 Copy another WebOutput stream.


Constructor & Destructor Documentation

WebOutput::WebOutput const WebOutput &  output  )  [protected]
 

Copy another WebOutput stream.

Required by C++ to ensure that copying a WebOutput faithfully copies a TextOutput. Constructs a shallow copy of the other WebOutput.

Parameters:
output - the WebOutput to copy.
Returns:
the copied WebOutput stream.

WebOutput::WebOutput  ) 
 

Construct a default WebOutput stream.

Constructs a WebOutput stream onto the standard output. CGI programs are always expected to print results on standard output. By default the page name is set to "Generated Output" and the filesystem is closed.

Returns:
a standard WebOutput stream.

WebOutput::~WebOutput  )  [virtual]
 

Release an unused WebOutput stream.

Performs all closing actions to print out the closing tags for the web page and then disconnect from the underlying filesystem.

WebOutput::WebOutput StringID  name  ) 
 

Construct a standard WebOutput stream onto the named web page.

Constructs a WebOutput stream that will use the supplied name as the title of the web page, but which streams to standard output.

Parameters:
name - a web page name.
Returns:
a WebOutput stream.


Member Function Documentation

ObjectID WebOutput::clone  )  const [virtual]
 

Clone a copy of this WebOutput.

Creates a shallow copy, which shares the web page name, if any, but does not initialise any filesystem.

Reimplemented from TextOutput.

Void WebOutput::close  )  [virtual]
 

Close this WebOutput stream.

Provided this WebOutput is open, prints the standard footer text for a web page and closes the connection to standard output. Otherwise, has no effect. The standard footer text includes a message "Generated on <date> by the Simons Component Library" inside address-tags and all closing XHTML tags.

Reimplemented from Output.

OutputID WebOutput::line  )  [virtual]
 

Write an XHTML forced line break tag on the output.

May raise a WriteFailure exception if writing fails.

Reimplemented from TextOutput.

Void WebOutput::open  )  [virtual]
 

Open this WebOutput stream for writing.

Provided this WebOutput is not already in use, opens a connection to the standard output stream and prints the standard header text for a web page. Otherwise, raises a NoResponse exception indicating that the connection was refused. Any String name that was supplied is used as the title of the web page. Upon opening, prints the standard MIME header required by web browsers and all information required inside the XHTML head-tags, including the page title, up to the opening body-tag. Thereafter, user data corresponding to the web page content may be streamed using the various put() methods. All content is appended to standard output.

Reimplemented from Output.

Void WebOutput::openLog  )  [virtual]
 

Open this WebOutput stream for appending.

Equivalent to the standard open() method, since every opening action is expected to start a new web page and all data is appended to standard output in any case. This method is provided for compatibility only. See open() for full details.

Reimplemented from Output.

Void WebOutput::openLogOn StringID  title  )  [virtual]
 

Open this WebOutput on a new web page.

Equivalent to the standard openOn() method, since every opening action is expected to start a new web page and all data is appended to standard output in any case. This method is provided for compatibility only. See openOn() for full details.

Parameters:
title - a web page title.

Reimplemented from FileStream.

Void WebOutput::openOn StringID  title  )  [virtual]
 

Open this WebOutput on a new web page.

Provided this WebOutput is closed, sets the new page name and opens a connection to standard output and prints the standard header text for a web page, using the supplied title as the web page title. Otherwise, raises a DeviceBusy exception, to indicate that this WebOutput is already writing to a web page. Use openOn() and close() alternately to write to a series of different web pages.

Parameters:
title - a web page title.

Reimplemented from FileStream.

StringID WebOutput::page  )  const [inline]
 

Return this WebOutput's web page title.

Returns:
the title of the web page being written by this TextOutput.

OutputID WebOutput::space  )  [virtual]
 

Write an XHTML non-breaking space on the output.

May raise a WriteFailure exception if writing fails.

Reimplemented from TextOutput.

OutputID WebOutput::tab  )  [virtual]
 

Write five XHTML non-breaking spaces on the output.

May raise a WriteFailure exception if writing fails.

Reimplemented from TextOutput.


The documentation for this class was generated from the following files:
Generated on Fri May 5 17:17:20 2006 for The Simons Component Library by doxygen1.3