Click here to Skip to main content
Click here to Skip to main content

VisualClassBuilder - Free Code Generation Tool

By , 15 Feb 2007
Rate this:
Please Sign up or sign in to vote.
Sample image

Introduction

This article is about a free C++ code generator tool. The code generator does what its name says: it generates source code based on an object model (like a UML class diagram), which represents the logical structure of your classes. It also helps you develop your applications faster and change things inside their structure, using a graphical user interface.

Using the Application

This submission is a tool, so the source code will not be discussed here. Instead, I will discuss how to use the tool.

The code generator has a graphical user interface by which you can build and manipulate simple UML class definitions on the screen. To insert a new class, select the Insert->Class... option from the main menu. The new class object will appear on the screen. You can place it wherever you want by dragging it. Similarly, to insert a new struct, select Insert->Struct... from the main menu and the new struct object will appear on the screen.

To change a class's settings, double click on the class object. The following dialog box will appear:

ClassOptionsDialog - General Page

Here, you can change the names of the class and its header and implementation files. You can also add author information and a short class description.

On the next page you can add member variables and properties to your class:

ClassOptionsDialog - Class Members Page

The settings on this tab page will be easily recognizable by C++ developers, so I will not waste space in this article by explaining them all in detail. The interesting option here is the Declare as property checkbox which, when enabled, will cause a pair of accessor methods (GetPropertyName() and SetPropertyName()) to be added to read/write values directly to the member variable. You have to specify a name for the property before you add it.

The next tab page is for class methods:

ClassOptionsDialog - Class Methods Page

Just as you can add member variables, you can also add class methods by declaring them on this tab page. A default method body will be generated in the class implementation file.

There are also additional class settings that you can change:

ClassOptionsDialog - Other Settings Page

Here you can add inheritance parents to this class (the classes that current class is derived from), include MFC precompiled headers, and turn on/off comment generation. Comments are important since the code can turn into a real mess later, and you will not be able to find what you need if you don't add explanations to what you create.

Working with structs is simpler than working with classes so I will not take the time to explain it.

Using the Results

After you build your class diagram you can select Build->Generate files option from the main menu and VisualClassBuilder will generate the required C++ files in the default output directory for you. From there, you can add them to your Visual Studio (or other) project.

Also, you can print the class diagram you have built by selecting File->Print from the main menu. To save your work, use File->Save. To load a saved project, use File->Open.

Points of Interest

I needed a tool like this one to speed up my work on different projects that use a similar class structure, so that I could avoid having to write the same source code multiple times.

VisualClassBuilder v1.0 features:

  • Class generation
  • Struct generation
  • Class inheritance support
  • MFC precompiled header support
  • Comments generation
  • Project saving/loading
  • Class diagram printing

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

darkoman
Software Developer (Senior) Elektromehanika d.o.o. Nis
Serbia Serbia
He has a master degree in Computer Science at Faculty of Electronics in Nis (Serbia), and works as a C++/C# application developer for Windows platforms since 2001. He likes traveling, reading and meeting new people and cultures.

Comments and Discussions

 
QuestionVC 6.0 (Qt) Pinmembercnvsudheer4-Nov-09 21:52 
Generalclarification needed Pinmemberraghull27-Feb-07 20:32 
Questionto clarify the doubt PinmemberMember #386915427-Feb-07 18:26 
AnswerRe: to clarify the doubt Pinmemberdarkoman3-Mar-07 2:51 
GeneralVery Useful :) PinmemberProgramm3r22-Feb-07 3:26 
Generallink error Pinmemberbruno leclerc18-Feb-07 23:04 
GeneralRe: link error Pinmemberdarkoman18-Feb-07 23:24 
GeneralRe: link error Pinmemberbruno leclerc19-Feb-07 2:52 
GeneralUnicode builds PinmemberNGS 54967217-Feb-07 10:08 
GeneralSuggestion PinmvpHans Dietrich16-Feb-07 1:35 
GeneralRe: Suggestion Pinmemberdarkoman16-Feb-07 3:04 
GeneralRe: Suggestion PineditorJ. Dunlap16-Feb-07 4:29 
GeneralTypo mistake PinmemberPriyank Bolia16-Feb-07 0:18 
AnswerRe: Typo mistake Pinmemberdarkoman16-Feb-07 3:08 
NewsRead this before start Pinmemberdarkoman15-Feb-07 22:27 
GeneralRe: Read this before start PinmemberMikeTheDwarf4-Oct-07 4:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140421.2 | Last Updated 16 Feb 2007
Article Copyright 2007 by darkoman
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid