-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CPPSDK: changes to handle context params (#161)
- Loading branch information
1 parent
c200483
commit f3593b1
Showing
46 changed files
with
90 additions
and
69 deletions.
There are no files selected for viewing
6 changes: 0 additions & 6 deletions
6
languages/cpp/templates/callback-context-instantiation/additionalProperties.cpp
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
languages/cpp/templates/callback-context-instantiation/anyOf.cpp
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
languages/cpp/templates/callback-context-instantiation/array.cpp
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
languages/cpp/templates/callback-context-instantiation/enum.cpp
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
languages/cpp/templates/callback-context-instantiation/object.cpp
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
languages/cpp/templates/callback-context-instantiation/property.cpp
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
languages/cpp/templates/callback-context-instantiation/sub-property/anyOfSchemaShape.cpp
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
languages/cpp/templates/callback-context-instantiation/sub-property/array.cpp
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
languages/cpp/templates/callback-context-instantiation/sub-property/const.cpp
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
languages/cpp/templates/callback-context-instantiation/sub-property/generic.cpp
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
languages/cpp/templates/callback-context-instantiation/sub-property/object-array.cpp
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
languages/cpp/templates/callback-context-instantiation/sub-property/object.cpp
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
languages/cpp/templates/callback-context-instantiation/sub-property/property.cpp
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
languages/cpp/templates/callback-context-instantiation/tuple.cpp
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-initialization-optional/generic.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
std::optional<${type}> ${property}; |
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-initialization-optional/primitive.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${type} |
30 changes: 20 additions & 10 deletions
30
languages/cpp/templates/callback-instantiation/generic.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
WPEFramework::Core::JSON::VariantContainer::Iterator elements = proxyResponse->Variants(); | ||
while (elements.Next()) { | ||
${callback.result.instantiation} | ||
else if (strcmp(elements.Label(), "context") == 0) { | ||
WPEFramework::Core::JSON::VariantContainer::Iterator params = elements.Current().Object().Variants(); | ||
while (params.Next()) { | ||
${callback.param.instantiation.with.indent} | ||
std::string str; | ||
proxyResponse->ToString(str); | ||
WPEFramework::Core::JSON::VariantContainer variantContainer(str); | ||
WPEFramework::Core::JSON::Variant resultVariant; | ||
if (variantContainer.HasLabel("context") == true) { | ||
WPEFramework::Core::JSON::VariantContainer::Iterator elements = variantContainer.Variants(); | ||
while (elements.Next()) { | ||
${callback.result.initialization.with.indent} | ||
else if (strcmp(elements.Label(), "context") == 0) { | ||
WPEFramework::Core::JSON::VariantContainer::Iterator params = elements.Current().Object().Variants(); | ||
while (params.Next()) { | ||
${callback.param.instantiation.with.indent} | ||
} | ||
} else { | ||
ASSERT(false); | ||
} | ||
} else { | ||
ASSERT(false); | ||
} | ||
} | ||
} else { | ||
resultVariant = variantContainer; | ||
} | ||
|
||
${callback.result.instantiation} |
2 changes: 1 addition & 1 deletion
2
...callback-context-instantiation/string.cpp → ...callback-value-initialization/generic.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
if (strcmp(elements.Label(), "${property}") == 0) { | ||
${property} = elements.Current().Value().c_str(); | ||
resultVariant = elements.Current(); | ||
} |
4 changes: 4 additions & 0 deletions
4
languages/cpp/templates/callback-value-instantiation/additionalProperties.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
${if.namespace.notsame}${info.Title}::${end.if.namespace.notsame}JsonData_${title}::Iterator elements = resultVariant.Variants(); | ||
while (elements.Next()) { | ||
${property}.insert(elements.Label(), elements.Current().${additional.type}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${property}; |
4 changes: 4 additions & 0 deletions
4
languages/cpp/templates/callback-value-instantiation/array.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
auto index(element.Current().Elements()); | ||
while (index.Next() == true) { | ||
${property}.push_back(resultVariant.Value()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${property} = WPEFramework::Core::EnumerateType<${if.namespace.notsame}${info.Title}::${end.if.namespace.notsame}${title}>(resultVariant.String().c_str(), false).Value(); |
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-value-instantiation/generic.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${property} = resultVariant.Value(); |
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
languages/cpp/templates/callback-value-instantiation/object.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
WPEFramework::Core::JSON::VariantContainer container = resultVariant.Object(); | ||
std::string strContainer; | ||
container.ToString(strContainer); | ||
${if.namespace.notsame}Firebolt::${info.Title}::${end.if.namespace.notsame}JsonData_${title} response; | ||
response.FromString(strContainer); | ||
${properties} |
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-value-instantiation/primitive.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${type} |
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-value-instantiation/property.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${shape} ${if.non.const}${if.non.anyOf}${if.non.array}${if.non.object}${base.title}.${property} = response.${Property};${end.if.non.object}${end.if.non.array}${end.if.non.anyOf}${end.if.non.const} |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-value-instantiation/string.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${property} = resultVariant.Value().c_str(); |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
languages/cpp/templates/callback-value-instantiation/sub-property/anyOfSchemaShape.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
string ${property}Str; | ||
response${Property.dependency}.${Property}.ToString(${property}Str); | ||
${base.title}${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property} = ${property}Str; |
5 changes: 5 additions & 0 deletions
5
languages/cpp/templates/callback-value-instantiation/sub-property/array.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
${if.impl.array.optional}${base.title}.${property} = std::make_optional<${type}>();${end.if.impl.array.optional} | ||
auto index(response.${Property}.Elements()); | ||
while (index.Next() == true) { | ||
${if.object}${items.with.indent}${end.if.object}${if.non.object} ${base.title}.${property}${if.impl.array.optional}.value()${end.if.impl.array.optional}.push_back(index.Current().Value());${end.if.non.object} | ||
} |
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-value-instantiation/sub-property/const.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${base.title}${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property} = response${Property.dependency}.${Property}; |
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-value-instantiation/sub-property/generic.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${base.title}${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property} = response${Property.dependency}.${Property}; |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
languages/cpp/templates/callback-value-instantiation/sub-property/object-array.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
${type} ${property}Result${level}; | ||
${if.namespace.notsame}Firebolt::${info.Title}::${end.if.namespace.notsame}JsonData_${title} jsonResult = index.Current(); | ||
${properties} | ||
${base.title}.${property}${if.impl.array.optional}.value()${end.if.impl.array.optional}.push_back(${property}Result${level}); |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
languages/cpp/templates/callback-value-instantiation/sub-property/object.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
${if.impl.optional} ${base.title}${property.dependency} = std::make_optional<${type}>();${end.if.impl.optional} | ||
{ | ||
${properties} | ||
} |
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-value-instantiation/sub-property/property.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${shape} ${if.non.const}${if.non.anyOf}${if.non.array}${if.non.object}${base.title}${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property} = response${Property.dependency}.${Property};${end.if.non.object}${end.if.non.array}${end.if.non.anyOf}${end.if.non.const} |
1 change: 1 addition & 0 deletions
1
languages/cpp/templates/callback-value-instantiation/sub-property/ref.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${shape} |
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
languages/cpp/templates/callback-value-instantiation/tuple.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
${property}.first = resultVariant.Get(0); | ||
${property}.second = resultVariant.Get(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.