[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Re: Get list of functions?

I ended up fixing my problem - in case anyone else has the same problem and comes
across this message, I ended up doing (with my binary):

            for (ICElement b : bin.getCProject().getChildrenOfType(ICElement.C_CCONTAINER)) {
                ICContainer c = (ICContainer) b;
                for (ITranslationUnit ast : c.getTranslationUnits()) {
                TranslationUnitVisitor v = new TranslationUnitVisitor();
                ast.accept(v);
            }
            }

where TranslationUnitVisitor implemented ICElementVisitor, with a visit method that
returned true in all instances and did stuff if arg0.getElementType() == ICElement.C_FUNCTION

<3,
-Charley

On Wed, Aug 19, 2009 at 10:09 AM, Charley Wang <charley.wang@xxxxxxxxx> wrote:
Hi,

Is there any way to get a list of all the functions in a file? I know this information is listed
in the Outline view, but I can't figure out how to get at it programmatically.

I have so far been trying to go from the CModel to elements of type C_FUNCTION,
but have had no luck.

Any help would be greatly appreciated :)

-Charley