Getting Entity Attributes

Once you have gotten an entity (or a group of entities), you can obtain all kinds of information about it. There are a variety of attributes available for an Understand::Ent object.

foreach $func ($db->ents("Function")) { 
   print $func->longname(),"("; 
   $first = 1; 
   # get list of refs that define a parameter entity 
   foreach $param ($func->ents("Define","Parameter")) { 
     print ", " unless $first; 
     print $param->type()," ",$param->name; 
     $first = 0; 
  } 
    print ")\n"; 
} 

The command $ent->name() returns the name of the entity, while $ent->longname() returns a long name, if available. Examples of entities with long names include files, C++ members, and most Ada entities. See $ent->name() and $ent->longname() for detailed information.

If an entity has a type or return type associated with, for example a variable, type or function, the type may be determined with the command $ent->type(). See $ent->type() for detailed information.

The kind of an entity, such as File or Function, may be determined with the command $ent->kindname(). See $ent->kindname() for detailed information.

If desired, the command $ent->kind() may be used instead, which returns an object of the class Understand::Kind. This is sometimes useful when more detailed information about the kind is required. See $ent->kind() for detailed information.


Scientific Toolworks, Inc.
http://www.scitools.com