Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] How to identify a class in a *.cpp file?

Hello,  all:

I am new to the CDT, and right now trying to develop a plug in to do a static analysis for our c++ source code. I want to find out the class name in the *.cpp file. However, I don't find any suitable API to do this. Can someone tell me which API i should use and how I should  do it? I have made a solution in a different way as following. Please help! thank you so much!


public void analyze(AnalysisHistory history) {
        CodeReviewResource resource = (CodeReviewResource)getProvider().getProperty(
                history.getHistoryId(), CodeReviewProvider.RESOURCE_PROPERTY);
        List<IASTNode> tUnitList = resource.getTypedNodeList(
                resource.getResourceCompUnit(), CodeReviewVisitor.TYPE_IASTDeclaration);
       
        for(IASTNode fileNode:tUnitList){
                //psudo code
                for each node, call the getRawSignature();
                find out the class  name by checking the string got from getRawSignature().
        }
    }

--
Best Regards,
WeiSong

Back to the top