20 #include <unordered_map> 23 #include "linkedmap.h" 30 static constexpr
int Page = 0;
31 static constexpr
int MinLevel = 1;
32 static constexpr
int Section = 1;
33 static constexpr
int Subsection = 2;
34 static constexpr
int Subsubsection = 3;
35 static constexpr
int Paragraph = 4;
36 static constexpr
int Subparagraph = 5;
37 static constexpr
int Subsubparagraph = 6;
38 static constexpr
int MaxLevel = 6;
39 static constexpr
int Anchor = 7;
40 static constexpr
int Table = 8;
43 constexpr SectionType(
int lvl) : m_level(lvl) {}
44 constexpr
int level()
const {
return m_level; }
45 constexpr
bool isSection()
const 47 return m_level>=SectionType::MinLevel && m_level<=SectionType::MaxLevel;
60 m_label(label), m_title(title), m_type(type), m_ref(ref),
61 m_lineNr(lineNr), m_fileName(fileName), m_level(level)
71 QCString label()
const {
return m_label; }
72 QCString title()
const {
return m_title; }
74 QCString ref()
const {
return m_ref; }
75 int lineNr()
const {
return m_lineNr; }
76 QCString fileName()
const {
return m_fileName; }
77 bool generated()
const {
return m_generated; }
78 int level()
const {
return m_level; }
79 Definition *definition()
const {
return m_definition; }
82 void setFileName(
const QCString &fn) { m_fileName = fn; }
84 void setGenerated(
bool b) { m_generated = b; }
85 void setDefinition(
Definition *d) { m_definition = d; }
86 void setTitle(
const QCString &t) { m_title = t; }
87 void setLevel(
int l) { m_level = l; }
88 void setReference(
const QCString &r) { m_ref = r; }
89 void setLineNr(
int l) { m_lineNr = l; }
98 bool m_generated =
false;
106 using SectionInfoVec = std::vector<const SectionInfo*>;
108 using const_iterator = SectionInfoVec::const_iterator;
114 auto it = m_lookup.find(label.str());
115 return it!=m_lookup.end() ? it->second :
nullptr;
121 m_lookup.insert({toStdString(si->label()),si});
122 m_entries.push_back(si);
125 const_iterator begin()
const {
return m_entries.cbegin(); }
126 const_iterator end()
const {
return m_entries.cend(); }
127 bool empty()
const {
return m_entries.empty(); }
128 size_t size()
const {
return m_entries.size(); }
131 SectionInfoVec m_entries;
132 std::unordered_map< std::string, const SectionInfo* > m_lookup;
144 si.lineNr(),si.title(),si.type(),si.level(),si.ref());
163 si->setFileName(fileName);
164 si->setLineNr(lineNr);
168 si->setReference(ref);
const T * find(const std::string &key) const
Find an object given the key.
Definition: linkedmap.h:47
The common base class of all entity definitions found in the sources.
Definition: definition.h:74
SectionInfo * replace(const QCString &label, const QCString &fileName, int lineNr, const QCString &title, SectionType type, int level, const QCString &ref=QCString())
Replace an existing section with a new one Return a non-owning pointer to the newly added section...
Definition: section.h:157
static SectionManager & instance()
returns a reference to the singleton
Definition: section.h:178
SectionInfo * add(const SectionInfo &si)
Add a new section given the data of an existing section.
Definition: section.h:141
class that represents a list of constant references to sections.
Definition: section.h:104
const SectionInfo * find(const QCString &label) const
Returns a constant pointer to the section info given a section label or nullptr if no section with th...
Definition: section.h:112
T * add(const char *k, Args &&... args)
Adds a new object to the ordered vector if it was not added already.
Definition: linkedmap.h:90
class that provide information about a section.
Definition: section.h:55
Container class representing a vector of objects with keys.
Definition: linkedmap.h:35
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition: qcstring.h:158
SectionInfo * add(const QCString &label, const QCString &fileName, int lineNr, const QCString &title, SectionType type, int level, const QCString &ref=QCString())
Add a new section Return a non-owning pointer to the newly added section.
Definition: section.h:149
singleton class that owns the list of all sections
Definition: section.h:136
This is an alternative implementation of QCString.
Definition: qcstring.h:93
void add(const SectionInfo *si)
Adds a non-owning section reference.
Definition: section.h:119