Chapter 9. The Browser Reference

This chapter describes all of the windows and features associated with the Browser.

This chapter contains the following sections:

Browsing Choices Window

The Browsing Choices window (see Figure 9-1) lets you select items to be browsed from a list derived from the fileset in the Browser View window. Double-clicking an item in the selection list causes the Browsing Choices window to be raised (moved to the front) with the chosen item as the current subject for analysis.

Figure 9-1. Browsing Choices Window

Browsing Choices
Window

Browsing Choices Window for C++

With C++ code, the Browsing Choices window displays one column to indicate the kind of item, a column to identify the item, and three columns indicating properties, as follows:

  • Kind: classes, template definitions, and template instances

  • Name: the name of the item

  • Abstract: abstract property: concrete (blank), abstract by declaration, or abstract by inheritance

  • Delta: delta property: dynamic, internal dynamic, or non-dynamic (blank)

  • Template: template property: specific definition, partial instantiation, or normal (blank)

The Browsing Choices window provides a facility for sorting items by column. To do this, click in the column you wish to sort on and select Sort from the Admin menu.

Browser View Window

Browser View is the primary Browser window (see Figure 9-2). It opens when you select Browser from the Admin menu of the Static Analyzer, but does not display data until you select an item from the list in the Browsing Choices window. Browser View displays internal and related information for elements in C++. The information is presented in hierarchical lists shown in outline format.

Browser View lets you perform a variety of static analysis database queries, depending on your current work context. Queries concerning the current subject are accessed from the Queries menu in the menu bar. You can also make queries specific to the selected elements in the list area by holding down the right mouse button to display a popup Queries menu specific to that type of element. The results of queries are indicated by highlighting matching elements in the Browser View window. Matching results are also highlighted in the Source View window (if it is displayed) and in the Static Analyzer (if the Show in Static Analyzer toggle (see “Show in Static Analyzer Toggle”) is turned on) .

You can also launch graphical views showing hierarchies and call graphs from the Browser View window. In addition, you can generate man pages and web pages from Browser View.

Figure 9-2. Browser View Window Elements

Browser View
Window Elements

Current Subject Field

The Current Subject field indicates the kind and name of the element to be analyzed. It is directly below the menu bar (see Figure 9-2). The label on this field is initially set to Current Subject. To analyze an element, you can type directly into this field (or select from the Browsing Choices window). The label changes according to the kind of element you select. You can enter the following kinds of elements:

  • C++ class

  • C++ template definition

  • C++ template instance

If you type a partial string and then press the space bar, the Browser attempts to complete the element name by searching the fileset. A beep indicates that more than one matching name exists. If a match is made, press the Enter key to make the change effective.

If you type a question mark (?) into the Current Subject field, the Browsing Choices window opens. You can select a new item by double-clicking a name in the selection list.

Show in Static Analyzer Toggle

The Show in Static Analyzer toggle is directly to the right of the Current Subject field (see Figure 9-2). When the toggle is set (a check mark and the label Yes appear), the results of all queries are displayed in the Static Analyzer window from which the Browser was launched, including the file, line number, and source line for the matching items. If no results are found and the Static Analyzer window is open, the window comes to the front with an error message.

Last Query Button

The Last Query button is at the top right of the window, directly beneath the Help menu (see Figure 9-2). Clicking this button displays the results of the most recent query in the Static Analyzer window from which the Browser was launched.

Browser View Query Identification Area

The Browser View query identification area is directly above the list area (see Figure 9-2). This area displays the most recent query as a sentence containing both the query question and the name of the object of the query. The number of elements matching the query is displayed at the right end of the line.

Browser View List Areas

The lower two-thirds of the Browser View window consists of two lists displayed in side-by-side panes (see Figure 9-2). The lists contain information about the currently selected subject and are organized by category in an outline format. The lists are:

  • member list: a detailed view of the internals of the current subject.

  • relation list: items related to the current subject.

You can change the relative widths of the panes that display these lists by moving the sash that separates the panes.

Table 9-1. Browser View List Summary

Language

Member List Contents

Relations List Contents

C++

PUBLIC/ INSTANCE/PRIVATE

INSTANCE /STATIC

TYPES/ DATA/METHODS/

VIRTUAL METHODS

BASE CLASSES (including the current class)/DERIVED CLASSES/USES/ USED BY/FRIEND FUNCTIONS/ FRIENDS/FRIEND OF


Outline Icons

Each category name appears with an outline icon to its left, that is, a diamond-shaped icon that can be used to collapse (hide) or expand (make visible) the items under that category. Inside the icon there is an arrow that indicates whether the category is in the expanded or collapsed state. If the arrow points downward, the list is in its expanded state, which means all items are displayed. If the icon points to the right, the category is in its collapsed state, which means all items in that category are hidden. Clicking the arrow toggles the state of the category, displaying or hiding the category's contents. Another function of the outline icon is to indicate when a collapsed list contains items matching the current query. This is shown with a filled outline icon. See Figure 9-3.

Figure 9-3. Outline List Icons and Indicator Marks

Outline List Icons and Indicator Marks

Annotated Scroll Bars and Highlighted Entries

Lists also use annotated scroll bars to locate highlighted list entries. When you make a query on an item in a list, the Browser displays indicator marks in the scroll bars in both panes corresponding to the relative positions of matching items. This informs you about all matches even if they are in collapsed categories or in a portion of the list that is not currently in view. If you click an indicator with the middle mouse button, you scroll directly to the matching item in the list. When the thumb of the scroll bar overlaps a given tick mark, the corresponding entry is visible in the list window. See Figure 9-3.

C++ Member List

The Xmember list displays the types, data members, methods, and virtual methods internal to the current class, template definition, or template instance when you are analyzing C++ code. It labels constructor methods as -constructor-> and destructors as -destructor-> .

Display Hierarchy

The members of the current class are sorted recursively into three nested lists according to the access specification (PUBLIC, PROTECTED, or PRIVATE) of each member. Within each of the access categories, the members are sorted by scope into two categories (INSTANCE and STATIC). Finally, within each category, members are displayed by member category type in this order: TYPE, DATA, METHODS (member functions), and VIRTUAL METHODS.

Here is a schematic of the outline format for each nested list:

Access (PUBLIC, PROTECTED, or PRIVATE)
      Scope (INSTANCE or STATIC)
         TYPES
         DATA
         METHODS
         VIRTUAL METHODS

C++ Access Categories

The following access categories are available:

  • PUBLIC members: accessible by any method or C-style function

  • PROTECTED members: accessible only by methods in derived classes, friend classes, or friend functions

  • PRIVATE members: accessible only by methods in the class in which they are defined, friend classes, or friend functions

C++ Scope Categories

The scope categories are as follows:

  • STATIC members: all objects of a given class contain the same value for a given member

  • INSTANCE (nonstatic) members: members in different instances of that class can contain different data values

C++ Class Member Categories

Class members fall into the following categories:

  • TYPES: definitions of data types declared within a class

  • DATA: variables that contain state information for a class

  • METHODS (or member functions): definitions of how a class interacts with other classes and structures

  • VIRTUAL METHODS: methods for an object that ensure that the method invoked is defined by the class from which the object was instantiated, regardless of type casting

The list organization is customizable. For more information, see Appendix A, “Customizing the Browser”.

C++ Relation List

The C++ relations list displays the current class and its related classes in the class list. The categories in the list are:

  • BASE CLASSES: ccontains the current class and its ancestors, listed hierarchically

  • DERIVED CLASSES: ccontains descendants of the current class, listed hierarchically

  • USES: contains classes that the current class uses (that is, instantiates, destroys, interacts with, or contains)

  • USED BY: contains classes that the current class is used by

  • FRIEND FUNCTIONS: contains global functions declared as friends by the current class

  • FRIENDS: contains classes that are declared as friends by the current class.

  • FRIEND OF: contains classes that declare the current class as a friend.

Within this list, the current class is displayed as follows:

<- This

This notation refers to the class in the Current Class field.

C++ Relations List Mouse Shortcuts

Double-clicking any displayed class brings up a Source View window that highlights the function's definition.

C++ BASE CLASSES Category Hierarchy

The BASE CLASSES category shows the ancestors of the current class, if any. Each indented class is an ancestor of the class listed above it. The BASE CLASSES category indicates a multiple inheritance relationship by indenting parent classes to the same level. If a given class has ancestors, it is accompanied by an outline icon, which works in a similar manner to the outline icons in the member list. Each ancestor name is followed by its inheritance access type (PUBLIC , PROTECTED, or PRIVATE) listed in parentheses.

This schematic gives an example of a BASE CLASSES category:

BASE CLASSES
   <-This
     first_parent_of_This (access type)
               parent_of_first_parent_class (access type)
     second_parent_of_This (access type)
                parent_of_second_parent_class (access type)

C++ DERIVED CLASSES Category Hierarchy

The DERIVED CLASSEScategory shows the descendants of the current class, if any. Each indented class is a descendant of the class listed above it. If a given class has descendants, it is accompanied by an outline icon, which works in a similar manner to the outline icons in the base classes category and member list.

This schematic gives an example of a possible DERIVED CLASSES category:

DERIVED CLASSES
    first_child_of_This
       child_of_first_child_class
    second_child_of_This
       child_of_second_child_class

Browser View Menu Bar

The following sections describe the menus, found in the Browser View window's menu bar (see Figure 9-4).

Figure 9-4. Browser View Menu Bar with Menus Displayed

Browser View
Menu Bar with Menus Displayed

Admin Menu

The Admin menu contains the following options for selecting new subjects, manipulating Browser View windows, generating man and web pages, and exiting the Browser View.

  • Change Current Subject: lets you select a new current subject without manually typing it into the Current Subject field. Choosing this option opens the Browsing Choices window, which contains a scrolling list of all the classes or packages available from the current fileset. Double-clicking an item selects it for display in the Browser View window and closes the Browsing Choices window.

  • Another Browser View: creates an identical copy of the Browser View window. All current information displayed within the initial window appears in the copy, but connections to the graphical view windows are not carried over to the new Browser View window.

  • Close Browser View: shuts the Browser View window and any associated windows.

  • Generate Man Pages: opens the Man Page Generator window, which lets you create man page templates for classes (C++).

    Select individual subjects by clicking them. If you want a man page for every subject in the list, click Select All . To remove selections you have made, click Unselect All. Clicking the Generate button creates a man page template for each selected subject. If man pages exist for any selected subjects, the Browser warns you, unless you set the Warn Overwrite toggle to No.

    Output files go in the directory shown in the Man Page Directory field, if it exists. To specify a different output directory, click the Set Directory button in the Man Page Generator window and enter your choice.

    Figure 9-5. Man Page Generator and Typical Man Page Template

    Man Page Generator and Typical Man Page Template

  • Generate Web Pages: opens the Web Page Generator window (see Figure 9-6), which lets you create web page templates for classes (C++), packages.These templates are in HTML format and can be read by World Wide Web browsers.

    Select individual subjects by clicking them. If you want a web page for every subject in the list, click Select All . To remove selections you've made, click Unselect All. Clicking the Generate button creates a web page template for each selected subject. If web pages exist for any selected subjects, the browser warns you, unless you set the Warn Overwrite toggle to No.

    Output files go in the directory shown in the Web Page Directory field, if it exists. To specify a different output directory, click the Set Directory button in the Web Page Generator window and enter your choice.

    Figure 9-6. Web Page Generator Window

    Web Page Generator Window

  • Exit Browser: quits the Browser, closing all windows launched from it (except Source View ). The Static Analyzer window from which the browser was launched is not affected.

Views Menu

The Views menu contains options for opening graphical views. Each of the first four selections opens a Graph Views window for the current class. The last selection opens a Call Graph window. The following selections are available from the Views menu:

  • Show Inheritance Graph: describes the relationship between base classes and derived classes.

  • Show Containment Graph: describes the relationship of container classes to the classes they use as components.

  • Show Interaction Graph: describes the relationship of used classes to the classes that are their users.

  • Show Friend Graph: describes the relationship of classes declaring friends to the classes they declare.

  • Show Call Graph: opens a Call Graph window. To perform operations in it, select a method from the member list display, press the right mouse button to display the Methods popup menu, and select Add, Remove, or Replace from the Call Graph submenu.

History Menu

The History menu contains options that let you quickly select previously chosen subjects for display in the Browser View window. If no class was selected previously, a message appears. The following selections are available from the History menu:

  • Show Previous Subject: sets the current subject to the previously displayed class, and the information in the Browser View window changes to reflect this.

  • Show History: opens a List of Subjects Shown chooser window for selecting previously viewed subjects. The window presents the previous subjects in reverse chronological order, that is, the most recent subject appears at the bottom of the list.

    To select a subject, click it and press Apply or OK. Double-clicking a subject has the same effect as selecting OK. It makes the selection and closes the window. The selected class then becomes the current subject in the Browser View window.

Queries Menu

The Queries menu is accessed from the menu bar and applies to the current subject. The following selections are available from the Queries menu:

  • What Is Declared: displays all methods declared by the current class.

  • What Is Defined: displays all members defined by the current class.

  • What Is Overridden By: displays all inherited methods that the current class overrides.

  • What is Pure Virtual: displays all pure virtual functions in the current subject.

  • What Instantiates: displays classes that instantiate the current class by invoking its constructors by using its new methods.

  • What Destroys: displays classes that destroy the current class by invoking its destructors or by using its delete methods.

  • What Uses submenu: displays classes that use the current class in the following contexts:

    • To Contain: displays classes that use the current class as either an embedded or linked component.

    • As Friend: displays classes that use the current class as a friend class.

    • Methods: displays classes that use the methods defined by the current class.

    • Data Members: displays classes that use (by modifying, reading, or taking the address) data members defined by the current class.

  • What Is Instantiated: displays classes that the current class instantiates by invoking its constructors.

  • What Is Destroyed: displays classes that the current class destroys by invoking it destructors.

  • What Is Used submenu : displays those classes used by the current class in the following contexts:

    • To Contain: highlights classes that the current class uses as either embedded or linked components.

    • As Friend: highlights classes that the current class uses as friend classes.

    • By Methods: highlights classes whose methods are used by the current class.

    • By Data Access: highlights classes whose data members are assigned, read, or have their address taken by the current class.

Additional queries on subjects, data members, and methods are accessible from the popup menus described in “C++ Member List” and “C++ Relation List”.

Preference Menu

The Preference menu allows you to control how the class information is displayed in the window.

The following selections are available:

  • Relation Display submenu: allows you to control how the class relations are displayed:

    • Declaration Order: displays related classes in the order of their declaration or the detection of their relation.

    • End To End Sort: displays a sorted list of related classes.

  • Member Display submenu : allows you to control how the class members are displayed:

    • Declaration Order: displays the members in order of their declaration.

    • End To End Sort: performs an end-to-end sort of the member display strings and displays the result.

    • Name Sort: performs a sort based on the name of the members and displays the result.

  • Member Alignment submenu: allows you to control how members line up:

    • Align Names: aligns the member names in the display. A radio button indicates if this feature is enabled or disabled.

    • Align Arglists: aligns the member function argument lists in the display. A radio button indicates if this feature is enabled or disabled.

  • Member Double Click submenu: lets you select which related source code is displayed in the Source View window when you double-click an item in the member list:

    • Show Definition: displays the source code where the item is defined.

    • Show Declaration: displays the source code where the item is declared.

    • Show Decl if no Defn: displays the code where the item is defined; if there is no definition, then the source code containing the declaration is displayed instead.

Browser View Popup Menus

The Browser View popup queries menus provide queries for currently selected items in the outline list areas. These menu are accessed by selecting an item and then holding down the right mouse button. Figure 9-7, shows all of the popup menus available in the Browser View window.

This section describes the following menus:

Many of the same queries in the class popup menus appear in more than one menu. To eliminate this redundancy, each query is described once and presented in a single list rather than by menu.

Figure 9-7. Queries Popup Menus in the Browser View Window

Queries Popup Menus in the 
Browser View Window

Data Members Popup Menu

The data members popup menu performs the following queries on data members selected in the member display list:

  • What Modifies: highlights all methods and classes in which the selected data member is assigned a value.

  • What Reads: highlights all methods and classes in which the selected data member is read.

  • What Accesses: highlights all classes where the selected data member is assigned a value, read, or its address is taken.

  • What Defines: highlights the class that defines the selected data member.

  • Show Source Where Defined: displays the source code where the data is defined in a Source View window.

Methods Popup Menu

The Methods popup menu lets you perform the following queries on methods:

  • What Uses: highlights all methods and classes that use the currently selected method.

  • What Is Used submenu: highlights what is used by the currently selected method. Contains the following menu items:

    • All (method and data access): highlights all data members, methods, and classes that the currently selected method uses.

    • Method Calls: highlights all methods called by the currently selected method.

    • Data Access: highlights all data members that have been assigned, read, or had their address taken by the currently selected method.

    • Data Modification: highlights all data members assigned by the currently selected method.

    • Data Read: highlights all data members read by the currently selected method.

  • Call Graph submenu: the Call Graph submenu contains the following menu options:

    • Add: adds the currently selected method and its calling structure to the Call Graph window, if one is open. If not, Add opens a Call Graph window before adding the method.

    • Replace: replaces all methods in the display with the selected method and its calling structure in the Call Graph window.

    • Remove: removes the currently selected method and its calling structure from the Call Graph window.

  • What Declares: highlights the class that declares the currently selected method.

  • What Currently Defines: highlights the class that provides the current definition for the method.

  • What Else Defines: highlights all classes that define the currently selected method.

  • What Overloads: highlights all methods and classes that overload the currently selected method.

Class Popup Menus

This section describes the popup menus available in the related class list display. (The queries menu that displays when you select <-This is not shown here because it is exactly the same as the main Queries menu shown in “Queries Menu”.)

Many of the items in the class popup menus are common to more than one menu. To eliminate the redundancy of describing them in each menu, this section presents all the queries in a single list in alphabetical order. The menus they belong to are shown in parentheses. The following selections are available on more than one menu:

  • New Browser View (all menus except Friend Functions): opens a new Browser View window displaying the selected class.

  • Show Source (all menus): opens a Source View window on a file containing the declaration of the selected item. The first line of the declaration is highlighted in the source.

  • What Destroys (Uses and Used By): highlights all members of the current class that destroy the selected class.

  • What Instantiates (Uses and Used By): highlights all members of the current class that instantiate the selected class.

  • What Is Declared (Base Classes ): highlights all methods declared by the selected base class.

  • What Is Defined (Base Classes ): highlights all members defined by the selected base class.

  • What Is Overloaded (Derived Classes): highlights all members of the current class that are overloaded by the selected class.

  • What Is Overridden (Base Classes): highlights all the methods of the selected base class that are overridden by the current class.

  • What Is Overridden (Derived Classes): highlights all the methods of the current class that are overridden by the selected derived class.

  • What Is Used (Friends): highlights all members of the current class that the selected friend class uses.

  • What Is Used submenu ( Derived Classes and Used By): contains the following queries:

    • by Accessing Any Member: highlights all members of the current class that the selected class uses.

    • by Calling Methods: highlights all methods of the current class that the selected class uses.

    • by Accessing Data Members: highlights all data members of the current class that the selected class modifies, reads, or takes the address of.

    • by Modifying Data Members: highlights all data members of the current class to which the selected class assigns a value.

    • by Reading Data Members: highlights all data members of the current class from which the selected class reads a value.

  • What It Uses (Friend Functions ): highlights all members of the current class that the selected friend function uses.

  • What Uses (Friend of ): highlights all members of the current class that use the friend class.

  • What Uses submenu ( Uses): contains the following queries:

    • by Accessing Any Member: highlights all members of the current class that use the selected class.

    • by Calling Methods: highlights all methods of the current class that use the methods of the selected class.

    • by Accessing Data: highlights all data members of the current class that modify, read, or take the address of data members of the selected class.

    • by Modifying Data: highlights all data members of the current class that assign a value to data members of the selected class.

    • by Reading Data: highlights all data members of the current class that read a value from data members of the selected class.

Graph Views Window

The Browser provides a graphical view for showing relationships between classes in the fileset. It depicts classes as nodes and relationships as arcs. The Graph Views window shows the following types of class relationships:

  • Inheritance

  • Containment

  • Interaction

  • Friends

You can display graphical views by selecting any of the following items from the Views menu of the Browser View window:

  • Show Inheritance Graph

  • Show Containment Graph

  • Show Interaction Graph

  • Show Friends Graph

Once the Graph Views window is displayed, you can switch to any of the other relationships by using the Relationship menu at the bottom right of the Graph Views window.

Mouse Manipulations

Double-clicking any subject in the Graph Views window causes it to become the new current subject in both the Browser View and Graph Views windows.

Graph Views Admin Menu

The Graph Views Admin selections control which classes included in the current fileset are displayed in the Graph Views window. The Admin menu has the following selections:

  • Save Graph: allows you to save the graph to a file. This selection brings up a file selection dialog. When you select a file and click OK, you save the graph as a PostScript file with the name specified in the Selection field.

  • Close: closes the Graph Views window.

Graph Views Window Views Menu

The Graph View menu contains options that allow you to various types of classes.

  • Show All: displays all classes included in the fileset as nodes, and their relations as arcs, as chosen from the relationship option menu.

  • Show All Related: displays only those classes included in the chain of relations, which includes the current class.

  • Show Butterfly: displays only those classes that are the immediate relatives (for example, parents and children for an inheritance relation of the current class).

Call Graph Window

The Call Graph window shows all calls made from selected methods in the member list, including calls made from its target methods. You can invoke it by any of the following methods:

  • Select Call Graph from the Views menu in Browser View .

  • Select a method in the member list, displaying the Methods popup menu, and selecting Call Graph:Add. This displays the Call Graph window the first time and adds new methods to the graph each time you select Call Graph:Add.

Figure 9-8 illustrates the second method for displaying Call Graph. In this example, the user has selected the initialize method in the Browser window and then selected CallGraph:Add from the Methods popup menu. The initialize method now appears in the Call Graph window with the methods that it calls.

Figure 9-8. Displaying a Selected Method in Call Graph

Displaying a Selected Method in Call
Graph

Using the Call Graph Window

You can add, replace, or remove methods in the Call Graph window by choosing from the Call Graph submenu in the Methods popup menu in the Browser View member list (see Figure 9-8), as follows:

  • Add: adds the currently selected method and its calling structure to the Call Graph window, if one is open. If not, Add opens a Call Graph window and then adds the method.

  • Replace: replaces all methods in the display with the selected method and its calling structure in the Call Graph window.

  • Remove: removes the currently selected method and its calling structure from the Call Graph window.

The action you request is displayed in the message area in Browser View window. In the Call Graph window, there is also a message area that identifies the method and its arguments.

In the Call Graph window, double-clicking any method node opens a Source View window that displays the code defining the method. The definition is highlighted in the source.

For information on manipulating graphs, the ProDev WorkShop: Overview.

Call Graph Admin Menu

The Call Graph window's Admin menu contains the following selections:

  • Show Arglist toggle: lets you display or hide the argument list for each method, as shown in Figure 9-8.

  • Clear: removes all methods from the Call Graph window.

  • Save Graph: displays a file selection dialog for saving the graph to a PostScript file.

  • Close: closes the Call Graph window.