diff --git a/CppParser/include/Poco/CppParser/Function.h b/CppParser/include/Poco/CppParser/Function.h index 8e367171e..e060f61ee 100644 --- a/CppParser/include/Poco/CppParser/Function.h +++ b/CppParser/include/Poco/CppParser/Function.h @@ -119,6 +119,11 @@ public: bool isDeleted() const; /// Returns true iff the method has been deleted. + bool isVirtual() const; + /// Returns true if the method is virtual. Also examines base + /// classes to check for a virtual function with the same + /// signature. + bool isStatic() const; /// Returns true iff the method is static. @@ -128,11 +133,6 @@ public: std::string signature() const; /// Returns the signature of the function. - bool isVirtual() const; - /// Returns true if the method is virtual. Also examines base - /// classes to check for a virtual function with the same - /// signature. - Function* getOverridden() const; /// If the function is virtual and overrides a function in a /// base class, the base class function is returned. diff --git a/CppParser/include/Poco/CppParser/NameSpace.h b/CppParser/include/Poco/CppParser/NameSpace.h index 02d7f5450..9f5b3dab5 100644 --- a/CppParser/include/Poco/CppParser/NameSpace.h +++ b/CppParser/include/Poco/CppParser/NameSpace.h @@ -61,8 +61,8 @@ public: Iterator end() const; /// Returns an iterator for iterating over the NameSpace's Symbol's. - - Symbol* lookup(const std::string& name) const; + + virtual Symbol* lookup(const std::string& name) const; /// Looks up the given name in the symbol table /// and returns the corresponding symbol, or null /// if no symbol can be found. The name can include diff --git a/CppParser/include/Poco/CppParser/Struct.h b/CppParser/include/Poco/CppParser/Struct.h index 2c3a5c7cd..2a5a17019 100644 --- a/CppParser/include/Poco/CppParser/Struct.h +++ b/CppParser/include/Poco/CppParser/Struct.h @@ -139,6 +139,9 @@ public: Symbol::Kind kind() const; std::string toString() const; + // Namespace + Symbol* lookup(const std::string& name) const; + private: std::string _decl; BaseClasses _bases; diff --git a/CppParser/src/NameSpace.cpp b/CppParser/src/NameSpace.cpp index 9bd683030..65f62eb4b 100644 --- a/CppParser/src/NameSpace.cpp +++ b/CppParser/src/NameSpace.cpp @@ -99,7 +99,8 @@ Symbol* NameSpace::lookup(const std::string& name, std::set& a return pSymbol; if (alreadyVisited.find(this) != alreadyVisited.end()) - return pSymbol; + return pSymbol; + std::string head; std::string tail; splitName(name, head, tail); @@ -107,7 +108,6 @@ Symbol* NameSpace::lookup(const std::string& name, std::set& a alreadyVisited.insert(this); bool currentNSInserted = true; - if (head.empty()) { alreadyVisited.insert(this); diff --git a/CppParser/src/Struct.cpp b/CppParser/src/Struct.cpp index fa2ed6db4..b57119799 100644 --- a/CppParser/src/Struct.cpp +++ b/CppParser/src/Struct.cpp @@ -252,4 +252,28 @@ std::string Struct::toString() const } +Symbol* Struct::lookup(const std::string& name) const +{ + Symbol* pSymbol = NameSpace::lookup(name); + if (!pSymbol) + { + for (BaseIterator it = baseBegin(); it != baseEnd(); ++it) + { + if (it->access != Symbol::ACC_PRIVATE) + { + if (it->pClass) + { + pSymbol = it->pClass->lookup(name); + if (pSymbol) + { + return pSymbol; + } + } + } + } + } + return pSymbol; +} + + } } // namespace Poco::CppParser