Show: Object Pascal C++
Display Preferences

C++ Class Explorer Overview

From Appmethod Topics
Jump to: navigation, search

Go Up to C++ Class Explorer Topics

View > C++ Class Explorer


The C++ Class Explorer window has three panes, shown in the screenshot:

  1. Type List: A tree view representing data types in the project. You use the Type List as your tool for interacting with the Class Explorer.
  2. Source/References/Graph Window: A read-only preview window, focused on the declaration of the item selected in the Type List
  3. Member View: A close-up, expanded view of the item selected in the Type List

The screenshot shows the C++ Class Explorer with the Graph pane open, displaying a graphical representation of the inheritance hierarchy among all the types currently selected in the Type List (the left-hand pane).

When you open the C++ Class Explorer, the following happens:

  1. Parsing: The C++ Class Explorer parses all the unit files registered in the project. When you close and then reopen the Class Explorer, it parses all files that were not successfully compiled before (perhaps because of errors) and files that have changed since the last successful compilation. The information obtained is used to order the nodes (namespaces, units, classes, interfaces, types) in the Type List tree.
  2. Compiling: The C++ Class Explorer compiles any file that has changed since you last viewed it in the C++ Class Explorer.
  3. Class Explorer Window Opens: The C++ Class Explorer has three panes that are focused on different aspects of the same item:
    • The Type List pane shows a great deal of information about the data types in your project, listing all the members that are declared in classes and interfaces. By default, classes, structs, and interfaces are the only elements displayed.
    • The Member View expands any single item that you click in the Type List and displays it in more detail.
    • At the same time, the Source tab of the Source/References/Graph Window displays the declaration of that item in read-only mode.

The C++ Class Explorer automatically generates reference information, such as when each symbol is first defined and when it is subsequently used. This reference information enables the context-menu commands and toolbar buttons Go to Definition and Go to Declaration on the C++ Class Explorer Window.

Automating the Creation of Fields, Methods, and Properties

The C++ Class Explorer automates the creation of fields, methods, and properties by providing the following toolbar buttons and context menu commands:

These context menu commands are enabled only when the selected class or interface is in the header of a managed unit. The Go to declaration and Go to definition commands, on the other hand, are not restricted to types in a managed unit.

When you use one of these commands, the declaration for the field, method, or property is added to the .h file, and a code stub is created in user declarations in the .cpp file.

After you execute any of these Add commands, all sources are recompiled that depend on the modified source or header. Similarly, when you save a file, all sources are recompiled that depend on that file. Similarly, if the C++ Class Explorer is open while you make changes to project source, the Explorer view is refreshed when you reactivate the C++ Class Explorer Window.

Controlling the Display and Grouping of Classes and Interfaces

On the Type List, you can use toolbar icons and context menu commands to group elements in the tree structure, and to include/exclude specific elements, as follows:

  • Group elements in the Type List using the Group By commands, as follows:
    • Group by Namespace GroupTypesByNamespace.bmp
    • Group by File GroupTypesByFiles.bmp
    • Group by display groups (ClExplCustomGroup.bmp), such as:
      • $(PROJECT) - elements defined in your local project
      • VCL - elements defined in the Visual Component Library (VCL)
      • RTL - elements defined in the C++ runtime library
      • ATL - elements defined in the Active Template Library
      • STL - elements defined in the Dinkumware Standard C++ Library
      • Boost - elements defined in the Boost Libraries
      • Other - elements defined in directories that are not part of any defined group
  • Include Typedefs (ClExplTypedef.bmp) and/or Enumerations (ClExplEnum.bmp) in the view, using the Show toolbar buttons or context menu commands

Defining Your Own Custom Groups ClExplCreateGroup.bmp

On the Type List, the Configure Custom Groups toolbar button ClExplCreateGroup.bmp opens the Explorer File Groups dialog box, which allows you to create custom groups, and to enable/disable groups (your custom groups and the pre-existing ones listed above). When you disable a group, the contents of the disabled group are temporarily displayed in the group named Other. When you enable a disabled group, the group is restored in the Type List.

For more information about toolbar icons and context menu commands on the Type List, see C++ Class Explorer Window.

Specifying the Elements that are Displayed as Interfaces

By default, the Class Explorer considers an interface to be a class that contains no fields, only pure virtual methods, and derives from IUnknown. Thus, by default, the interface icon (ClExplInterface.bmp) is used for only these sorts of classes.

On the Class Explorer (C++) dialog box, you can specify that the Interface icon (ClExplInterface.bmp), rather than the Class icon (ClExplClassNum16.bmp), is to be used to represent the first or both of the following:

  • Classes that have only pure abstract functions
  • Classes that derive from IUnknown

Saving Your View Settings

You can save the view settings you have made, and your saved settings will be used the next time you return to the C++ Class Explorer. Your view settings include every value you have set using either of the following:

  • Toolbar buttons (such as Show enumerations in type list)
  • Class Explorer Properties dialog box, invoked from the context menu, or Tools > Options > C++ Options > Class Explorer

The current settings on the dialog box are saved (along with your other custom settings, except for custom groups) every time you click OK on either the Class Explorer or Class Explorer Properties dialog box. The view settings are specific to the Class Explorer, not the project, so you do not need to save your project in order to save your view settings.

If you click Cancel on the dialog box, your view settings are not saved, and the next time you open the C++ Class Explorer, all the view settings are their original default values.

For instructions, see Saving View Settings on the C++ Class Explorer.

See Also

Related Procedures

Personal tools
In other languages