os_preformatted


A block of preformatted text.

An os_preformatted is a block of preformatted text. Similar to os_address , an os_preformatted is a block-structuring page element that begins a new block of text on the page. However, an os_preformatted preserves line breaks and consecutive spaces within text, which differs from os_address . The contents of an os_preformatted are typically rendered in a fixed-width typewriter font.

Elements are inserted into an os_preformatted through either the add() member functions or operator<< .

The maximum number of characters to display on a single line can be specified in a constructor or through the width() member function. Note that the width specification is ignored by some browsers and is deprecated in HTML 3.0.

Declaration

#include <ospace/web/preform.h>
class os_preformatted : public os_element_group

Interface

Constructor
os_preformatted()
Constructs an empty block of preformatted text.
Constructor
os_preformatted( const os_element& element )
Constructs a block of preformatted text containing a copy of element .
Constructor
os_preformatted( const string& text )
Constructs a block of preformatted text containing an os_text element created from text .
Constructor
os_preformatted( int width )
Constructs an empty block of preformatted text to display a maximum of width characters per line.
Constructor
os_preformatted( const os_element& element , int width )
Constructs a block of preformatted text, containing a copy of element , to display a maximum of width characters per line.
Constructor
os_preformatted( const string& text , int width )
Constructs a block of preformatted text, containing an os_text element created from text , to display a maximum of width characters per line.
clone
/* virtual */ os_element* clone() const
Returns a base class pointer to a heap-based deep copy of the block of preformatted text.
print
/* virtual */ void print( ostream& os ) const
Prints the preformatted text to os .
width
int width() const
Returns the maximum number of characters to display per line, or 0 if not set.
width
os_preformatted& width( int width )
Sets the maximum number of characters to display per line to width , and returns a reference to the block of preformatted text.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved