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

Class that manages the defines available while preprocessing files. More...

Classes

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

Public Member Functions

void addInclude (const std::string &fromFileName, const std::string &toFileName)
 
void store (const std::string &fileName, const DefineMap &fromMap)
 
void retrieve (const std::string &fileName, DefineMap &toMap)
 
bool alreadyProcessed (const std::string &fileName) const
 

Private Member Functions

DefinesPerFilefind (const std::string &fileName) const
 Helper function to return the DefinesPerFile object for a given file name.
 

Private Attributes

std::unordered_map< std::string, std::unique_ptr< DefinesPerFile > > m_fileMap
 

Friends

class DefinesPerFile
 

Detailed Description

Class that manages the defines available while preprocessing files.

Definition at line 113 of file pre.l.

Member Function Documentation

◆ addInclude()

void DefineManager::addInclude ( const std::string & fromFileName,
const std::string & toFileName )
inline

Definition at line 172 of file pre.l.

173 {
174 //printf("DefineManager::addInclude('%s'->'%s')\n",fromFileName.c_str(),toFileName.c_str());
175 auto it = m_fileMap.find(fromFileName);
176 if (it==m_fileMap.end())
177 {
178 it = m_fileMap.emplace(fromFileName,std::make_unique<DefinesPerFile>(this)).first;
179 }
180 auto &dpf = it->second;
181 dpf->addInclude(toFileName);
182 }
std::unordered_map< std::string, std::unique_ptr< DefinesPerFile > > m_fileMap
Definition pre.l:224

References m_fileMap.

◆ alreadyProcessed()

bool DefineManager::alreadyProcessed ( const std::string & fileName) const
inline

Definition at line 206 of file pre.l.

207 {
208 auto it = m_fileMap.find(fileName);
209 if (it!=m_fileMap.end())
210 {
211 return it->second->stored();
212 }
213 return false;
214 }

References m_fileMap.

◆ find()

DefinesPerFile * DefineManager::find ( const std::string & fileName) const
inlineprivate

Helper function to return the DefinesPerFile object for a given file name.

Definition at line 218 of file pre.l.

219 {
220 auto it = m_fileMap.find(fileName);
221 return it!=m_fileMap.end() ? it->second.get() : nullptr;
222 }

References m_fileMap.

◆ retrieve()

void DefineManager::retrieve ( const std::string & fileName,
DefineMap & toMap )
inline

Definition at line 195 of file pre.l.

196 {
197 auto it = m_fileMap.find(fileName);
198 if (it!=m_fileMap.end())
199 {
200 auto &dpf = it->second;
201 dpf->retrieve(toMap);
202 }
203 //printf("DefineManager::retrieve(%s,#=%zu)\n",fileName.c_str(),toMap.size());
204 }

References m_fileMap.

◆ store()

void DefineManager::store ( const std::string & fileName,
const DefineMap & fromMap )
inline

Definition at line 184 of file pre.l.

185 {
186 //printf("DefineManager::store(%s,#=%zu)\n",fileName.c_str(),fromMap.size());
187 auto it = m_fileMap.find(fileName);
188 if (it==m_fileMap.end())
189 {
190 it = m_fileMap.emplace(fileName,std::make_unique<DefinesPerFile>(this)).first;
191 }
192 it->second->store(fromMap);
193 }

References m_fileMap.

Friends And Related Symbol Documentation

◆ DefinesPerFile

friend class DefinesPerFile
friend

Definition at line 169 of file pre.l.

Member Data Documentation

◆ m_fileMap

std::unordered_map< std::string, std::unique_ptr<DefinesPerFile> > DefineManager::m_fileMap
private

Definition at line 224 of file pre.l.

Referenced by addInclude(), alreadyProcessed(), find(), retrieve(), and store().


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