This chapter contains the following sections:
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.
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 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.
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++ 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.
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.
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.
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.
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.
Member List Contents
Relations List Contents
BASE CLASSES (including the current class)/DERIVED CLASSES/USES/ USED BY/FRIEND FUNCTIONS/ FRIENDS/FRIEND OF
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.
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.
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-> .
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
The following access categories are available:
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
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”.
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.
This notation refers to the class in the Current Class field.
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.
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)
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.
DERIVED CLASSES first_child_of_This child_of_first_child_class second_child_of_This child_of_second_child_class
The following sections describe the menus, found in the Browser View window's menu bar (see Figure 9-4).
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.
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.
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.
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 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.
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 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.
The following selections are available:
Member Alignment submenu: allows you to control how members line up:
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.
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.
The Methods popup menu lets you perform the following queries on methods:
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:
by Reading Data: highlights all data members of the current class that read a value from data members of the selected class.
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:
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.
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.
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:
The Graph View menu contains options that allow you to various types of classes.
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.
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:
For information on manipulating graphs, the ProDev WorkShop: Overview.
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.
Close: closes the Call Graph window.