First step towards dynamic ui completion. Add hooks in cppmodelmanager

This adds a way for plugins to tell the cppmodel that for certain files,
the actual contents come from it, instead of reading from the disk.
(For texteditors the cppmodel does that automatically.)

Reviewed-By: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
dt
2009-05-12 13:45:24 +02:00
parent 278fa73718
commit 5c9916478f
3 changed files with 42 additions and 0 deletions

View File

@@ -648,6 +648,16 @@ QByteArray CppModelManager::internalDefinedMacros() const
return macros;
}
void CppModelManager::addEditorSupport(AbstractEditorSupport *editorSupport)
{
m_addtionalEditorSupport.insert(editorSupport);
}
void CppModelManager::removeEditorSupport(AbstractEditorSupport *editorSupport)
{
m_addtionalEditorSupport.remove(editorSupport);
}
QMap<QString, QByteArray> CppModelManager::buildWorkingCopyList()
{
QMap<QString, QByteArray> workingCopy;
@@ -660,6 +670,12 @@ QMap<QString, QByteArray> CppModelManager::buildWorkingCopyList()
workingCopy[fileName] = editorSupport->contents();
}
QSetIterator<AbstractEditorSupport *> jt(m_addtionalEditorSupport);
while (jt.hasNext()) {
AbstractEditorSupport *es = jt.next();
workingCopy[es->fileName()] = es->contents();
}
// add the project configuration file
QByteArray conf(pp_configuration);
conf += definedMacros();