Base Framework
Public Member Functions | Public Attributes | List of all members
HTMLElement Class Reference

#include <base/string/HTML.h>

Inherits HTMLItem.

Public Member Functions

 HTMLElement () noexcept
 
 HTMLElement (const String &_name) noexcept
 
R< HTMLItemcopy () override
 
MemorySize getNumberOfAttributes () const noexcept
 
MemorySize getNumberOfChildren () const noexcept
 
HTMLElementaddChild (const R< HTMLItem > &e)
 
R< HTMLItemgetChild (unsigned int index)
 
R< HTMLTextaddText (const String &text)
 
R< HTMLElementgetFirstChild (const char *name) noexcept
 
R< HTMLElementgetFirstChild (const String &name) noexcept
 
R< HTMLAttributegetAttribute (const String &name) noexcept
 
String getAttributeValue (const String &name) const noexcept
 
void setAttribute (const String &name, const String &value)
 
void toCode (StringOutputStream &code) override
 
- Public Member Functions inherited from ReferenceCountedObject
 ReferenceCountedObject () noexcept
 
 ReferenceCountedObject (const ReferenceCountedObject &copy) noexcept
 
 ReferenceCountedObject (ReferenceCountedObject &&move) noexcept
 
ReferenceCountedObjectoperator= (const ReferenceCountedObject &copy) noexcept
 
ReferenceCountedObjectoperator= (ReferenceCountedObject &&move) noexcept
 
MemorySize getNumberOfReferences_INTERNAL () const noexcept
 
virtual bool useGarbageCollector () const noexcept
 
- Public Member Functions inherited from DynamicObject
 DynamicObject () noexcept
 
bool isValidObject () const noexcept
 
virtual ~DynamicObject () noexcept(false)
 
 _COM_AZURE_DEV__BASE__OVERRIDE_ALLOC ()
 

Public Attributes

String name
 
Allocator< R< HTMLAttribute > > attributes
 
Allocator< R< HTMLItem > > children
 

Detailed Description

HTML element.

Constructor & Destructor Documentation

◆ HTMLElement() [1/2]

HTMLElement::HTMLElement ( )
noexcept

Initialize unnamed element.

◆ HTMLElement() [2/2]

HTMLElement::HTMLElement ( const String _name)
noexcept

Initialize element.

Member Function Documentation

◆ addChild()

HTMLElement& HTMLElement::addChild ( const R< HTMLItem > &  e)

Adds child.

◆ addText()

R<HTMLText> HTMLElement::addText ( const String text)

Adds text item.

◆ copy()

R<HTMLItem> HTMLElement::copy ( )
overridevirtual

Copies element.

Implements HTMLItem.

◆ getAttribute()

R<HTMLAttribute> HTMLElement::getAttribute ( const String name)
noexcept

Returns the attribute by name. Returns nullptr if not set.

◆ getAttributeValue()

String HTMLElement::getAttributeValue ( const String name) const
noexcept

Returns the value of the attribute with the given name. Returns empty string if not set.

◆ getChild()

R<HTMLItem> HTMLElement::getChild ( unsigned int  index)

Returns the child by index.

◆ getFirstChild() [1/2]

R<HTMLElement> HTMLElement::getFirstChild ( const char *  name)
noexcept

Returns the first child of the given type.

◆ getFirstChild() [2/2]

R<HTMLElement> HTMLElement::getFirstChild ( const String name)
noexcept

Returns the first child of the given type.

◆ getNumberOfAttributes()

MemorySize HTMLElement::getNumberOfAttributes ( ) const
noexcept

Returns the number of attributes.

◆ getNumberOfChildren()

MemorySize HTMLElement::getNumberOfChildren ( ) const
noexcept

Returns the number of children.

◆ setAttribute()

void HTMLElement::setAttribute ( const String name,
const String value 
)

Sets the attribute.

◆ toCode()

void HTMLElement::toCode ( StringOutputStream code)
overridevirtual

Converts element to HTML code.

Implements HTMLItem.

Member Data Documentation

◆ attributes

Allocator<R<HTMLAttribute> > HTMLElement::attributes

◆ children

Allocator<R<HTMLItem> > HTMLElement::children

Children.

◆ name

String HTMLElement::name

The element name.