Skip to main content

The HtmlAttribList Class Reference

Class representing a list of HTML attributes. More...

Declaration

class HtmlAttribList { ... }

Included Headers

#include <src/htmlattrib.h>

Base class

classstd::vector< HtmlAttrib >

Public Member Functions Index

voidmergeAttribute (const QCString &optName, const QCString &optValue)
QCStringtoString (QCString *pAltValue=nullptr) const

Description

Class representing a list of HTML attributes.

Definition at line 32 of file htmlattrib.h.

Public Member Functions

mergeAttribute()

void HtmlAttribList::mergeAttribute (const QCString & optName, const QCString & optValue)
inline

Definition at line 35 of file htmlattrib.h.

35 void mergeAttribute(const QCString &optName,const QCString &optValue)
36 {
37 auto it = std::find_if(begin(),end(),
38 [&optName](const auto &opt) { return opt.name==optName; });
39 if (it!=end()) // attribute name already in the list: append values
40 {
41 it->value += " " + optValue;
42 }
43 else // attribute name not yet in the list
44 {
45 emplace_back(optName,optValue);
46 }
47 }

References begin and end.

Referenced by HtmlDocVisitor::operator().

toString()

QCString HtmlAttribList::toString (QCString * pAltValue=nullptr)
inline

Definition at line 49 of file htmlattrib.h.

49 QCString toString(QCString *pAltValue = nullptr) const
50 {
51 QCString result;
52 for (const auto &att : *this)
53 {
54 if (!att.value.isEmpty()) // ignore attribute without values as they
55 // are not XHTML compliant, with the exception
56 // of the alt attribute with the img tag
57 {
58 if (att.name=="alt" && pAltValue) // optionally return the value of alt separately
59 // need to convert <img> to <object> for SVG images,
60 // which do not support the alt attribute
61 {
62 *pAltValue = att.value;
63 }
64 else
65 {
66 result+=" "+att.name+"=\""+convertToXML(att.value)+"\"";
67 }
68 }
69 else if (att.name=="open")
70 {
71 // The open attribute is a boolean attribute.
72 // Specifies that the details should be visible (open) to the user
73 // As it is a boolean attribute the initialization value is of no interest
74 result+=" "+att.name+"=\"true\"";
75 }
76 else if (att.name=="nowrap") // In XHTML, attribute minimization is forbidden, and the nowrap attribute must be defined as <td nowrap="nowrap">.
77 {
78 result+=" "+att.name+"=\"nowrap\"";
79 }
80 }
81 return result;
82 }

Reference convertToXML.

Referenced by HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator(), HtmlDocVisitor::operator() and HtmlDocVisitor::operator().


The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus by Doxygen 1.14.0.