All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.joynr.generator.cpp.util.InterfaceSubscriptionUtil Maven / Gradle / Ivy

There is a newer version: 0.9.3
Show newest version
package io.joynr.generator.cpp.util;

import com.google.inject.Inject;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import org.eclipse.emf.common.util.EList;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.franca.core.franca.FAttribute;
import org.franca.core.franca.FInterface;

@SuppressWarnings("all")
public class InterfaceSubscriptionUtil {
  @Inject
  @Extension
  private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
  
  public CharSequence produceSubscribeUnsubscribeMethods(final FInterface serviceInterface, final boolean pure) {
    StringConcatenation _builder = new StringConcatenation();
    {
      EList _attributes = this._joynrCppGeneratorExtensions.getAttributes(serviceInterface);
      for(final FAttribute attribute : _attributes) {
        final String returnType = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
        _builder.newLineIfNotEmpty();
        _builder.append("virtual QString subscribeTo");
        String _joynrName = this._joynrCppGeneratorExtensions.joynrName(attribute);
        String _firstUpper = StringExtensions.toFirstUpper(_joynrName);
        _builder.append(_firstUpper, "");
        _builder.append("(QSharedPointer > subscriptionListener, QSharedPointer subscriptionQos)");
        {
          if (pure) {
            _builder.append(" = 0");
          }
        }
        _builder.append(";");
        _builder.newLineIfNotEmpty();
        _builder.append("virtual void unsubscribeFrom");
        String _joynrName_1 = this._joynrCppGeneratorExtensions.joynrName(attribute);
        String _firstUpper_1 = StringExtensions.toFirstUpper(_joynrName_1);
        _builder.append(_firstUpper_1, "");
        _builder.append("(QString& subscriptionId)");
        {
          if (pure) {
            _builder.append(" = 0");
          }
        }
        _builder.append(";");
        _builder.newLineIfNotEmpty();
      }
    }
    return _builder;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy