Doxygen
Loading...
Searching...
No Matches
DefineManager::DefinesPerFile Class Reference

Local class used to hold the defines for a single file. More...

Collaboration diagram for DefineManager::DefinesPerFile:

Public Member Functions

 DefinesPerFile (DefineManager *parent)
 Creates an empty container for defines.
 
void addInclude (const std::string &fileName)
 
void store (const DefineMap &fromMap)
 
void retrieve (DefineMap &toMap)
 
void retrieveRec (DefineMap &toMap, StringUnorderedSet &includeStack)
 
bool stored () const
 

Private Attributes

DefineManagerm_parent
 
DefineMap m_defines
 
StringUnorderedSet m_includedFiles
 
bool m_stored = false
 

Detailed Description

Local class used to hold the defines for a single file.

Definition at line 118 of file pre.l.

Constructor & Destructor Documentation

◆ DefinesPerFile()

DefineManager::DefinesPerFile::DefinesPerFile ( DefineManager * parent)
inline

Creates an empty container for defines.

Definition at line 122 of file pre.l.

124 {
125 }
DefineManager * m_parent
Definition pre.l:164
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1324

References m_parent, and parent().

Referenced by retrieveRec().

Member Function Documentation

◆ addInclude()

void DefineManager::DefinesPerFile::addInclude ( const std::string & fileName)
inline

Definition at line 126 of file pre.l.

127 {
128 m_includedFiles.insert(fileName);
129 }
StringUnorderedSet m_includedFiles
Definition pre.l:166

References m_includedFiles.

◆ retrieve()

void DefineManager::DefinesPerFile::retrieve ( DefineMap & toMap)
inline

Definition at line 139 of file pre.l.

140 {
141 StringUnorderedSet includeStack;
142 retrieveRec(toMap,includeStack);
143 }
void retrieveRec(DefineMap &toMap, StringUnorderedSet &includeStack)
Definition pre.l:144
std::unordered_set< std::string > StringUnorderedSet
Definition containers.h:29

References retrieveRec().

◆ retrieveRec()

void DefineManager::DefinesPerFile::retrieveRec ( DefineMap & toMap,
StringUnorderedSet & includeStack )
inline

Definition at line 144 of file pre.l.

145 {
146 //printf(" retrieveRec #includedFiles=%zu\n",m_includedFiles.size());
147 for (auto incFile : m_includedFiles)
148 {
149 DefinesPerFile *dpf = m_parent->find(incFile);
150 if (dpf && includeStack.find(incFile)==includeStack.end())
151 {
152 includeStack.insert(incFile);
153 dpf->retrieveRec(toMap,includeStack);
154 //printf(" retrieveRec: processing include %s: #toMap=%zu\n",qPrint(incFile),toMap.size());
155 }
156 }
157 for (auto &[name,define] : m_defines)
158 {
159 toMap.emplace(name,define);
160 }
161 }
DefinesPerFile(DefineManager *parent)
Creates an empty container for defines.
Definition pre.l:122

References DefinesPerFile(), m_defines, m_includedFiles, m_parent, and retrieveRec().

Referenced by retrieve(), and retrieveRec().

◆ store()

void DefineManager::DefinesPerFile::store ( const DefineMap & fromMap)
inline

Definition at line 130 of file pre.l.

131 {
132 for (auto &[name,define] : fromMap)
133 {
134 m_defines.emplace(name,define);
135 }
136 //printf(" m_defines.size()=%zu\n",m_defines.size());
137 m_stored=true;
138 }

References m_defines, and m_stored.

◆ stored()

bool DefineManager::DefinesPerFile::stored ( ) const
inline

Definition at line 162 of file pre.l.

162{ return m_stored; }

References m_stored.

Member Data Documentation

◆ m_defines

DefineMap DefineManager::DefinesPerFile::m_defines
private

Definition at line 165 of file pre.l.

Referenced by retrieveRec(), and store().

◆ m_includedFiles

StringUnorderedSet DefineManager::DefinesPerFile::m_includedFiles
private

Definition at line 166 of file pre.l.

Referenced by addInclude(), and retrieveRec().

◆ m_parent

DefineManager* DefineManager::DefinesPerFile::m_parent
private

Definition at line 164 of file pre.l.

Referenced by DefinesPerFile(), and retrieveRec().

◆ m_stored

bool DefineManager::DefinesPerFile::m_stored = false
private

Definition at line 167 of file pre.l.

Referenced by store(), and stored().


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