os_paragraph


A paragraph.

An os_paragraph is a block of text. Similar to os_address , an os_paragraph is a block-structuring page element that begins a new block on the page and arranges its contents as a continuous paragraph ignoring line breaks and consecutive spaces. A line can be broken by inserting an os_break into an os_paragraph .

Unlike an os_address , the contents of an os_paragraph are not rendered in a special font. An os_paragraph typically is rendered with space above and below it. The first line is indented by some browsers.

Elements are inserted into an os_paragraph through either the add() member functions or operator<< . Although most browsers are lenient on this point, text should not be inserted directly into an os_body . Rather, text should be contained within a block-structuring element like an os_paragraph that is contained within an os_body .

By default, the contents of an os_paragraph are aligned on the left. The alignment of the elements within an os_paragraph can be specified in a constructor or through the align() member function. Note that the alignment specification supports a feature proposed for HTML 3.0 and may not be supported by all browsers.

Declaration

#include <ospace/web/paragrph.h>
class os_paragraph : public os_element_group

Enums

enum os_paragraph::alignment
  {
  left,    // Aligns the paragraph contents against the left margin.
  center,  // Centers the paragraph contents between the right and left margins.
  right    // Aligns the paragraph contents against the right margin.
  };
	

Interface

Constructor
os_paragraph()
Constructs an empty paragraph.
Constructor
os_paragraph( alignment align )
Constructs an empty paragraph aligned according to align .
Constructor
os_paragraph( const os_element& element )
Constructs a paragraph containing a copy of element .
Constructor
os_paragraph( const os_element& element , alignment align )
Constructs a paragraph containing a copy of element , aligned according to align .
Constructor
os_paragraph( const string& text )
Constructs a paragraph containing an os_text element created from text .
Constructor
os_paragraph( const string& text , alignment align )
Constructs a paragraph containing an os_text element created from text , aligned according to align .
align
os_paragraph& align( alignment align )
Sets the alignment to align and returns a reference to the paragraph.
align int
align() const
Returns the alignment, or os_element::use_default if not set.
clone
/* virtual */ os_element* clone() const
Returns a base class pointer to a heap-based deep copy of the paragraph.
print
/* virtual */ void print( ostream& os ) const
Prints the paragraph to os .

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved