udbEntityDraw

Description

Create a graphic view of the specified entity in a file.

The kind of graphic views available are dependent on the language and the kind of entity specified. For example, a function entity may have view kinds of “Invocation”, “Callby”, “Declaration” and “Declaration File”.

Graphical view options may optionally be specified as a name and value pair. These options are also dependent on the language and the kind of view specified. For example, the Callby view of a function could optionally show parameters as well as set the font size used, among others.

Syntax

#include “udb/udb.h” 
UdbStatus udbEntityDraw(char *view, 
                        UdbEntity entity, 
                        char *options, 
                         char *file) 

Arguments

Argument
Description
char * view
Specify the kind of graphic view to draw. Non-allocated. The kind of views available depend on the language and the kind of entity specified. A list of the available view kinds for each language follows.
UdbEntity entity
Specify the entity to draw.
char * options
Specify NULL or a string of drawing options. Non-allocated. The format of the options string is "name=value". Multiple options are separated with a semicolon. The valid names and values are the same as those that appear in the Understand Options menus. They may be abbreviated to any unique prefix of their full names. A the list of possible option names and their values for each language follows.
Additionally, the special option 'font' may be specified. Its value must be the path to a TrueType font (.ttf).
char *file
Specify the output file name (.png or .jpg only). Non-allocated.

The View Kinds are the same as those supported in Understand. As of the print date, these are the options:

Languages
Values
Ada
Callby, Child Lib Units, Declaration, Declaration Tree, Declared In, Instantiated From, Instantiations, Invocation, Parent Declaration, Parent Lib Unit, Rename Declaration, Type Derived From, Type Tree, With, Withby
C/C++
Base Classes, Callby, Data Members, Declaration, Declaration File, Declaration Type, Derived Classes, Include, Includeby, Invocation, Parent Declaration, Return Type
FORTRAN
Callby, Declaration, Declaration File, Include, Includeby, Invocation, Usedby, Uses
Java
Callby, Contains, Declaration, Declaration File, Declaration Type, Extends, Extended By, Invocation, Parent Declaration, Return Type
JOVIAL
Callby, Declaration, Declaration File, Declaration Type, Invocation, Parent Declaration, Return Type
Pascal
Callby, Declaration, Declaration File, Include, Includeby, Invocation

The drawing options may be used to specify parameters used to generate the graphics. The format of the options string is "name=value". Multiple options are separated with a semicolon.

Not all options are available for all programming languages and all graphical view types. For a list of the valid options, open Understand for your programming language, then choose Options->Graphical Settings and go to the View Options tab. When you select a view, the options for that graph type are shown.

An options string may contain options that are specific for different views, using the syntax "[viewname]optionname=value". This permits you to, for instance, turn fullnames on for Invocation Trees, but not for CallBy trees.

Names and values may be abbreviated to any unique prefix of their full names. For example, you could use the following options string:

"layout=cross; scale=14" 

Additionally, you may use “font” as a special option for any graph type. Its value must be the path to a TrueType font (.ttf) for JPG and PNG files.

"font=c:\winnt\fonts\times.ttf" 

Return Values

Return Values
Description
Udb_statusOkay
Draw successful.
Udb_statusDrawNoFont
No suitable font can be found.
Udb_statusDrawNoImage
No valid image view is defined or the specified entity does not have a view of the specified kind.
Udb_statusDrawTooBig
The selected view is too large. Note the jpg format does not support a dimension larger than 64K
Udb_statusDrawUnableCreateFile
Unable to create or open file.
Udb_statusDrawUnsupportedFile
File type requested is not supported. Specify only .png or .jpg.

Example Usage

status = udbEntityDraw ("Callby", 
                        funtionEntity, 
                        "scale=14; level=1",
                         "callby.png"); 

See Also

udbEntityKind


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