# Chapter 10. El navegador de clases

# 10.1. The Classviewer

The KDevelop Classviewer is one of the most useful and important tools that the IDE provides a developer for managing his project sources. When a project is loaded, a class parser reads all project sources for functions, classes etc., then displays the results in the CV treeview. This chapter shows you how to use the Classviewer and the provided functionality and how it can improve your work.

Classes and their methods can also be accessed by the browser toolbar. There, the left combo selects the class; the right lets you choose the methods of the selected class. When you select a method, the classbrowser will automatically bring you to the implementation file and sets the cursor to the method. Finally, the class-assistant button on the right of the method combo will bring you to the declaration of the method on a click; on another click to the definition. The delayed popup menu, displayed by the down-arrow on the button, offers additional functionality that is also available in the classviewer's context menus, such as:

- Goto Declaration: browses to the declaration of the method

- Goto Definition: browses to the definition of the method

- Goto Class Declaration: browses to the class declaration

- New Class : opens the New Class dialog to construct a new class

- Add Method: adds a method to the selected class

- Add Attribute: adds an attribute to the selected class

## 10.1.1. Available Objects

By available objects, we describe a term that means that C++ code can be seen as a collection of objects- classes , their members, global functions and the like. The classtree displays these objects logically and orders them by character, so they are easy to locate in the tree as well by their according icon. Therefore the classtree contains a "Classes" and a "Globals" folder. Thereby the "Classes" folder generally contains the project's classes ; if your project contains subfolders to manage your sourcefiles, these are also displayed by their original folder name and contain all classes that are stored in the files located in the subfolder.

Further, when popping up a class, the classtree displays the class contents by separating methods and attributes . As these can have attributes as well like public, private and protected, these are displayed by modified icons as well. You see that a class displayed in the Class Browser contains all the objects that are present in the class declaration .

Now, classes are a very common thing when programming in C++ and will contain most of the code. But applications also contain objects that have a "Global" appearance to the program. These would be structs, functions etc. Especially the `main()` function appears in every application and you need to modify it in one or the other way sometimes. To access these objects, the Classviewer provides the "Globals" folder, containing subfolders for the following object types:

- Structs

- Functions

- Variables

As the icons displaying these items are similar to those used in the class-viewer, their meaning is easy to guess and to remember by the programmer.

Finally, it can be stated that the classviewer displays your project graphically by their objects related to their appearance in the code. In the following section you will learn how to use the classviewer and it's tools in conjunction with your code.

## 10.1.2. Browsing Object Declarations and Implementations

The Classviewer's best strength is providing a fast and good access to his code by the code's contents independent of the location within files. Therefore, selections by a mouse click will result in the following actions:

- On a classname: Switches to the class declaration

- On a class method: Switches to the method implementation

- On a class attribute: Switches to the attribute's declaration in the class declaration

- On a struct: Switches to the struct's declaration

- On a global function: Switches to the function's implementation

Now, this provides you the most needed access towards code objects. Apparently, it may be needed to change a method's header, resulting that you have to change it's declaration in the class as well as the implementation . The classviewer supports this by providing right-button context menus over items. On a method or function, this means that you can select where to go:

- Go to definition: Switches to the implementation - this is the default for a left click as described above

- Go to declaration : Switches to the declaration of the method or function.

By this behavior, the Class Browser offers you access to every place you have to go for coding your C++ application.

The following sections give you a description of the other tools that the Class Browser offers- you will find them very useful when working with large projects as they enhance working object-orientated on C++ programs.