Getting a List of Entities

A list of all entities, such as files, functions and variables, may be obtained from an Understand::Db object with the command $db->ents(). The list is unsorted. All entities returned are objects of the class Understand::Ent.

foreach $ent ($db->ents()) { 
   # print entity and its kind 
   print $ent->name(),"  [",$ent->kindname(),"]\n"; 
} 

See $db->ents() for detailed information.

The returned list may be refined with a filter that specifies the kind of entities desired. For example, $db->ents("File") returns just file entities.

foreach $file ($db->ents("File")) { 
   # print the long name including directory names 
   print $file->longname(),"\n"; 
} 

See Entity and Reference Kinds for lists of entity kinds for each programming language supported by Understand. In particular, see Using Kinds in the Perl API for a list of methods that deal with entity kinds.

You can also filter the entities returned by name using the $db->lookup method. For example:

# find all 'File' entities that match test*.cpp 
foreach $file ($db->lookup("test*.cpp","File")) { 
   print $file->name(),"\n"; 
} 

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