From: Subject: Class Generator Manual Date: Mon, 8 Jun 2009 15:28:45 +0100 MIME-Version: 1.0 Content-Type: multipart/related; type="text/html"; boundary="----=_NextPart_000_0000_01C9E84D.CFA56A60" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C9E84D.CFA56A60 Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Content-Location: file://D:\Dev\Win32\ClassGen\HelpFile\ClassGen.html Class Generator Manual

Class Generator v2.0

Introduction

Class Generator is a tool for creating the skeleton of a new class. = It does=20 this by transforming template files into the real class files by = performing text=20 substitutions denoted by special strings, e.g. ${Class}. The tool comes = with the=20 templates that I use for generating C++ classes, although it is not C++ = specific=20 and there are templates for generating non-class based files.

There are two main concepts - Templates and Components. Templates are = the=20 files that are transformed to create the final skeleton. The tool also = supports=20 the concept of Components which are a collection of common settings that = make it=20 easier to generate a class for a specific library or application. The = classes of=20 a Component generally live in the same folder and are defined in the = same=20 namespace.

Configuration is done manually by editing the Templates.ini file. = This file,=20 which must reside in the same folder as the executable, tells Class = Generator=20 what templates and components are available and also some other common = settings.=20

Using Class Generator

It is easy to use Class Generator, the difficulty lies in the = configuration=20 which is manual. However, once you have configured it, just fire up the = tool and=20 you'll see a dialog like the one below. Just select the component from = the=20 dropdown, which will default the folder and namespace, select the class = type=20 from the template and enter the class name. Then press "Generate" to = create the=20 source files.

Template Configuration

The Templates part defines the types of skeleton classes that can be=20 generated. The actual [Templates] section lists the template names, = while the=20 template definitions are then provided separately afterwards, e.g. =

[Templates]
Path=3D.
Count=3D2
Template[0]=3DGeneric
Template[1]=3DInterface

The 'Path' entry determines where the actual template files live. By = default=20 they are installed alongside the executable, but you could place them on = a=20 network share and change the Path accordingly.

Each template definition lives in its own section, which is created = by=20 appending the word 'Template' to the name. The section has 4 entries, = e.g.

[Generic Template]
Description=3DFull header & source file class declaration
Class=3DTrue
HPP=3DGeneric.hpp
CPP=3DGeneric.cpp

The 'Description' entry provides a useful hint and is displayed under = the=20 list of templates that are available. The 'Class' entry is a flag that = signals=20 if the definition is for a class or not. In reality this just disables = the Class=20 Name field on the dialog. The final two entries, 'HPP' and 'CPP', define = the=20 files which contain the outline. Either of these two entries can be left = blank=20 (e.g. see the Interface template) where you only need one or other file. =

Component Configuration

The Components section allows you to define common projects, such as=20 libraries or applications, where you are likely to create many classes. = This=20 means that just by selecting the component in the UI you will = automatically=20 select the directory where the class will be created and apply the right = namespace. The [Components] section uses the same format as the = [Templates] one=20 above, in that you specify a list of Component names and then provide = the=20 definitions in a separate section later, e.g.

[Components]
Count=3D2
Component[0]=3DApplication
Component[1]=3DLibrary

Each component definition lives in its own section, which is created = by=20 appending the word 'Component' to the name. The section has 5 entries, = e.g.

[Library Component]
Description=3DThe library
Include=3DStdAfx.h
Comment=3DThe Library
Namespace=3Dlib
Folder=3DC:\Library

The 'Description' entry provides a useful hint and is displayed under = the=20 list of components that are available in the UI. The 'Folder' is the = default=20 location where new classes should be generated and can be overridden in = the UI.=20 The 'Include', 'Comment' and 'Namespace' entries are parameters that can = be=20 applied to the template file and are explained in detail further down. =

Other Configuration Options

There are a few other miscellaneous settings that can be configured, = e.g.=20

[General]
HppExt=3D.hpp
CppExt=3D.cpp
Author=3DThe Author

The 'HppExt' and 'CppExt' entries allow you to choose what the = default file=20 extension will be for the header and source filenames when they are = generated in=20 the UI - I use .hpp and .cpp, but you may prefer .h and .cxx. The = 'Author' entry=20 is mapped directly onto the ${Author} parameter explained below.

Template File Placeholders

The template files consist of normal text with placeholders used to = define=20 where certain strings should be applied. These placeholders are denoted = by a=20 string enclosed inside a "${" and "}", where the string is the name of a = parameter. Every parameter name can be specified in Mixed case, all = UPPER case=20 or all lower case to have the value applied in that same case. For = example, if=20 the 'Author' parameter was set to "Chris Oldwood", these would be the=20 substitutions,

${Author}=3DChris Oldwood
${AUTHOR}=3DCHRIS OLDWOOD
${author}=3Dchris oldwood

The following table lists the full set of placeholders, their meaning = and how=20 they can be configured,

Placeholder Description
${Author} The author of the class. This is configured in the [General] = section.=20 I use this with the "\author" Doxygen tag.
${Class} The name of the class. This can be entered through the UI for = any=20 template that has 'Class=3DTrue' configured.
${Comment} The comment for the component. This is configured in the [? = Component]=20 section. I used to use this in the file banner, but having both=20 ${Namespace} and ${Component} in the file now has made this use=20 redundant.
${Component} The name of the component. This is configured in the = [Components]=20 section and is how a component is chosen in the UI. I use the = upper case=20 version of this, ${COMPONENT}, as the prefix for all #include = guards to=20 avoid conflicts where the same class/file name may be used in = different=20 libraries.
${Ext} This gives you the extension of the file being created, without = the=20 leading period, e.g. for a source file it could be "cpp" and "hpp" = for a=20 header file.
${File.Ext} This is the complete filename of the file being = generated.
${File} This is just the title of the file being generated, i.e. no = extension.=20 I use the upper case version of this, ${FILE} along with ${EXT} to = create=20 the #include guard.
${Header} The filename of the header file that was generated. I use = this=20 in the source file to #include the class header.
${Include} The common #include file used with pre-compiled headers, e.g.=20 StdAfx.h. This is specified in the [? Component] = section.
${Namespace} The namespace that the class should reside in. This can be = defaulted=20 in the [? Component] section of the configuration file and then = overridden=20 in the UI if required.

Example

The example below is taken from the 'Interface' template that is = provided=20 with Class Generator. The namespace used was 'Test' and the class name = was=20 'ITest'. The tool generated a single file called Test.hpp.

This is the template, =

////////////////////////////////////////////////////////////////=
////////////////
//! \file   ${File.Ext}
//! \author ${Author}

#ifndef ${COMPONENT}_${FILE}_${EXT}
#define ${COMPONENT}_${FILE}_${EXT}

namespace ${Namespace}
{

class ${Class}
{
protected:
	virtual ~${Class}() =3D 0 {};=20
};

}

#endif // ${COMPONENT}_${FILE}_${EXT}

And this is the code that was generated, =

////////////////////////////////////////////////////////////////=
////////////////
//! \file   ITest.hpp
//! \author Chris Oldwood

#ifndef APPLICATION_ITEST_HPP
#define APPLICATION_ITEST_HPP

namespace Test
{

class ITest
{
protected:
	virtual ~ITest() =3D 0 {};=20
};

}

#endif // APPLICATION_ITEST_HPP

License & Warranty

This application is freeware - you get what you pay for, nothing = more,=20 nothing less.

Source Code

The full source code (C++) is available from my web site listed = below.

Contact Details

The "About" dialog also contains my contact details. Please check the = web=20 site for updates.

Email: gort@cix.co.uk
Web: = www.cix.co.uk/~gort

Chris Oldwood
8th June 2009

------=_NextPart_000_0000_01C9E84D.CFA56A60 Content-Type: image/gif Content-Transfer-Encoding: base64 Content-Location: file:///D:/Dev/Win32/ClassGen/HelpFile/Main.gif R0lGODlhMwIfATMAACwAAAAAMwIfAaPU0Mj///8AAICAgIAAAABAQEAKJGr125UEBYUEBQWFhYX/ /wAA//+AAAAAAA8AAAAE/xDISau9OOvNu/9gKI5kaZ5oqq5s675wDBRAYN94ru987//AoHBILBqP yKRyyWw6n9CodEqlDmgBmXbL7Xq/4LB4TC57rzWAYM1uu9/wuHxOr9vv+Lx+z+/7/4CBgoOEhYaH iImGAGhZbQgCkJKRkQOQipiZmpucnZ6foKGio4mMWGqRCKqrqgqtDQqksrO0tba3uLmcQwW8a74C pmlrrKwKsK2qusvMzc7P0NF8WRxX1BtXvx3ZwY2oxQoJycVyNtLn6Onq6+x31xrWEgPz9PTyBdrV +N2nxKwJC8SNU/YLhwBzgHRgQtiuocOHEGe9yxCPUb16WbhdI0CAAsd7a/+EOUrFykFABMdcoSzo hmEfl5lgRpxJs6bNl9t6ydsxIOO+dx8BBDUV0ps/BAmSIlWq8hjLNggNFox6A2oAOFJzsMl69erB ql+pUj14s6zZs+0mYqjY00JbjRU4DiXKbxhJgAKTCmz1dKtXv1+tYv0LOPDYw2ABM0QsE63jx5Al 5qTWtsLbnxbm0hX5TZXeVZ9X9X2qlStMsWGrMlZNuPRfxJFjy57tSe0Ftmov55sgt+MEbpyPIi0W +tLprl7FJk8cmOVx54SbNze3eLl02tiza/dj261ORrl97hbqeyhwo3cZ7PWs1Hh06tYLj65+fTry lq+t0zccfbv//wBuxVv/b77dQ1l4dG1UIHkg1TXSUgxE2B574vjF2lTwKfeGQqndZ9+FFqKW2mgB lmjibAr2RgFbF9Ej3kE5FdVPJOIkoN5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