Doxygen
Loading...
Searching...
No Matches
HtmlAttribList Class Reference

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

#include <src/htmlattrib.h>

+ Inheritance diagram for HtmlAttribList:
+ Collaboration diagram for HtmlAttribList:

Public Member Functions

void mergeAttribute (const QCString &optName, const QCString &optValue)
 
QCString toString (QCString *pAltValue=nullptr) const
 

Detailed Description

Class representing a list of HTML attributes.

Definition at line 32 of file htmlattrib.h.

Member Function Documentation

◆ mergeAttribute()

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

Definition at line 35 of file htmlattrib.h.

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 }
DirIterator begin(DirIterator it) noexcept
Definition dir.cpp:170
DirIterator end(const DirIterator &) noexcept
Definition dir.cpp:175

References begin(), and end().

Referenced by HtmlDocVisitor::operator()().

◆ toString()

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

Definition at line 49 of file htmlattrib.h.

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 }
QCString convertToXML(const QCString &s, bool keepEntities)
Definition util.cpp:4266

References 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: