Click here to Skip to main content
13,549,853 members
Click here to Skip to main content
Add your own
alternative version


70 bookmarked
Posted 15 Feb 2007

VisualClassBuilder - Free Code Generation Tool

, 15 Feb 2007
Rate this:
Please Sign up or sign in to vote.
A free C++ code generator tool with source code.
Sample image


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


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

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.

You may also be interested in...

Comments and Discussions

QuestionVC 6.0 (Qt) Pin
cnvsudheer4-Nov-09 21:52
membercnvsudheer4-Nov-09 21:52 
Generalclarification needed Pin
raghull27-Feb-07 20:32
memberraghull27-Feb-07 20:32 
Questionto clarify the doubt Pin
Member #386915427-Feb-07 18:26
memberMember #386915427-Feb-07 18:26 
AnswerRe: to clarify the doubt Pin
darkoman3-Mar-07 2:51
memberdarkoman3-Mar-07 2:51 
GeneralVery Useful :) Pin
Programm3r22-Feb-07 3:26
memberProgramm3r22-Feb-07 3:26 
Generallink error Pin
bruno leclerc18-Feb-07 23:04
memberbruno leclerc18-Feb-07 23:04 
GeneralRe: link error Pin
darkoman18-Feb-07 23:24
memberdarkoman18-Feb-07 23:24 
GeneralRe: link error Pin
bruno leclerc19-Feb-07 2:52
memberbruno leclerc19-Feb-07 2:52 
GeneralUnicode builds Pin
NGS 54967217-Feb-07 10:08
memberNGS 54967217-Feb-07 10:08 
GeneralSuggestion Pin
Hans Dietrich16-Feb-07 1:35
mvpHans Dietrich16-Feb-07 1:35 
GeneralRe: Suggestion Pin
darkoman16-Feb-07 3:04
memberdarkoman16-Feb-07 3:04 
GeneralRe: Suggestion Pin
J. Dunlap16-Feb-07 4:29
editorJ. Dunlap16-Feb-07 4:29 
GeneralTypo mistake Pin
Priyank Bolia16-Feb-07 0:18
memberPriyank Bolia16-Feb-07 0:18 
AnswerRe: Typo mistake Pin
darkoman16-Feb-07 3:08
memberdarkoman16-Feb-07 3:08 
NewsRead this before start Pin
darkoman15-Feb-07 22:27
memberdarkoman15-Feb-07 22:27 
GeneralRe: Read this before start Pin
MikeTheDwarf4-Oct-07 4:50
memberMikeTheDwarf4-Oct-07 4:50 

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

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

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