Transformations
Transformation description (XML file)
The configuration file describes (in XML) the transformation of the template files into the project folder. In the normal case these will be .cpp / .h and possibly project files; however, all types of files can be handled.
The root node is a <ProjectFileGeneratorConfig> element. The useProjectInterface="true" attribute can be set directly at this node. It sets the processing procedure in the Visual Studio mode to generate projects (as opposed to TC-C++ modules).
Several <FileDescription> elements, each of which describes the transformation of a file, follow here. After these elements there is a possibility to define symbols that are available for the transformation in a <Symbols> element.
Transformation of the template files
A <FileDescription> element is structured as follows:
<FileDescription openFile="true">
<SourceFile>FileInTemplatesDirectory.cpp</SourceFile>
<TargetFile>[!output SYMBOLNAME].cpp</TargetFile>
<Filter>Source Files</Filter>
</FileDescription>
- The source file from the templates directory is specified as the <SourceFile>.
- The destination file in the Project directory is specified as the <TargetFile>. A symbol is normally used by means of the [!output...] command.
- The attribute "copyOnly" can be used to specify whether the file should be transformed, i.e. whether the transformations described in the source file are executed. Otherwise the file is merely copied.
- The "openFile" attribute can be used to specify whether the file is to be opened after creation of the project in Visual Studio.
- Filter: a filter is created in the project.
To do this the useProjectInterface="true" attribute must be set at the <ProjectFileGeneratorConfig>.
Transformation instructions
Commands that describe the transformations themselves are used in the template files.
The following commands are available:
[!output SYMBOLNAME]
This command replaces the command by the value of the symbol. A number of predefined symbols are available.[!if SYMBOLNAME], [!else]
and[!endif]
describe a possibility to integrate corresponding text only in certain situations during the transformation.
Symbol names
Symbol names can be provided for the transformation instructions in 3 ways.
These are used by the commands described above in order to carry out replacements.
- A number of predefined symbols directly in the configuration file:
A list of <Symbols> is provided in the XML file. Symbols can be defined here:<Symbols>
<Symbol>
<Name>CustomerSymbol</Name>
<Value>CustomerString</Value>
</Symbol>
</Symbols> - The generated destination file names can be provided by adding the "symbolName" attribute:
<TargetFile symbolName="CustomerFileName">[!output SYMBOLNAME].txt</TargetFile>
- Important symbols are provided by the system itself
Symbol Name (Projects) | Description |
PROJECT_NAME | The project name from the Visual Studio dialog. |
PROJECT_NAME_UPPERCASE | The project name in upper case letters. |
WIN32_WINNT | 0x0400 |
DRVID | Driver ID in the format: 0x03010000 |
PLATFORM_TOOLSET | Toolset version, e.g. v100 |
PLATFORM_TOOLSET_ELEMENT | Toolset version as an XML element, e.g. <PlatformToolset>v100</PlatformToolset> |
NEW_GUID_REGISTRY_FORMAT | Creates a new GUID in the format: |
Symbol Name (Classes) | Description |
PROJECT_NAME | The project name from the Visual Studio dialog. |
HEADER_FILE_NAME | Entered by the user in the wizard dialog. |
SOURCE_FILE_NAME | Entered by the user in the wizard dialog. |
CLASS_NAME | Entered by the user in the wizard dialog. |
CLASS_SHORT_NAME | Entered by the user in the wizard dialog. |
CLASS_ID | A new GUID created by the wizard. |
GROUP_NAME | C++ |
TMC_FILE_NAME | Used to identify the TMC file. |
NEW_GUID_REGISTRY_FORMAT | Creates a new GUID in the format: |