htmlList
Ordered and unordered list class
[Previous] [Main] [Next]


Description
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.  
 
Declaration
#include <dcmicro/htmlpp/list.h>  
 
Hierarchy
htmllist.gif  
 
See Also
htmlListItem  
 
Related Constants/Definitions
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 ;  
 
Constructors
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.  
 
Destructors
virtual ~htmlList()  
Destroys the object.  
 
Member Methods
=      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.  
 
SequenceNumberhtmlList& 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.  
 
SequenceNumberint 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.  
 
Print      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.  
 
Example Use
 
#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 ;  
}  
 
Program Output
 
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>  
 
 
list.gif  





©1998 DC Micro Development. All rights reserved.
No portion of this document may be c opied or reproduced without expressed written consent.
html++ is a trademark of DC Micro Development.