Documentation

    Table of Content
    • CodePorting.Translator Product Family
      • CodePorting.Translator Cs2Cpp
        • Getting Started
          • Product Overview
          • Installation
          • Licensing
          • How to use CodePorting.Translator Cs2Cpp
            • How to Use Command line to translate and build Projects
            • How to Use GUI to translate and build Projects
        • Developer Guide
          • Translating Simple C# Projects
            • Translating Simple Console Application
            • Translating Simple Library
            • Translating Simple NUnit Test
          • Translating Dependent C# Projects
            • Translating Dependent Console Application
            • Translating Dependent Library
            • Translating Dependent NUnit Test
          • Qt support
          • Translating Complex C# Projects
            • How to Convert Complex C# Console Application to C++
            • How to Convert Complex C# Library to C++
            • How to Convert Complex C# NUnit Test to C++
          • What Converts to What
            • AbstractClasses
            • BreakStatements
            • ClassAutoProperties
            • ClassConstructors
            • ClassEvents
            • ClassFinalizers
            • ClassGenericMethods
            • ClassIndexers
            • ClassMethods
            • ClassProperties
            • ClassStaticConstructor
            • ClassStaticMethods
            • ClassStaticProperties
            • ClassVirtualMethods
            • ContinueStatements
            • Delegates
            • DoWhileStatements
            • Enums
            • EnumTypeCast
            • Exceptions
            • ExpectedException
            • ForeachStatements
            • ForeachStatementsStd
            • ForStatements
            • GenericClasses
            • GenericDelegates
            • GenericInterfaces
            • GenericStructs
            • IfStatements
            • LambdaExpressions
            • NestedClasses
            • ReturnStatements
            • SimpleClass
            • SimpleInterface
            • SimpleStruct
            • SimpleTest
            • StandardTypeCast
            • StaticClass
            • SwitchStatements
            • TestWithSetupMethods
            • ThrowStatements
            • TryCatchFinallyStatements
            • TryCatchStatements
            • TryFinallyStatements
            • VarExpressions
            • WhileStatements
          • CodePorting Translator Cs2Cpp Attributes
          • CodePorting Translator Cs2Cpp Configuration File
            • CodePorting.Translator Cs2Cpp Configuration File Structure
            • Attributes in Configuration file
            • Configuration file Nodes
            • Configuration file Options
          • Memory Management Model
            • Memory Management Model Description
            • Using aliasing constructor to create a smart pointer
          • Cmake Support
          • C++ code injection
          • C++ user-defined exception classes
          • Limitations and Bugs
            • Translator Limitations and Bugs
            • Library Limitations and Bugs
            • Cpp Code Injection
        • Release Notes
          • 2022
            • CodePorting.Translator Cs2Cpp 22.6
            • CodePorting.Native Cs2Cpp 22.5
            • CodePorting.Native Cs2Cpp 22.4
            • CodePorting.Native Cs2Cpp 22.3
            • CodePorting.Native Cs2Cpp 22.2
            • CodePorting.Native Cs2Cpp 22.1
          • 2021
            • CodePorting.Native Cs2Cpp 21.12
            • CodePorting.Native Cs2Cpp 21.11
            • CodePorting.Native Cs2Cpp 21.10.1
            • CodePorting.Native Cs2Cpp 21.10
            • CodePorting.Native Cs2Cpp 21.9
            • CodePorting.Native Cs2Cpp 21.8
            • CodePorting.Native Cs2Cpp 21.7
            • CodePorting.Native Cs2Cpp 21.6
            • CodePorting.Native Cs2Cpp 21.5
            • CodePorting.Native Cs2Cpp 21.4
            • CodePorting.Native Cs2Cpp 21.3
            • CodePorting.Native Cs2Cpp 21.2
            • CodePorting.Native Cs2Cpp 21.1
          • 2020
            • CodePorting.Native Cs2Cpp 20.12
            • CodePorting.Native Cs2Cpp 20.11
            • CodePorting.Native Cs2Cpp 20.10
            • CodePorting.Native Cs2Cpp 20.9
            • CodePorting.Native Cs2Cpp 20.8
            • CodePorting.Native Cs2Cpp 20.7
            • CodePorting.Native Cs2Cpp 20.6
            • CodePorting.Native Cs2Cpp 20.5
            • CodePorting.Native Cs2Cpp 20.4
            • CodePorting.Native Cs2Cpp 20.3
            • CodePorting.Native Cs2Cpp 20.2
            • CodePorting.Native Cs2Cpp 20.1
          • 2019
            • CodePorting.Native Cs2Cpp 19.1
            • CodePorting.Native Cs2Cpp 19.2
            • CodePorting.Native Cs2Cpp 19.3
            • CodePorting.Native Cs2Cpp 19.4
            • CodePorting.Native Cs2Cpp 19.4.1
            • CodePorting.Native Cs2Cpp 19.5
            • CodePorting.Native Cs2Cpp 19.6
            • CodePorting.Native Cs2Cpp 19.7
            • CodePorting.Native Cs2Cpp 19.8
            • CodePorting.Native Cs2Cpp 19.9
            • CodePorting.Native Cs2Cpp 19.10
            • CodePorting.Native Cs2Cpp 19.11
            • CodePorting.Native Cs2Cpp 19.12
          • 2018
            • CodePorting.Native Cs2Cpp 18.9
            • CodePorting.Native Cs2Cpp 18.9.1
            • CodePorting.Native Cs2Cpp 18.10
            • CodePorting.Native Cs2Cpp 18.11
            • CodePorting.Native Cs2Cpp 18.12
    1. Home
    2. CodePorting.Translator Product Family
    3. CodePorting.Translator Cs2Cpp
    4. Developer Guide
    5. CodePorting Translator Cs2Cpp Configuration File
    6. Configuration file Nodes

    Configuration file Nodes

    What's on this Page

      • csproj
      • outdir
      • embedded_proj
      • cppproj
      • opt
      • additional_source
        • copy
      • import
      • lib
        • tag
        • cmake_part_template
        • cmake_link_template
        • defines
        • includes
        • libdirs
        • class
        • enum
        • namespace
        • replace_user_types
      • files
        • exclude
        • include
        • only
      • cut_namespaces
      • typemap
        • class
      • includes
      • force_value_types
        • class
      • references
        • assembly
      • dont_wrap_params
        • class
        • method
      • disable_boxing
      • restricted_tokens
        • token
      • assembly_with_restricted_tokens
      • skip_definitions
      • implementation
      • nunit_categories
        • include
        • exclude
      • cmake_commands
      • cmake_files
        • file
      • enum_underlying_types
        • type
      • attribute
      • forced_include
        • class
      • documentation_comments_translation
        • cref_typemap
        • cref
        • summary_text_map
        • property
        • options
        • replacements
        • translate_code_from_comments
        • translate_code_from_comments_system_dlls
      • if
        • else
      • msbuild_global_properties
        • property
      • rename_files
        • file
      • allowed_heap_only_types
        • class
      • types_with_begin_and_end_methods
        • class
      • assembly_types
        • class
      • unity_build
        • excluded_files
      • external_include
      • events_with_custom_accessors
        • event

    This sectiolists all tags allowed in configuration file.

    csproj

    <csproj path="Path/ProjectName.csproj" cfg="Configuration" platform="Platform"/>

    Refernce to input project file.

    Attributes:

    AttributeMeaningMandatoryDefault value
    pathPath to project fileYes
    cfgConfiguration used when parsing source C# codeNoDebug
    platformPlatform to use specific settings for when parsing the projectNoDefault or first available platform as defined in input project file

    This attribute overrides path to project given to a translator application via command line.

    outdir

    <outdir path="Path"/>

    Reference to output directory.

    AttributeMeaningMandatoryDefault value
    pathPath to output directoryYes

    embedded_proj

    <embedded_proj path="path/to/project"/>

    Defines paths to embedded projects used in project being translated.

    AttributeMeaningMandatoryDefault value
    pathFull or relative path to embedded projectYes

    cppproj

    <cppproj name="ProjectName"/>

    Allows it to specify output project name.

    AttributeMeaningMandatoryDefault value
    nameOutput project nameYes

    opt

    <opt name="Name" value="Value"/>

    Translator option. See Configuration file options for details on what options are available.

    AttributeMeaningMandatoryDefault value
    nameOption nameYes
    valueOption valueYes
    Option-specific attributesSome options can require additional attributes to be specifiedDefined by optionDefined by option

    additional_source

    <additional_source>
        <copy dir="dir1"/>
        <copy dir="dir2"/>
    </additional_source>

    Directories to copy additional C++ sources from.

    AttributeMeaningMandatoryDefault value

    Only ‘copy’ subnodes are allowed inside ‘additional_source’ one.

    copy

    <copy dir="dir1"/>

    Single directory to copy additional C++ source files from.

    AttributeMeaningMandatoryDefault value
    dirPath to directory (absolute or relative to configuration file; can also be relative to translator directory if ‘use_porter_home_directory_while_resolving_path’ option is enabled)Yes

    import

    <import config="details.config"/>

    Imports configuration file as if all its contents were added into the current one. Imported configuration file must have valid structure (‘porter’ node in the root and so on).

    AttributeMeaningMandatoryDefault value
    configPath to configuration file (absolute or relative to current configuration file; can also be relative to translator directory if ‘use_porter_home_directory_while_resolving_path’ option is enabled)Yes

    libs, style

    <libs>
        <lib name="a">
            ...
        </lib>
    </libs>
    <style>
        <opt name="b" value="c"/>
        ...
    </style>

    Logical grouping. ‘libs’ element defines configuration file section which contains instructions on libraries attachment. ‘style’ element is meant to group style-related options.

    AttributeMeaningMandatoryDefault value

    Only ‘opt’ and ‘lib’ nodes are allowed inside both tags. Using ‘opt’ and ‘lib’ outside of ‘libs’ or ‘style’ is also allowed.

    lib

    <lib name="LibProject.Cpp">
        <tag path="path/path">Namespace::Namespace2::</tag>
        <cmake_part_template>
            find_botan()
        </cmake_part_template>
        <cmake_link_template>
            target_link_libraries(Project_name PUBLIC botan::botan LibProject::LibProject)
        </cmake_link_template>
        <defines>DEFINE1 DEFINE2;DEFINE3=VALUE</defines>
        <includes>path/to/dir1 path/to/dir2;path/to/dir3</includes>
        <libdirs>path/to/dir1 path/to/dir2;path/to/dir3</libdirs>
        <class name="LibProject::Class1" path="libproject/class1.h" shortptr="true"/>
        <enum name="LibProject::Enum1" path="libproject/enum1.h"/>
        <namespace name="LibProject::Namespace1" path="libproject/namespace1.h" shortptr="true"/>
        <replace_user_types>false</replace_user_types>
    </lib>

    Imports library to use against current project.

    AttributeMeaningMandatoryDefault value
    nameName of the imported project in C++Yes

    Meaning of allowed subnodes is explained below.

    tag

    <tag path="path/to/ns2/headers">Namespace::Namespace2::</tag>

    Sets up header lookup rule. When translator meets a name from namespace given, it generates includes based on path specified, following the below rules:

    • Each namespace inside tagged namespace is translated to a separate subdirectory;
    • Class name corresponds to header name;
    • Extension of file being included is .h;
    • Namespaces and classes names are converted to underscore-delimited format even if they originally follow e. g. camelCase.

    More specific rules (with innermore namespaces mentioned) override less specific ones. Explicit rules for individual types override tags.

    AttributeMeaningMandatoryDefault value
    Element contentsNamespace to add rule forYes
    pathBeginning of generated inclusion pathYes

    For example, the above example implements such rule that references to class called ‘Namespace::Namespace2::Namespace3::FooBarClass’ will generate the following include:

    #include "path/to/ns2/headers/namespace3/foo_bar_class.h"

    Tag syntax is useful when implementing library manually. When using translated library, use typemap configuration file inclusion instead.

    cmake_part_template

    <cmake_part_template>
        find_botan()
    </cmake_part_template>

    Cmake rules to allow for includes and other neccessary setups like 3rd party libraries lookup.

    AttributeMeaningMandatoryDefault value
    Element contentsBare cmake code to be used both for libraries and executablesNo

    cmake_link_template

    <cmake_link_template>
        target_link_libraries(Project_name PUBLIC botan::botan LibProject::LibProject)
    </cmake_link_template>

    Cmake rules to allow for linkable units (DLLs, EXEs)

    AttributeMeaningMandatoryDefault value
    Element contentsBare cmake code to be used for linkable items (executables, shared libraries)

    defines

    <defines>DEFINE1 DEFINE2;DEFINE3=VALUE</defines>

    Defines to be added to the project. Put library-related defines here rather than to global section of your configuration file as this make unnecessary define go once you exclude library-related file. Another benefit is keeping everything that relates to the library in a single place.

    AttributeMeaningMandatoryDefault value
    Element contentsSpace- and semicolon-separated list of defines with optional values

    includes

    <includes>path/to/dir1 path/to/dir2;path/to/dir3</includes>

    Paths to include directories, related to the library. Again, allows keeping everything that is related to the library in a single place.

    AttributeMeaningMandatoryDefault value
    Element contentsSpace- and semicolon-separated list of paths for cmake to use

    libdirs

    <libdirs>path/to/dir1 path/to/dir2;path/to/dir3</libdirs>

    Paths to library directories, related to the library.

    AttributeMeaningMandatoryDefault value
    Element contentsSpace- and semicolon-separated list of paths

    class

    <class name="LibProject::Class1" path="libproject/class1.h" shortptr="true"/>

    Sets class-specific header path, useful for classes not covered by any tag rules.

    AttributeMeaningMandatoryDefault value
    nameClass name with namespaceYes
    pathFull header path to be inserted into ‘include’ directiveYes
    shortptrWhether class provides ClassNamePtr-formed alias for SharedPtr<ClassName>, must be ‘true’ or ‘false’Nofalse

    enum

    <enum name="LibProject::Enum1" path="libproject/enum1.h"/>

    Sets enum-specific header path, useful for enums not covered by any tag rules.

    AttributeMeaningMandatoryDefault value
    nameEnum name with namespaceYes
    pathFull header path to be inserted into ‘include’ directiveYes

    namespace

    <namespace name="LibProject::Namespace1" path="libproject/namespace1.h" shortptr="true"/>

    Sets namespace-specific header path, useful for enums not covered by any tag rules.

    AttributeMeaningMandatoryDefault value
    nameFull namespaceYes
    pathFull header path to be inserted into ‘include’ directiveYes

    replace_user_types

    <replace_user_types>false</replace_user_types>

    Forces the types in current project that are covered by any of the library tags to be ignored (skipped) - library-provided ones will be used instead. Useful if you add library to replace some types available in current build.

    AttributeMeaningMandatoryDefault value
    Element contents‘true’ to exclude types or ‘false’ to let them befalsefalse

    files

    <files>
        <exclude file="/mask"/>
        <include file="/mask"/>
        <only file="/mask"/>
    </files>

    Adds file include and exclude masks. Masks should be prefixed with ‘/’. When these filters apply, priorities are as follows:

    DirectivePriorityEffectOverrides directivesIs overriden by directives
    includeHighAdds masked files to translating even if they are excluded by ‘exclude’ or ‘only’ rulesAllNone
    excludeMediumExcludes masked files from translating even if they are included by ‘only’ rules but unless they are included by ‘include’ ruleonlyinclude
    onlyLowIf present, excludes all files but those masked, unless they are excluded by ‘exclude’ rule, plus those added by ‘include’ ruleNoneAll
    AttributeMeaningMandatoryDefault value

    Allowed subnodes are listed below.

    exclude

    <exclude file="path/foo_*.cs"/>

    Makes translator ignore all files in project that match the specified mask.

    AttributeMeaningMandatoryDefault value
    fileFilename mask with ‘*’ and ‘?’ substitutions allowed.Yes

    include

    <include file="path/foo_bar_*.cs"/>

    Stops translator from ignoring files that match the specified mask even if ignored otherwise (by ‘exclude’ or ‘only’ subnode).

    AttributeMeaningMandatoryDefault value
    fileFilename mask with ‘*’ and ‘?’ substitutions allowed.Yes

    only

    <only file="path/bar_foo_*.cs"/>

    Makes translator ignore all files that do not match the specified mask (or any of the masks specified in ‘only’ subnodes if multiple ones are present).

    AttributeMeaningMandatoryDefault value
    fileFilename mask with ‘*’ and ‘?’ substitutions allowed.Yes

    cut_namespaces

    <cut_namespaces>
        <exclude file="mask"/>
        <include file="mask"/>
        <only file="mask"/>
    </cut_namespaces>

    Enable/disable namespaces cutting for all types, defined in specific files. The subnodes rules are identical with <files> option.

    AttributeMeaningMandatoryDefault value

    So, if the file ‘foo.cs’ containing type Bar.Foo is included using cut_namespace element, this type will be referred to as ‘Foo’ in translated code. Otherwise, it will be referred to as ‘Bar::Foo’.

    typemap

    <typemap>
        <class csname="Namespace1.Class1" cppname="Namespace2.Class2" box="false"/>
        ...
    </typemap>

    Maps C# type names into C++ ones. Useful if the default mapping fails.

    AttributeMeaningMandatoryDefault value

    The only allowed subnode is ‘class’.

    class

    <class csname="Namespace1.Class1" cppname="Namespace2.Class2" box="false"/>

    Denotes a single mapping rule of how C# typename should be translated to C++.

    AttributeMeaningMandatoryDefault value
    csnameClass name with namespace in C#Yes
    cppnameClass name with namespace in C++Yes
    boxBoolean flag that shows whether the type requires boxingNofalse

    includes

    <includes>
        <class name="LibProject::Class1" path="libproject/class1.h" shortptr="true"/>
        <enum name="LibProject::Enum1" path="libproject/enum1.h"/>
        <namespace name="LibProject::Namespace1" path="libproject/namespace1.h"/>
        ...
    </includes>

    Specifies includes for specific types. Include rules, same as in “lib” section.

    AttributeMeaningMandatoryDefault value

    force_value_types

    <force_value_types>
        <class name="Namespace1::Class1"/>
        <class name="Namespace2::Class2" box="true"/>
        ...
    </force_value_types>

    Lists the types to be treated as value types. Only ‘class’ subnodes are allowed.

    AttributeMeaningMandatoryDefault value

    class

    <class name="Namespace1::Class1" box="false"/>

    Class to be treated as value type.

    AttributeMeaningMandatoryDefault value
    nameType in C++ with namespaceYes
    boxBoolean value which defines whether type is subject for boxingNofalse

    references

    <references>
        <assembly name="Assembly.Name" path="path\to\assembly.dll"/>
    </references>

    Specifies the references to external assemblies to import symbols from.

    AttributeMeaningMandatoryDefault value

    Only ‘assembly’ nodes are allowed here.

    assembly

    <assembly name="Assembly.Name" path="path\to\assembly.dll"/>

    Single assembly to import symbols from.

    AttributeMeaningMandatoryDefault value
    nameC# assembly name.Yes
    pathPath to assembly.Yes

    dont_wrap_params

    <dont_wrap_params>
        <class  name="Namespace::Class1"/>
        <method name="Namespace::Class2::Method1"/>
        ...
    </dont_wrap_params>

    Disables parameters wrapping (matching actual parameters against format ones with neccessary casts) against specific method or all methods of specific class. This is required if the method uses variadic template arguments and actual wrapping would fail.

    AttributeMeaningMandatoryDefault value

    Only ‘class’ and ‘method’ subnodes are allowed here.

    class

    <class name="Namespace::Class1"/>

    Single class, all methods of which will not be wrapping parameters for.

    AttributeMeaningMandatoryDefault value
    nameName of the class in C++ with namespace.Yes

    method

    <method name="Namespace::Class2::Method1"/>

    Single method to not wrap parameters for. All methods with this name will be affected - there’s no way disabling parameter wrapping for single overload.

    AttributeMeaningMandatoryDefault value
    nameName of the method in C++ with namespace and class name.Yes

    disable_boxing

    <disable_boxing>
        <class name="System::Convert"/>
        <method name="System::Enum::Parse"/>
        ...
    </disable_boxing>

    Disables parameters boxing when type conversions occur (usually when native C++ implementations exist with better signatures). The syntax is same as for ‘dont_wrap_param’.

    AttributeMeaningMandatoryDefault value

    restricted_tokens

    <restricted_tokens mask="*">
        <token from="OldName" to="NewName"/>
        ...
    </restricted_tokens>

    Replaces all identifiers specified globally in selected files.

    AttributeMeaningMandatoryDefault value
    maskFile name or path mask - only selected files will be affected.No*

    token

    <token from="OldName" to="NewName"/>

    Single rule for identifier replacement.

    AttributeMeaningMandatoryDefault value
    fromIdentifier in original C# code to be replacedYes
    toReplacement for identifier specified in ‘from’ attributeYes

    assembly_with_restricted_tokens

    <assembly_with_restricted_tokens>AssemblyName</assembly_with_restricted_tokens>

    Forces the names in the referenced assembly to be replaced as per all restricted_tokens rules. By default, only the tokens in current assembly are replaced. No mask matching is performed.

    AttributeMeaningMandatoryDefault value
    Element contentsName of the dependence assembly in C#Yes

    skip_definitions

    <skip_definitions stub="false" only_public_api="true"/>

    Global version of ‘CppSkipDefinition’ attribute. If enabled, no class member definitions are processed (but declarations are still generated for them).

    AttributeMeaningMandatoryDefault value
    stubWhether to generate stubs for dropped definitions, ‘true’ or ‘false’falsetrue
    only_public_apiWhether translator should leave public API only (‘true’) or process private and internal classes as well (‘false’)falsefalse

    implementation

    <implementation type="MyNamespace.MyClass" entity="MyMethod" includes="*someglobalheader;*otherglobalheader.h;path1/path2/header1.h;path1/path2/header2.h">
        <![CDATA[
            return 2+2;
        ]]>
    </implementation>
    
    <implementation file="OriginalFileName.cpp" to="source"/>

    Substitutes some C++ implementation instead of translated one. First form allows it to store the implementation for the specified method in config itself. The second one copies the C++ file to destination directory.

    AttributeMeaningMandatoryDefault value
    typeC# type name to substitute member forIn the first form
    entityC# method name (no overloads supported)In the first form
    includesSemicolon delimited list of headers, used for the custom implementation (if header started with ‘*’ character, then header is the global, else header is the local)Optional (used in the first form only)
    Element contentsCDATA with codeIn the first form
    filePath to C++ file with additional implementations to copy to your target projectIn the second form
    toSubdirectory to copy C++ file toIn the second form

    Alternatively, you can simply include .cpp file into your C# project. It will be copied to output project during translating.

    Please note that all methods you want to replace implementations for must be marked with CppSkipDefinition attribute.

    nunit_categories

    <nunit_categories>
        <include name="Category1"/>
        <exclude name="Category2"/>
    </nunit_categories>

    Allows it to filter tests by the category specified in NUnit.Framework.Category attribute. ‘exclude’ filter excludes single category. ‘include’ filter, if present, excludes all categories except for the one specified and for the ones specified in other ‘include’ filters, if present. ‘include’ directive has higher priority than ‘execlude’ one.

    AttributeMeaningMandatoryDefault value

    Only ‘include’ and ‘exclude’ elements are allowed inside ‘nunit_categories’ one.

    For example, there are ‘A’, ‘B’, ‘C’ and ‘D’ categories and some uncategorized tests. If we exclude ‘A’ and ‘B’ categories, then only ‘C’, ‘D’ and uncategorized tests will be translated. If we additionally include ‘A’, then only ‘A’ category will be translated, as ‘include’ tag overweights any ‘exclude’ ones and, if present, excludes everything that is not included explicitly. If now we include ‘’ category, then only ‘A’, ‘C’, ‘D’ and uncategorized tests are translated as including ‘’ includes everything that was not excluded explicitly.

    include

    <include name="Category1"/>

    Category for inclusion.

    AttributeMeaningMandatoryDefault value
    nameNUnit test category nameYes

    A special value of ‘’ can be assigned to the ‘name’ attribute of ‘include’ tag. If present, such tag changes the logic here. By default, everything that is not included explicitly, is excluded if there is at least one ‘include’ tag present. If there is a tag including ‘’ category, then everything that is not excluded explicitly gets included, instead.

    exclude

    <exclude name="Category1"/>

    Category for exclusion.

    AttributeMeaningMandatoryDefault value
    nameNUnit test category nameYes

    cmake_commands

    <cmake_commands>
    <![CDATA[
        if (MSVC)
            set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/INCREMENTAL:NO")
        endif()
    ]]>
    </cmake_commands>

    Allows it to push custom commands to resulting CMakeLists.txt file.

    AttributeMeaningMandatoryDefault value
    Element contentsCDATA with cmake codeYes

    cmake_files

    <cmake_files>
        <file name="file1.cmake" />
        ...
    </cmake_files>

    Lists cmake files to be copied from ‘cmake’ directory of translator installation to target project directory. Please note that each copy of this node clears all previously set ones, including the default values.

    AttributeMeaningMandatoryDefault value

    Only ‘file’ nodes are allowed inside.

    file

    <file name="file1.cmake" />

    Single file to be copied.

    AttributeMeaningMandatoryDefault value
    nameFile nameYes

    enum_underlying_types

    <enum_underlying_types>
        <type name="Enum1" value="int" />
        ...
    </enum_underlying_types>

    Maps enums underlying types. Mostly used by translator typemap when processing dependent projects.

    AttributeMeaningMandatoryDefault value

    Only ‘type’ nodes are allowed inside.

    type

    <type name="Enum1" value="int" />

    Individual underlying type mapping rule.

    AttributeMeaningMandatoryDefault value
    nameEnum type name with namespaceYes
    valueInteger type nameYes

    attribute

    <attribute name="CppAttributeName" ... />

    Single attribute record. See Attributes in configuration file for more details.

    AttributeMeaningMandatoryDefault value
    nameAttribute nameYes
    Other attributesIndividual per attribute. Some of them set attribute parameters, some other ones specify scope.Depends on attributeDepends on attribute

    forced_include

    <forced_include>
        <class name="Namespace::ClassName" />
        <class name="Namespace::ClassName1" />
    </forced_include>

    Include header instead of forward declaration for an argument type, same as CppForceInclude attribute.

    AttributeMeaningMandatoryDefault value

    Only ‘class’ nodes are allowed inside.

    class

    <class name="Namespace::ClassName" />

    Individual class to force includes for.

    AttributeMeaningMandatoryDefault value
    nameClass name with namespaceYes

    documentation_comments_translation

    <documentation_comments_translation>
        <cref_typemap>
            <cref cstext="sbyte" cpptext="int8_t" />
        </cref_typemap>
        <summary_text_map>
            <property cstext="Gets or sets" getter_text="Gets" setter_text="Sets" />
        </summary_text_map>
        <options>
            <opt name="fix_setter_return_tag" value="true" />
        </options>
        <replacements>
            <comment  type="SomeNS.Enum1" member="" tag="code">
                <![CDATA[
    C++ code Enum1
    ]]>
            </comment>
        </replacements>
        <translate_code_from_comments value="true"/>
        <translate_code_from_comments_system_dlls>
            <system_dll name="System.Something.dll"/>
        </translate_code_from_comments_system_dlls>
    </documentation_comments_translation>

    Parameters for code documentation.

    AttributeMeaningMandatoryDefault value

    The following subsections are allowed:

    • cref_typemap - list of type references to be translated and supplied to Doxygen. The following child nodes are allowed:
      • cref - one type; cstext attribute names type in C# and cpptext names corresponding type in C++.
    • summary_text_map - list of substrings which should be replaced when generating individual getter and setter comments from joint getter+setter comment in C#.
      • property - individual replacement entry. cstext attribute means text to be replaced, getter_text is replacement for getter and setter_text is replacement for setter.
    • options - list of options related to documentation generation. The following options are allowed:
      • fix_setter_return_tag - remove ‘return’ tag from setter documentation.
    • replacements - list of allowed replacements for the specified tags in comments to specified items.
      • comment - the contents of this item will replace the contents of specified tag of the specified member of specified tag. If both type and member are unset, this replacement will be done by default to all occurrances of mentioned tag where no other replacements apply.

    For mentioned subtags attributes, see below.

    cref_typemap

    AttributeMeaningMandatoryDefault value

    cref

    AttributeMeaningMandatoryDefault value
    cstextType name in C# commentsYes
    cpptextCorresponding type name in C++ commentsYes

    summary_text_map

    AttributeMeaningMandatoryDefault value

    property

    AttributeMeaningMandatoryDefault value
    cstextText to be replaced as it appears in C# property documentationYes
    getter_textReplacement text for C++ getter function documentationYes
    setter_textReplacement text for C++ setter function documentationYes

    options

    AttributeMeaningMandatoryDefault value

    replacements

    Defines exact replacement for contents of specific tag in documentation for type or type member.

    translate_code_from_comments

    Enables the translator replacing references to C# types and members with C++ analogs.

    AttributeMeaningMandatoryDefault value
    valueBoolean flag that enables or disables this behavior.Yesfalse

    Since version: 21.2

    translate_code_from_comments_system_dlls

    Adds specified DLLs to symbol lookup when replacing references in documentation comments. No longer required since 21.3 version.

    system_dll

    Specifies a single DLL to add to this list.

    AttributeMeaningMandatoryDefault value
    nameName of the DLL to use symbols from when performing code comments changes.Yes

    Since version: 21.2

    if

    <if defined="my_var">
        <opt name="additional_defines" value="SOME_DEFINES"/>
        <else>
            <opt name="additional_defines" value="SOME_OTHER_DEFINES"/>
        </else>
    </if>

    Allows to switch on or off some part of the config conditionally, based on command line parameters passed to translator: if ‘-d’ command line parameter followed by definition name is passed, all contents of ‘if’ tag except for ‘else’ subtag is executed (in the above example - first ‘opt’ element); otherwise, only ‘else’ tag is executed (in the above example - second ‘opt’ tag).

    AttributeMeaningMandatoryDefault value
    definedName of parameter to be evaluatedYes

    else

    <else>
        <opt name="additional_defines" value="SOME_OTHER_DEFINES"/>
    </else>

    Part of the config which should be executed if ‘if’ element evaluation fails.

    AttributeMeaningMandatoryDefault value

    msbuild_global_properties

    <msbuild_global_properties>
        <property name="TargetFramework" value="net20"/>
    </msbuild_global_properties>

    Allows to define MSBuild properties directly to satisfy conditions in csproj file.

    AttributeMeaningMandatoryDefault Value

    Allowed sub-items:

    property

    AttributeMeaningMandatoryDefault Value
    nameMSBuild property nameYes-
    valueMSBUild property valueYes-

    rename_files

    <rename_files>
        <file name_without_extension="FileToRename" to="RenamedFile"/>
    </rename_files>

    Allows to rename files generated by translator. Impacts both ‘.h’ and ‘.cpp’ file (if exist).

    AttributeMeaningMandatoryDefault Value

    Allowed sub-items:

    file

    AttributeMeaningMandatoryDefault Value
    name_without_extensionName of file generated by translator by default.Yes-
    toFile name the file to be renamed to.Yes-

    allowed_heap_only_types

    <allowed_heap_only_types>
        <class name="System.Xml.XPath.XPathNodeIterator" />
    </allowed_heap_only_types>

    Makes translator generate code that produces compilation error if specified class is being allocated on stack. Useful for the classes that create shared pointers to themselves and thus are incompatible with automatic memory management.

    AttributeMeaningMandatoryDefault Value

    Since version: 20.1.

    Allowed sub-items:

    class

    AttributeMeaningMandatoryDefault Value
    nameFully qualified name of C# class.Yes-

    types_with_begin_and_end_methods

    <types_with_begin_and_end_methods>
        <class name="System.Collections.Generic.Dictionary" />
    </types_with_begin_and_end_methods>

    Makes translator generate simplier code for ‘foreach’ statements, if ‘foreach_as_range_based_for_loop’ option is enabled.

    AttributeMeaningMandatoryDefault Value

    Since version: 20.8.

    Allowed sub-items:

    class

    AttributeMeaningMandatoryDefault Value
    nameFully qualified name of C# class.Yes-

    assembly_types

    <assembly_types>
       <class name="Namespace.ClassName" />
    </assembly_types>

    Makes translator register specified types in the Assembly object which is associated with current project. Unless the type is registered, TypeInfo::get_Assembly() doesn’t work for it.

    AttributeMeaningMandatoryDefault Value

    Since version: 20.10.

    Allowed sub-items:

    class

    AttributeMeaningMandatoryDefault Value
    nameFully qualified name of C# class.Yes-

    unity_build

    <unity_build batch_size="16">
      <excluded_files>
        <file name="main.cpp" />
      </excluded_files>
    </unity_build>

    Enables the building process using UNITY_BUILD for the translated project.

    AttributeMeaningMandatoryDefault Value
    batch_sizeSets the batch size of UNITY_BUILD. The value must be greater that 0. Otherwise, UNITY_BUILD will be disabled.Yes-

    Since version: 21.6.

    Allowed sub-items:

    excluded_files

    Contains a list of files that must be excluded from UNITY_BUILD.

    Allowed sub-items:

    file

    AttributeMeaningMandatoryDefault Value
    nameA path to a file that must be excluded from UNITY_BUILD.Yes-

    external_include

    <external_include file="AddFunctionArgument_PassFunctionArgument_Tests.cs" include="function_traits.hpp" include_to="source" include_as="local"/>

    Makes the translator generate additional include directives into the translated version of the specified cs file. Can do the same thing CppForceInclude attribute does, but can also include any file the translator doesn’t know about.

    AttributeMeaningMandatoryDefault Value
    fileCs file the inclusion should be added to the translated version of.Yes-
    includeInclude text (header name with all directories required).Yes-
    include_toWhether to add the include into header (‘header’) file or into the source (‘source’) file.Yes-
    include_asWhether to use local inclusion syntax (double quotes, ‘local’) or global inclusion syntax (angle brackets, ‘global’).Yes-

    Since version: 21.9.

    events_with_custom_accessors

    <events_with_custom_accessors>
        <event name="System.Xml.XmlReaderSettings.ValidationEventHandler"/>
        <event name="System.Xml.XmlValidatingReader.ValidationEventHandler"/>
        <event name="System.Xml.Schema.XmlSchemaSet.ValidationEventHandler"/>
    </events_with_custom_accessors>

    Makes the translator generate <PropertyName>_add()/<PropertyName>_remove() calls instead of +=/-= operators for specified custom events.

    Allowed sub-items:

    event

    AttributeMeaningMandatoryDefault Value
    nameEvent name (with namespace and class name)Yes-

    Since version: 22.1.