in src/langs/cpp/combinator.js [778:823]
emitType(type, autoPtr = false) {
if (!is.type(type)) {
debug.stack('Inavalid type', type);
}
let type_str = null;
if (is.any(type)) {
this.pushInclude('boost_any');
type_str = 'boost::any';
} else if (is.decimal(type)) {
type_str = 'double';
} else if (is.integer(type)) {
type_str = type.length > 16 ? 'long' : 'int';
} else if (is.number(type)) {
type_str = 'int';
} else if (is.string(type)) {
this.pushInclude('iostream');
type_str = 'string';
} else if (is.bytes(type)) {
this.pushInclude('vector');
type_str = 'vector<uint8_t>';
} else if (is.array(type)) {
let subType = this.emitType(type.itemType);
this.pushInclude('vector');
type_str = `vector<${subType}>`;
} else if (is.bool(type)) {
type_str = 'bool';
} else if (is.void(type)) {
type_str = 'void';
} else if (is.map(type)) {
this.pushInclude('map');
type_str = `map<${this.emitType(type.keyType)}, ${this.emitType(type.valType)}>`;
} else if (is.stream(type)) {
type_str = this.addInclude('$Stream');
} else if (is.object(type)) {
type_str = !type.objectName ? 'void' : this.resolveName(type.objectName);
} else if (is.null(type)) {
type_str = 'nullptr';
}
if (type_str === null) {
debug.stack('Unsupported Type', type);
}
if (autoPtr && this.isPointerType(type)) {
type_str = `shared_ptr<${type_str}>`;
}
return type_str;
}