Doxygen
Loading...
Searching...
No Matches
LayoutNavEntry Struct Reference

Base class for the layout of a navigation item at the top of the HTML pages. More...

#include <src/layout.h>

+ Collaboration diagram for LayoutNavEntry:

Public Types

enum  Kind { NAV_SPECIFICATIONS }
 

Public Member Functions

std::string navToString () const
 
 LayoutNavEntry (LayoutNavEntry *parent, Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro)
 
LayoutNavEntryparent () const
 
Kind kind () const
 
QCString baseFile () const
 
std::string id () const
 
QCString title () const
 
QCString intro () const
 
QCString url () const
 
const LayoutNavEntryListchildren () const
 
LayoutNavEntryListchildren ()
 
void setVisible (bool v)
 
bool visible () const
 
void clear ()
 
void insertChild (size_t pos, std::unique_ptr< LayoutNavEntry > &&e)
 
void appendChild (std::unique_ptr< LayoutNavEntry > &&e)
 
void updateVisibility (LayoutNavEntry *parent)
 
LayoutNavEntryfind (LayoutNavEntry::Kind k, const QCString &file=QCString()) const
 
void swap (LayoutNavEntry &other)
 

Private Member Functions

 LayoutNavEntry ()
 

Private Attributes

LayoutNavEntrym_parent
 
Kind m_kind
 
bool m_visible
 
QCString m_baseFile
 
QCString m_title
 
QCString m_intro
 
LayoutNavEntryList m_children
 

Friends

class LayoutDocManager
 

Detailed Description

Base class for the layout of a navigation item at the top of the HTML pages.

Definition at line 155 of file layout.h.

Member Enumeration Documentation

◆ Kind

Enumerator
NAV_SPECIFICATIONS 

Definition at line 193 of file layout.h.

193 {
194#define NSPEC(x,y) x y,
196#undef NSPEC
197 };
@ NAV_SPECIFICATIONS
Definition layout.h:195

Constructor & Destructor Documentation

◆ LayoutNavEntry() [1/2]

LayoutNavEntry::LayoutNavEntry ( LayoutNavEntry * parent,
Kind k,
bool vs,
const QCString & bf,
const QCString & tl,
const QCString & intro )
inline

Definition at line 209 of file layout.h.

211 : m_parent(parent), m_kind(k), m_visible(vs), m_baseFile(bf), m_title(tl), m_intro(intro) {}
QCString m_intro
Definition layout.h:251
bool m_visible
Definition layout.h:248
LayoutNavEntry * parent() const
Definition layout.h:212
QCString m_baseFile
Definition layout.h:249
Kind m_kind
Definition layout.h:247
QCString intro() const
Definition layout.h:217
LayoutNavEntry * m_parent
Definition layout.h:246
QCString m_title
Definition layout.h:250

References intro(), LayoutNavEntry(), m_baseFile, m_intro, m_kind, m_parent, m_title, m_visible, and parent().

Referenced by find(), LayoutNavEntry(), parent(), swap(), and updateVisibility().

◆ LayoutNavEntry() [2/2]

LayoutNavEntry::LayoutNavEntry ( )
inlineprivate

Definition at line 245 of file layout.h.

245: m_parent(nullptr), m_kind(None), m_visible(true) {}

References m_kind, m_parent, m_visible, and None.

Member Function Documentation

◆ appendChild()

void LayoutNavEntry::appendChild ( std::unique_ptr< LayoutNavEntry > && e)

Definition at line 121 of file layout.cpp.

122{
123 e->updateVisibility(this);
124 m_children.push_back(std::move(e));
125}
LayoutNavEntryList m_children
Definition layout.h:252

References m_children.

◆ baseFile()

QCString LayoutNavEntry::baseFile ( ) const
inline

Definition at line 214 of file layout.h.

214{ return m_baseFile; }

References m_baseFile.

Referenced by url(), and writeUserGroupStubPage().

◆ children() [1/2]

LayoutNavEntryList & LayoutNavEntry::children ( )
inline

Definition at line 220 of file layout.h.

220{ return m_children; }

References m_children.

◆ children() [2/2]

◆ clear()

void LayoutNavEntry::clear ( )
inline

Definition at line 223 of file layout.h.

223{ m_children.clear(); }

References m_children.

◆ find()

LayoutNavEntry * LayoutNavEntry::find ( LayoutNavEntry::Kind k,
const QCString & file = QCString() ) const

Definition at line 133 of file layout.cpp.

135{
136 LayoutNavEntry *result=nullptr;
137 for (const auto &entry : m_children)
138 {
139 // depth first search, needed to find the entry furthest from the
140 // root in case an entry is in the tree twice
141 result = entry->find(kind,file);
142 if (result) return result;
143 if (entry->kind()==kind && (file==QCString() || entry->baseFile()==file))
144 {
145 return entry.get();
146 }
147 }
148 return result;
149}
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
Definition layout.cpp:133
Kind kind() const
Definition layout.h:213
LayoutNavEntry(LayoutNavEntry *parent, Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro)
Definition layout.h:209

References find(), kind(), LayoutNavEntry(), and m_children.

Referenced by find(), generateJSNavTree(), writeAlphabeticalExceptionIndex(), writeAlphabeticalIndex(), writeAlphabeticalInterfaceIndex(), writeAlphabeticalStructIndex(), writeAnnotatedIndexGeneric(), writeClassMemberIndex(), writeClassMemberIndexFiltered(), writeConceptIndex(), writeDefaultQuickLinks(), writeExampleIndex(), writeFileIndex(), writeFileMemberIndex(), writeFileMemberIndexFiltered(), writeGraphicalClassHierarchy(), writeGraphicalExceptionHierarchy(), writeGraphicalInterfaceHierarchy(), writeHierarchicalExceptionIndex(), writeHierarchicalIndex(), writeHierarchicalInterfaceIndex(), writeIndex(), writeModuleIndex(), writeModuleMemberIndex(), writeModuleMemberIndexFiltered(), writeNamespaceIndex(), writeNamespaceMemberIndex(), writeNamespaceMemberIndexFiltered(), writePageIndex(), writePages(), and writeTopicIndex().

◆ id()

std::string LayoutNavEntry::id ( ) const
inline

Definition at line 215 of file layout.h.

215{ return navToString()+":"+m_baseFile.str(); }
std::string navToString() const
Definition layout.h:198

References m_baseFile, and navToString().

Referenced by findNavEntryRec(), and mergeNavTreeNodesRec().

◆ insertChild()

void LayoutNavEntry::insertChild ( size_t pos,
std::unique_ptr< LayoutNavEntry > && e )

Definition at line 127 of file layout.cpp.

128{
129 e->updateVisibility(this);
130 m_children.insert(m_children.begin()+pos,std::move(e));
131}

References m_children.

Referenced by mergeNavTreeNodesRec().

◆ intro()

◆ kind()

Kind LayoutNavEntry::kind ( ) const
inline

Definition at line 213 of file layout.h.

213{ return m_kind; }

References m_kind.

Referenced by find(), navToString(), and url().

◆ navToString()

std::string LayoutNavEntry::navToString ( ) const
inline

Definition at line 198 of file layout.h.

199 {
200 switch (kind())
201 {
202#define NSPEC(x,y) case x: return #x; break;
204#undef NSPEC
205 default: return "unknown"; // to satisfy compiler
206 }
207 }

References kind(), and NAV_SPECIFICATIONS.

Referenced by id(), and printNavLayout().

◆ parent()

LayoutNavEntry * LayoutNavEntry::parent ( ) const
inline

Definition at line 212 of file layout.h.

212{ return m_parent; }

References LayoutNavEntry(), and m_parent.

Referenced by LayoutNavEntry(), renderQuickLinksAsTabs(), and updateVisibility().

◆ setVisible()

void LayoutNavEntry::setVisible ( bool v)
inline

Definition at line 221 of file layout.h.

221{ m_visible = v; }

References m_visible.

◆ swap()

void LayoutNavEntry::swap ( LayoutNavEntry & other)
inline

Definition at line 228 of file layout.h.

229 {
230 std::swap(m_parent,other.m_parent);
231 std::swap(m_kind,other.m_kind);
232 std::swap(m_visible,other.m_visible);
233 std::swap(m_baseFile,other.m_baseFile);
234 std::swap(m_title,other.m_title);
235 std::swap(m_intro,other.m_intro);
236 std::swap(m_children,other.m_children);
237 // reparent children
238 for (auto &child : m_children)
239 {
240 child->m_parent = this;
241 }
242 }

References LayoutNavEntry(), m_baseFile, m_children, m_intro, m_kind, m_parent, m_title, and m_visible.

◆ title()

◆ updateVisibility()

void LayoutNavEntry::updateVisibility ( LayoutNavEntry * parent)

Definition at line 116 of file layout.cpp.

117{
118 m_visible = m_visible && (parent==nullptr || parent->visible());
119}

References LayoutNavEntry(), m_visible, and parent().

◆ url()

QCString LayoutNavEntry::url ( ) const

Definition at line 151 of file layout.cpp.

152{
153 QCString url = baseFile().stripWhiteSpace();
154 if ((kind()!=LayoutNavEntry::User && kind()!=LayoutNavEntry::UserGroup) ||
155 (kind()==LayoutNavEntry::UserGroup && url.startsWith("usergroup")))
156 {
158 }
159 else if (url.startsWith("@ref ") || url.startsWith("\\ref "))
160 {
161 bool found=false;
162 QCString relPath = "";
163 QCString context = QCString();
164 auto parser { createDocParser() };
165 auto dfAst { createRef( *parser.get(), url.mid(5).stripWhiteSpace(), context ) };
166 auto dfAstImpl = dynamic_cast<const DocNodeAST*>(dfAst.get());
167 const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root);
168 if (!df->file().isEmpty() || !df->anchor().isEmpty())
169 {
170 found = true;
171 url=externalRef(relPath,df->ref(),TRUE);
172 if (!df->file().isEmpty())
173 {
174 QCString fn = df->file();
176 url += fn;
177 }
178 if (!df->anchor().isEmpty())
179 {
180 url += "#" + df->anchor();
181 }
182 }
183 if (!found)
184 {
185 msg("explicit link request to '{}' in layout file '{}' could not be resolved\n",url.mid(5),Config_getString(LAYOUT_FILE));
186 }
187 }
188 //printf("LayoutNavEntry::url()=%s\n",qPrint(url));
189 return url;
190}
QCString anchor() const
Definition docnode.h:779
QCString file() const
Definition docnode.h:776
QCString ref() const
Definition docnode.h:778
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
#define Config_getString(name)
Definition config.h:32
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:54
IDocNodeASTPtr createRef(IDocParser &parserIntf, const QCString &target, const QCString &context, const QCString &srcFile, int srcLine)
#define msg(fmt,...)
Definition message.h:94
#define TRUE
Definition qcstring.h:37
QCString url() const
Definition layout.cpp:151
QCString baseFile() const
Definition layout.h:214
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition util.cpp:6162
bool found
Definition util.cpp:984
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:5339

References addHtmlExtensionIfMissing(), DocRef::anchor(), baseFile(), Config_getString, createDocParser(), createRef(), externalRef(), DocRef::file(), found, QCString::isEmpty(), kind(), msg, DocRef::ref(), QCString::stripWhiteSpace(), TRUE, and url().

Referenced by url().

◆ visible()

Friends And Related Symbol Documentation

◆ LayoutDocManager

friend class LayoutDocManager
friend

Definition at line 253 of file layout.h.

References LayoutDocManager.

Referenced by LayoutDocManager.

Member Data Documentation

◆ m_baseFile

QCString LayoutNavEntry::m_baseFile
private

Definition at line 249 of file layout.h.

Referenced by baseFile(), id(), LayoutNavEntry(), and swap().

◆ m_children

LayoutNavEntryList LayoutNavEntry::m_children
private

Definition at line 252 of file layout.h.

Referenced by appendChild(), children(), children(), clear(), find(), insertChild(), and swap().

◆ m_intro

QCString LayoutNavEntry::m_intro
private

Definition at line 251 of file layout.h.

Referenced by intro(), LayoutNavEntry(), and swap().

◆ m_kind

Kind LayoutNavEntry::m_kind
private

Definition at line 247 of file layout.h.

Referenced by kind(), LayoutNavEntry(), LayoutNavEntry(), and swap().

◆ m_parent

LayoutNavEntry* LayoutNavEntry::m_parent
private

Definition at line 246 of file layout.h.

Referenced by LayoutNavEntry(), LayoutNavEntry(), parent(), and swap().

◆ m_title

QCString LayoutNavEntry::m_title
private

Definition at line 250 of file layout.h.

Referenced by LayoutNavEntry(), swap(), and title().

◆ m_visible

bool LayoutNavEntry::m_visible
private

Definition at line 248 of file layout.h.

Referenced by LayoutNavEntry(), LayoutNavEntry(), setVisible(), swap(), updateVisibility(), and visible().


The documentation for this struct was generated from the following files: