|
htmlList
Ordered and unordered list class | [Previous] [Main] [Next] |
| htmlItalic encapsulates the <UL></UL> and <OL></OL> tags. It is used in conjunction with the htmlListItem class to assemble ordered and unordered lists. List items are added to htmlList objects using the Add() method or the << operator. If an object added to htmlList isn't already an htmlListItem object, it aforementioned methods automatically convert it to an htmlListItem object internally.
| |
|
| |
| #include <dcmicro/htmlpp/list.h>
| |
|
| |
| |
|
| |
| htmlListItem
| |
|
| |
| typedef enum {
| |
| ordered_list,
| |
| unordered_list
| |
| } ListStyle ;
| |
|
| |
| typedef enum {
| |
| number_default = 0,
| |
| number_standard_arabic,
| |
| number_uppercase_letter,
| |
| number_lowercase_letter,
| |
| number_uppercase_roman,
| |
| number_lowercase_roman,
| |
| bullet_disc,
| |
| bullet_circle,
| |
| bullet_square
| |
| } NumberStyle ;
| |
|
| |
| htmlList( | ListStyle list_style = ordered_list,
| |
| NumberStyle number_style = number_default,
| ||
| Boolean enable_compact_spacing = FALSE )
| ||
| Constructs a list object using the specified options.
| |
|
| |
| htmlList( const htmlList& rhs )
| |
| Copy constructor.
| |
|
| |
| virtual ~htmlList()
| |
| Destroys the object.
| |
|
| |
| = | htmlList& operator= (const htmlList& rhs )
| |
| Replaces list contents with a copy of rhs and returns a reference to the list.
| |
|
| |
| Add | htmlObject FAR * Add( const htmlObject& element )
| |
| Adds element to the list, converting it if necessary to an htmlListItem object, then returns a pointer to the new object.
| |
|
| |
| Add | htmlObject FAR * Add( const String& text )
| |
| Adds text as an htmlListItem object to the list and returns a pointer to the new object.
| |
|
| |
| Type | htmlList& Type( ListStyle list_style )
| |
| Sets the list type to list_style, and returns a reference to the list.
| |
|
| |
| Type | int Type() const
| |
| Returns the list style as an integer.
| |
|
| |
| Compact | htmlList& Compact( Boolean compact_spacing = TRUE )
| |
| If compact_spacing is TRUE, the list will be rendered with reduced space between each list item. A reference to the list is returned.
| |
|
| |
| IsCompact | Boolean IsCompact() const
| |
| Returns TRUE if the compact attribute has been set, FALSE if not.
| |
|
| |
| Continue | htmlList& Continue( Boolean continue_sequence = TRUE )
| |
| If continue_sequence is TRUE, sets the list to continue numbering from where the last ordered list ended. A reference to the object is returned.
| |
|
| |
| Continue | Boolean Continue() const
| |
| Returns TRUE if the list is set to continue numbering from where the last ordered list ended, FALSE otherwise.
| |
|
| |
| SequenceNumber | htmlList& SequenceNumber( int sequence_number )
| |
| Sets the starting number used by the browser to number the items in the list to sequence_number, and returns a reference to the list.
| |
|
| |
| SequenceNumber | int SequenceNumber() const
| |
| Returns the number used to begin numbering the list items, or zero if not set.
| |
|
| |
| Start | htmlList& Start( int starting_number )
| |
| Sets the starting number for the list to starting_number, and returns a reference to the list.
| |
|
| |
| Start | int Start() const
| |
| Returns the number used to begin numbering the list items, or zero if not set.
| |
|
| |
| Numbering | htmlList& Numbering( NumberStyle number_style )
| |
| Sets the style used to number the list items to number_style, and returns a reference to the list.
| |
|
| |
| Numbering | int Numbering() const
| |
| Returns the style used to number the list items as an integer.
| |
|
| |
| void Print( ostream& os ) const
| ||
| Outputs the object to os.
| |
|
| |
| Clone | htmlObject FAR * Clone() const
| |
| Returns a base-class pointer to a deep copy of the object.
| |
|
| |
|
| |
| #include <stdio.h>
| |
| #include <stdlib.h>
| |
| #include <dcmicro/htmlpp/htmlpp.h>
| |
|
| |
| int main( void )
| |
| {
| |
| htmlCgi server ;
| |
| htmlPage page( "html++ example application" ) ;
| |
|
| |
| // Construct a list using the default options
| |
| htmlList list1 ;
| |
| list1 << "One" ;
| |
| list1 << "Two" ;
| |
| list1 << "Three" ;
| |
|
| |
| // Construct another list letter numbering
| |
| htmlList list2( ordered_list, number_uppercase_letter ) ;
| |
| list2 << "One" ;
| |
| list2 << "Two" ;
| |
| list2 << "Three" ;
| |
|
| |
| // Construct an unordered list
| |
| htmlList list3( unordered_list ) ;
| |
| list3 << "One" ;
| |
| list3 << "Two" ;
| |
| list3 << "Three" ;
| |
|
| |
| page << "Default list"
| |
| << list1 ;
| |
|
| |
| page << "Letter-numbered list"
| |
| << list2 ;
| |
|
| |
| page << "Unordered list"
| |
| << list3 ;
| |
|
| |
| server << page ;
| |
| return 0 ;
| |
| }
| |
|
| |
|
| |
| Content-Type: text/html
| |
| <HTML>
| |
| <HEAD>
| |
| <TITLE>html++ example application</TITLE>
| |
| </HEAD>
| |
| <BODY>
| |
| Default list<OL><LI>One</LI>
| |
| <LI>Two</LI>
| |
| <LI>Three</LI>
| |
| </OL>
| |
| Letter-numbered list<OL TYPE="A"><LI>One</LI>
| |
| <LI>Two</LI>
| |
| <LI>Three</LI>
| |
| </OL>
| |
| Unordered list<UL><LI>One</LI>
| |
| <LI>Two</LI>
| |
| <LI>Three</LI>
| |
| </UL>
| |
| </BODY>
| |
| </HTML>
| |
|
| |
|
| |
| |
