summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/PreprocessorEnvironment.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-02-23 12:49:56 +0100
committerRoberto Raggi <roberto.raggi@nokia.com>2009-02-23 12:49:56 +0100
commit1c063f6953fe61c078e665a4774ef04623cee95d (patch)
treefc710c40c6310dc6f07aa8bbb8262b44b8780c85 /src/libs/cplusplus/PreprocessorEnvironment.cpp
parentc8bdd0bee4325ff50216fc39da2c9dfa8219cb56 (diff)
downloadqt-creator-1c063f6953fe61c078e665a4774ef04623cee95d.tar.gz
Alternative implementation of the indexer. It is a little bit slower, but I'm going to make it faster.
Unfortunately the refactoring of the indexer is kind of necessary. I need to merge the new binding pass.
Diffstat (limited to 'src/libs/cplusplus/PreprocessorEnvironment.cpp')
-rw-r--r--src/libs/cplusplus/PreprocessorEnvironment.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libs/cplusplus/PreprocessorEnvironment.cpp b/src/libs/cplusplus/PreprocessorEnvironment.cpp
index 930e4b3a6c..5d52e6e53f 100644
--- a/src/libs/cplusplus/PreprocessorEnvironment.cpp
+++ b/src/libs/cplusplus/PreprocessorEnvironment.cpp
@@ -117,6 +117,13 @@ Macro *Environment::bind(const Macro &__macro)
return m;
}
+void Environment::addMacros(const QList<Macro> &macros)
+{
+ foreach (const Macro &macro, macros) {
+ bind(macro);
+ }
+}
+
Macro *Environment::remove(const QByteArray &name)
{
Macro macro;
@@ -127,6 +134,23 @@ Macro *Environment::remove(const QByteArray &name)
return bind(macro);
}
+void Environment::reset()
+{
+ if (_macros) {
+ qDeleteAll(firstMacro(), lastMacro());
+ free(_macros);
+ }
+
+ if (_hash)
+ free(_hash);
+
+ _macros = 0;
+ _allocated_macros = 0;
+ _macro_count = -1;
+ _hash = 0;
+ _hash_count = 401;
+}
+
bool Environment::isBuiltinMacro(const QByteArray &s) const
{
if (s.length() != 8)