in src/langs/cpp/combinator.js [212:256]
combineCode(objects) {
const [object] = objects.filter(obj => obj.type === 'client');
object.name = 'Client';
const outputPars = { head: '', body: '', foot: '' };
this.object = object;
this.properties = {};
object.body.filter(node => is.prop(node)).forEach(node => {
this.properties[node.name] = { type: node.type, pointer: true };
});
/******************************* emit body *******************************/
let emitter = new Emitter(this.config);
object.body.forEach(node => {
this.statements = _deepClone(this.properties);
if (is.func(node)) {
this.emitFuncCode(emitter, node);
} else if (is.construct(node)) {
this.emitConstruct(emitter, node);
}
});
outputPars.body = emitter.output;
/******************************* emit head *******************************/
emitter = new Emitter(this.config);
if (object.topAnnotation.length > 0) {
this.emitAnnotations(emitter, object.topAnnotation);
emitter.emitln();
}
if (!this.config.exec) {
emitter.emitln(`#include <${_toSnakeCase(this.scope)}/${_toSnakeCase(this.package)}.${this.config.header_ext}>`);
this.emitInclude(emitter);
emitter.emitln(`using namespace ${this.namespace};`).emitln();
} else {
this.emitInclude(emitter);
}
outputPars.head = emitter.output;
/***************************** combine output ******************************/
const config = _deepClone(this.config);
config.ext = '.' + this.config.code_ext;
config.dir = `${config.dir}/src/`;
config.filename = _toSnakeCase(this.package);
this.combineOutputParts(config, outputPars);
}