io.joynr.generator.cpp.communicationmodel.MapCppTemplate Maven / Gradle / Ivy
package io.joynr.generator.cpp.communicationmodel;
import com.google.inject.assistedinject.Assisted;
import io.joynr.generator.cpp.util.CppStdTypeUtil;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import io.joynr.generator.templates.MapTemplate;
import io.joynr.generator.templates.util.NamingUtil;
import javax.inject.Inject;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.franca.core.franca.FMapType;
@SuppressWarnings("all")
public class MapCppTemplate extends MapTemplate {
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
@Inject
@Extension
private CppStdTypeUtil _cppStdTypeUtil;
@Inject
@Extension
private NamingUtil _namingUtil;
@Inject
@Extension
private TemplateBase _templateBase;
@Inject
public MapCppTemplate(@Assisted final FMapType type) {
super(type);
}
@Override
public CharSequence generate(final boolean generateVersion) {
StringConcatenation _builder = new StringConcatenation();
final String typeName = this._namingUtil.joynrName(this.type);
_builder.newLineIfNotEmpty();
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning);
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("#include ");
String _includeOf = this._cppStdTypeUtil.getIncludeOf(this.type, generateVersion);
_builder.append(_includeOf);
_builder.newLineIfNotEmpty();
_builder.newLine();
String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(this.type, true, generateVersion);
_builder.append(_namespaceStarter);
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("const std::int32_t ");
_builder.append(typeName);
_builder.append("::MAJOR_VERSION = ");
_builder.append(this.majorVersion);
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.append("const std::int32_t ");
_builder.append(typeName);
_builder.append("::MINOR_VERSION = ");
_builder.append(this.minorVersion);
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.newLine();
String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(this.type, true, generateVersion);
_builder.append(_namespaceEnder);
_builder.newLineIfNotEmpty();
_builder.newLine();
return _builder;
}
}