Google
Web alhem.net

Cgi::ElementList Class Reference

#include <ElementList.h>

Inheritance diagram for Cgi::ElementList:

Inheritance graph
Collaboration diagram for Cgi::ElementList:

Collaboration graph
List of all members.

Public Member Functions

 ElementList (const std::string &tag)
 ElementList (const ElementList &)
 ~ElementList ()
std::string ToString () const
 Generate full tag including content and closing tag.
void Add (Element &el)
std::string GetElements () const

Private Attributes

RefCountm_ref_count
element_v m_elements

Detailed Description

Definition at line 14 of file ElementList.h.


Constructor & Destructor Documentation

Cgi::ElementList::ElementList ( const std::string &  tag  ) 

Definition at line 9 of file ElementList.cpp.

00009                                              : Element(tag)
00010 , m_ref_count( new RefCount() )
00011 {
00012 }

Cgi::ElementList::ElementList ( const ElementList  ) 

Definition at line 15 of file ElementList.cpp.

References m_elements, m_ref_count, and Cgi::Element::SetParent().

00015                                                : Element(ref)
00016 , m_ref_count( ref.m_ref_count )
00017 {
00018         for (element_v::const_iterator it = ref.m_elements.begin(); it != ref.m_elements.end(); it++)
00019         {
00020                 Element *p = *it;
00021                 p -> SetParent( this );
00022                 m_elements.push_back( p );
00023         }
00024         m_ref_count -> Increase();
00025 }

Cgi::ElementList::~ElementList (  ) 

Definition at line 28 of file ElementList.cpp.

References m_elements, and m_ref_count.

00029 {
00030         if (!m_ref_count -> Decrease())
00031         {
00032                 for (element_v::const_iterator it = m_elements.begin(); it != m_elements.end(); it++)
00033                 {
00034                         Element *p = *it;
00035                         delete p;
00036                 }
00037                 delete m_ref_count;
00038         }
00039 }


Member Function Documentation

std::string Cgi::ElementList::ToString (  )  const [virtual]

Generate full tag including content and closing tag.

Reimplemented from Cgi::Element.

Reimplemented in Cgi::HtmlDocument.

Definition at line 62 of file ElementList.cpp.

References Cgi::Element::GetAttributes(), Cgi::Element::GetElementName(), and GetElements().

Referenced by GetElements(), and Cgi::HtmlDocument::ToString().

00063 {
00064         return GetAttributes( GetElementName() ) + GetElements() + "</" + GetElementName() + ">";
00065 }

void Cgi::ElementList::Add ( Element el  ) 

Definition at line 42 of file ElementList.cpp.

References Cgi::Element::Copy(), m_elements, and Cgi::Element::SetParent().

Referenced by main().

00043 {
00044         el.SetParent( this );
00045         m_elements.push_back( el.Copy() );
00046 }

std::string Cgi::ElementList::GetElements (  )  const

Definition at line 49 of file ElementList.cpp.

References m_elements, and ToString().

Referenced by ToString().

00050 {
00051         std::string str;
00052         for (element_v::const_iterator it = m_elements.begin(); it != m_elements.end(); it++)
00053         {
00054                 Element *p = *it;
00055                 std::string tmp = p -> ToString();
00056                 str += tmp;
00057         }
00058         return str;
00059 }


Member Data Documentation

RefCount* Cgi::ElementList::m_ref_count [private]

Definition at line 28 of file ElementList.h.

Referenced by ElementList(), and ~ElementList().

element_v Cgi::ElementList::m_elements [private]

Definition at line 29 of file ElementList.h.

Referenced by Add(), ElementList(), GetElements(), and ~ElementList().


The documentation for this class was generated from the following files:
Generated for cgi++ by doxygen 1.3.7

Page, code, and content Copyright (C) 2004 by Anders Hedström