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 117 of file pre.l.

Constructor & Destructor Documentation

◆ DefinesPerFile()

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

Creates an empty container for defines.

Definition at line 121 of file pre.l.

123 {
124 }
DefineManager * m_parent
Definition pre.l:163
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 125 of file pre.l.

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

References m_includedFiles.

◆ retrieve()

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

Definition at line 138 of file pre.l.

139 {
140 StringUnorderedSet includeStack;
141 retrieveRec(toMap,includeStack);
142 }
void retrieveRec(DefineMap &toMap, StringUnorderedSet &includeStack)
Definition pre.l:143
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 143 of file pre.l.

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

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 129 of file pre.l.

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

References m_defines, and m_stored.

◆ stored()

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

Definition at line 161 of file pre.l.

161{ return m_stored; }

References m_stored.

Member Data Documentation

◆ m_defines

DefineMap DefineManager::DefinesPerFile::m_defines
private

Definition at line 164 of file pre.l.

Referenced by retrieveRec(), and store().

◆ m_includedFiles

StringUnorderedSet DefineManager::DefinesPerFile::m_includedFiles
private

Definition at line 165 of file pre.l.

Referenced by addInclude(), and retrieveRec().

◆ m_parent

DefineManager* DefineManager::DefinesPerFile::m_parent
private

Definition at line 163 of file pre.l.

Referenced by DefinesPerFile(), and retrieveRec().

◆ m_stored

bool DefineManager::DefinesPerFile::m_stored = false
private

Definition at line 166 of file pre.l.

Referenced by store(), and stored().


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