Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to find filename and namespace in cdt ast node basespecifier (c++ inheritance)
How to find filename and namespace in cdt ast node basespecifier (c++ inheritance) [message #1737798] Wed, 13 July 2016 06:35
Anton Kloek is currently offline Anton KloekFriend
Messages: 1
Registered: July 2016
Junior Member
Hi!
I've already tried posting this question in stack overflow but havent got any response so I'll try here as well!

I'm currently working on an eclipse plugin that is about generating class diagrams for c++ classes. The project is coded in java using the eclipse CDT library and I'm collecting the info I need by traversing the AST. But I'm having trouble extracting the info i need!

Problem: Getting the filename and namespace info belongning to a INHERITED CLASS?! while being in the file where the inheritance happens!

Imagine the following scenario:

File 1: core.h
namespace core{
class Parent{

};
}


File 2: child.h
namespace somethingelse{
class Child : public Parent{

};
}

When I'm traversing the AST of file 2 i get to the node for the whole class (CompositeTypeSpecifier) and from that i can get all inheritances as a list of nodes:

ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[] inheritance = ((CPPASTCompositeTypeSpecifier) node).getBaseSpecifiers();
When I'm at this point i just whant to take the basespecifier node (public Parent) and find a connection to File 1 "core.h" and namespace "core"??????????

p.s if you look in the documentation and find the inherited method getContainingFilename(), then no! that refers to the file the node is created from (not where the class was originaly created)

Thanks in advance! Anton

[Updated on: Mon, 08 August 2016 12:38]

Report message to a moderator

Previous Topic:C++ debugging can't set breakpoints using GUI
Next Topic:Non-stop mode
Goto Forum:
  


Current Time: Thu Apr 25 19:15:09 GMT 2024

Powered by FUDForum. Page generated in 0.03504 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top