behaviorTamplateString()

in src/langs/cpp/combinator.js [1920:1943]


  behaviorTamplateString(emitter, behavior) {
    let tmp = [];
    behavior.items.forEach(item => {
      let emit = new Emitter(this.config);
      if (this.isPointerVar(item) && !is.any(item.dataType)) {
        emit.emit('*');
      }
      if (is.string(item.dataType)) {
        this.grammer(emit, item, false, false);
      } else if (is.any(item.dataType)) {
        this.pushInclude('darabonba_core');
        emit.emit(`${this.config.tea.converter.name}::toString(`);
        this.grammer(emit, item, false, false);
        emit.emit(')');
      } else {
        this.pushInclude('cast');
        emit.emit('boost::lexical_cast<string>(');
        this.grammer(emit, item, false, false);
        emit.emit(')');
      }
      tmp.push(emit.output);
    });
    emitter.emit(`${tmp.filter(s => s !== '""').map(s => `string(${s})`).join(' + ')}`);
  }