tags:

views:

454

answers:

3

Sup bros,

Is there anything out there for C++ which displays the class hierarchies as a tree on the left panel? I've been using VisualWorks Smalltalk for a while, and the way that classes are displayed, and methods broken out, makes it very easy to build a mental picture of what the class does. Sadly, I can't find anything similar for C++. Does Eclipse perhaps have such a mode?

Thanks, frapple_hok

A: 

Caveat emptor: I've never used this tool myself. (Though perhaps I'll start...)

From long experience I've learned that I can put "emacs" + anything into google and find it. (Literally anything! Some people have waayyy too much free time on their hands...)

In this case, "emacs class browser" turns up EBROWSE, which might be what you are looking for.

In terms of a "left panel", emacs supports splitting a single window up vertically (split-window-vertically) or horizontally (split-window-horizontally) however you like. Or using multiple windows if you prefer (make-frame-command).

In terms of more typical IDE features, emacs supports font-locking (colorizing), make integration (jump to error), gdb integration (debugging), language-based auto-indent, TAGS [etags] (jump to tag definition), diff'ing two files (or file against revision), checkin/checkout to/from source code revision systems, spell-checking, etc. (I'm sure other stackoverflow entries have highlighted emacs's many features. Or try slashdot. Definitely check out the "complete" function! (require 'completion) And perhaps "align-regexp" too!)

Mr.Ree
+1  A: 

Unfortunately C++ doesn't lend itself to this sort of class browser for two reasons:

  • There is no central repository or image with all of the active classes in it. The class definitions are spread around many files.

  • Class definitions and files live in a M:M relationship. Not all of a class is necessarily defined in a single file and one file can have code for more than one class.

On Linux, KDevelop, Eclipse and various others all have C++ support and a greater or lesser degree of support for the introspection that is possible on an arbitrary base of C++ source code.

You might also get some mileage from ctags, which analyses the source code files and identifies the definitions for types, classes, members etc. This can be used with any decent editor such as vim, emacs or many other editors and IDE's. From a source code editor that supports tags, you can place the cursor over a reference and jump to its definition. It's not quite as good as Inspect but you don't really have the concept of a running image. The closest you will get to that is a debugger such as DDD.

ConcernedOfTunbridgeWells
A: 

There are at least two options I'm aware of:

  1. OO Browser, whose entire purpose is to bring Smalltalk-style browsers to other languages. I do not know how well the project is maintained, but despite its rather lackluster appearance, it worked extremely well the last time I tried to use it (which would've been about three years ago).
  2. Code Browser, which is designed to provide generic ways to navigate through, and manage, complex code hierarchies. It provides many ways to view code, but one of them is indeed the Smalltalk browser model (e.g., take a look at this screen shot of the Code Browser editing itself)
Benjamin Pollack