[aspectc-user] Using puma to print out class member names

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Thu Dec 30 17:49:02 CET 2004


Hi,

Sunder, Shyam (MSTG - NY) wrote:
> Olaf,
> 
> Thanks for all the help. Now that I have a way to parse a class, I need
> print out all its base classes. Here is my loop:
> 
>     int numClasses = classdb.ClassInfos();
>     for ( int i =0; i < numClasses; i++ )
>     {
>         CClassInfo* classInfo = classdb.ClassInfo(i);
>         std::cout << "Class Name: " << classInfo->Name();
> 
>         int numBaseClasses = classInfo->BaseClasses();
>         for ( int j = 0; j < numBaseClasses; j++ )
>         {
>             CBaseClassInfo* baseClassInfo = classInfo->BaseClass(j);
>             std::cout << "[" << baseClassInfo->Name() << "] ";
>         }
>         std::cout << std::endl;
>     }
> 
> However, baseClassInfo->Name() returns a null. How do I get to the name
> of the base classes? What if they are template parameters?
> 
> -Shyam 

(1) you have to use baseClassInfo->Class ()->Name ()
(2) looking at the output of ccparsers it seems to me that base classes,
     which are template parameters of a class template are not listed as
     base classes. We have to look into this ...

BTW, you could copy & paste from CClassDatabase::Dump* (see 
Puma/src/infos/CClassDatabase.cc).

Olaf



More information about the aspectc-user mailing list