From f0c9dadc802f2f28b98ebff134a1201ad1e26fd7 Mon Sep 17 00:00:00 2001 From: HaseenaSainul Date: Fri, 29 Sep 2023 01:34:27 -0400 Subject: [PATCH] CPPSDK: namespace settings changes --- languages/cpp/templates/types/namespace.h | 2 +- src/macrofier/types.mjs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/languages/cpp/templates/types/namespace.h b/languages/cpp/templates/types/namespace.h index 626de353..b3afde8a 100644 --- a/languages/cpp/templates/types/namespace.h +++ b/languages/cpp/templates/types/namespace.h @@ -1 +1 @@ -${parent.Title}:: \ No newline at end of file +${if.namespace.notsame}${parent.Title}::${end.if.namespace.notsame} \ No newline at end of file diff --git a/src/macrofier/types.mjs b/src/macrofier/types.mjs index 8506161e..d6e53788 100644 --- a/src/macrofier/types.mjs +++ b/src/macrofier/types.mjs @@ -56,7 +56,7 @@ function getMethodSignatureParams(method, module, { destination, callback }) { const paramRequired = getTemplate('/parameters/default') const paramOptional = getTemplate('/parameters/optional') return method.params.map(param => { - let type = getSchemaType(param.schema, module, { destination }) + let type = getSchemaType(param.schema, module, { destination, namespace : true }) if (callback && allocatedPrimitiveProxies[type]) { type = allocatedPrimitiveProxies[type] } @@ -97,6 +97,7 @@ function insertSchemaMacros(content, schema, module, name, parent, property, rec .replace(/\$\{TITLE\}/g, title.toUpperCase()) .replace(/\$\{property\}/g, property) .replace(/\$\{Property\}/g, capitalize(property)) + .replace(/\$\{if\.namespace\.notsame}(.*?)\$\{end\.if\.namespace\.notsame\}/g, (module.info.title !== parent) ? '$1' : '') .replace(/\$\{parent\.title\}/g, parent) .replace(/\$\{parent\.Title\}/g, capitalize(parent)) .replace(/\$\{description\}/g, schema.description ? schema.description : '') @@ -106,10 +107,9 @@ function insertSchemaMacros(content, schema, module, name, parent, property, rec .replace(/\$\{info.title\}/g, moduleTitle) .replace(/\$\{info.Title\}/g, capitalize(moduleTitle)) .replace(/\$\{info.TITLE\}/g, moduleTitle.toUpperCase()) - // .replace(/\$\{type.link\}/g, getLinkForSchema(schema, module, { name: title })) if (recursive) { - content = content.replace(/\$\{type\}/g, getSchemaType(schema, module, { name: title, destination: state.destination, section: state.section, code: false })) + content = content.replace(/\$\{type\}/g, getSchemaType(schema, module, { name: title, destination: state.destination, section: state.section, code: false, namespace: true })) } return content } @@ -203,7 +203,7 @@ const insertObjectMacros = (content, schema, module, title, property, options) = if (schema.additionalProperties && (typeof schema.additionalProperties === 'object')) { type = schema.additionalProperties } - + if (schema.patternProperties) { Object.entries(schema.patternProperties).forEach(([pattern, schema]) => { let regex = new RegExp(pattern) @@ -591,7 +591,7 @@ function getSchemaType(schema, module, { destination, templateDir = 'types', lin if (schema.title) { union.title = schema.title } - return getSchemaType(union, module, { destination, link, title, code, asPath, baseUrl }) + return getSchemaType(union, module, { destination, link, title, code, asPath, baseUrl, namespace }) } else if (schema.oneOf || schema.anyOf) { if (!schema.anyOf) {