Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev/cpp' into feature/cpp-app-pa…
Browse files Browse the repository at this point in the history
…ssthrough
  • Loading branch information
ksentak committed Jul 1, 2024
2 parents 09740b3 + 34313c7 commit b39da1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions languages/cpp/templates/codeblocks/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

ProviderInvokeSession(methodName, jsonParameters, err);
}
static void ProviderResultSession(std::string methodName, std::string& correlationId, ${if.result.namespace.notsame}${parent.Title}::${end.if.result.namespace.notsame}${provider.xresponse.name} result, Firebolt::Error *err = nullptr)
static void ProviderResultSession(std::string methodName, std::string& correlationId, ${provider.xresponse.name} result, Firebolt::Error *err = nullptr)
{
JsonObject jsonParameters;
WPEFramework::Core::JSON::Variant CorrelationId(correlationId);
Expand All @@ -34,7 +34,7 @@
${provider.xresponse.serialization}
ProviderInvokeSession(methodName, jsonParameters, err);
}
static void ProviderErrorSession(std::string methodName, std::string& correlationId, ${if.error.namespace.notsame}${parent.Title}::${end.if.error.namespace.notsame}${provider.xerror.name} result, Firebolt::Error *err = nullptr)
static void ProviderErrorSession(std::string methodName, std::string& correlationId, ${provider.xerror.name} result, Firebolt::Error *err = nullptr)
{
JsonObject jsonParameters;
WPEFramework::Core::JSON::Variant CorrelationId(correlationId);
Expand Down
6 changes: 3 additions & 3 deletions languages/cpp/templates/codeblocks/interface.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
struct I${info.Title}Session : virtual public IFocussableProviderSession {
virtual ~I${info.Title}Session() override = default;

virtual void error( ${if.error.namespace.notsame}${parent.Title}::${end.if.error.namespace.notsame}${provider.xerror.name} error, Firebolt::Error *err = nullptr ) = 0;
virtual void result( ${if.result.namespace.notsame}${parent.Title}::${end.if.result.namespace.notsame}${provider.xresponse.name} result, Firebolt::Error *err = nullptr ) = 0;
virtual void error( ${provider.xerror.name} error, Firebolt::Error *err = nullptr ) = 0;
virtual void result( ${provider.xresponse.name} result, Firebolt::Error *err = nullptr ) = 0;
};

struct I${info.Title}Provider {
virtual ~I${info.Title}Provider() = default;

${methods}
};
};
8 changes: 4 additions & 4 deletions src/macrofier/engine.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1788,18 +1788,18 @@ function insertProviderXValues(template, module, xValues) {
let schema = localizeDependencies(xValues['x-response'], module)
const moduleTitle = types.getXSchemaGroup(schema, module)
const xResponseInst = types.getSchemaShape(schema, module, { templateDir: 'parameter-serialization', property: 'result', required: true, destination: state.destination, section: state.section, primitive: true, skipTitleOnce: true })
const type = types.getSchemaType(schema, module, { moduleTitle: moduleTitle, result: true, namespace: true})
template = template.replace(/\$\{provider\.xresponse\.serialization\}/gms, xResponseInst)
.replace(/\$\{provider\.xresponse\.name\}/gms, schema.title)
.replace(/\$\{if\.result\.namespace\.notsame}(.*?)\$\{end\.if\.result\.namespace\.notsame\}/g, (module.info.title !== moduleTitle) ? '$1' : '')
.replace(/\$\{provider\.xresponse\.name\}/gms, type)
.replace(/\$\{parent\.Title\}/g, capitalize(moduleTitle))
}
if (xValues['x-error']) {
let schema = localizeDependencies(xValues['x-error'], module)
const moduleTitle = types.getXSchemaGroup(schema, module)
const xErrorInst = types.getSchemaShape(schema, module, { templateDir: 'parameter-serialization', property: 'result', required: true, destination: state.destination, section: state.section, primitive: true, skipTitleOnce: true })
const type = types.getSchemaType(schema, module, { moduleTitle: moduleTitle, result: true, namespace: true})
template = template.replace(/\$\{provider\.xerror\.serialization\}/gms, xErrorInst)
.replace(/\$\{provider\.xerror\.name\}/gms, schema.title)
.replace(/\$\{if\.error\.namespace\.notsame}(.*?)\$\{end\.if\.error\.namespace\.notsame\}/g, (module.info.title !== moduleTitle) ? '$1' : '')
.replace(/\$\{provider\.xerror\.name\}/gms, type)
.replace(/\$\{parent\.Title\}/g, capitalize(moduleTitle))
}
return template
Expand Down

0 comments on commit b39da1e

Please sign in to comment.