Name Mapping - loicoudot/java4cpp-core GitHub Wiki
By default, the name of the C++ class, methods, fields etc. is the same as the java ones. You can always choose a different one with annotation or with xml mappings.
A list of reserved keyword is customizable, to avoid generation of a restricted keyword by java4cpp by escaping a name by appending an underscore.
You can change the name of C++ proxies.
Annotation case:
package demo;
@Java4Cpp(name = "CppSample")
public class Sample {
}
XML case:
<mappings>
<classes>
<class class="demo.Sample">
<cppName>CppSample</cppName>
</class>
</classes>
</mappings>
will produce:
namespace demo {
class CppSample {
};
}
You can change the name of methods, static fields and inner-classes.
Annotation case:
package demo;
@Java4Cpp
public class Sample {
@Java4CppWrappe("CppField")
public static String field;
@Java4CppWrappe("CppMethod")
public void method();
}
XML case:
<mappings>
<classes>
<class class="demo.Sample">
<staticFields>
<wrappes>
<wrappe cppName="CppField">field</wrappe>
</wrappes>
</staticFields>
<methods>
<wrappes>
<wrappe cppName="CppMethod">method()</wrappe>
</wrappes>
</methods>
</class>
</classes>
</mappings>
will produce:
namespace demo {
class Sample {
java::lang::String getCppField();
void CppMethod();
};
}
This list can be customized only within xml mappings.
<mappings>
<keywords>
<keyword>delete</keyword>
</keywords>
</mappings>
if a class, methods or fields have a java name of delete
, then the corresponding C++ items will have the name delete_