quicktype-core 20.0.21 → 20.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/language/CPlusPlus.js +36 -5
- package/package.json +1 -1
|
@@ -698,10 +698,16 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
698
698
|
}
|
|
699
699
|
let typeSource = (0, TypeUtils_1.matchType)(t, _anyType => {
|
|
700
700
|
isOptional = false;
|
|
701
|
-
return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.anyTypeIssueAnnotation, [
|
|
701
|
+
return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.anyTypeIssueAnnotation, [
|
|
702
|
+
this.jsonQualifier(inJsonNamespace),
|
|
703
|
+
"json"
|
|
704
|
+
]);
|
|
702
705
|
}, _nullType => {
|
|
703
706
|
isOptional = false;
|
|
704
|
-
return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.nullTypeIssueAnnotation, [
|
|
707
|
+
return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.nullTypeIssueAnnotation, [
|
|
708
|
+
this.jsonQualifier(inJsonNamespace),
|
|
709
|
+
"json"
|
|
710
|
+
]);
|
|
705
711
|
}, _boolType => "bool", _integerType => "int64_t", _doubleType => "double", _stringType => {
|
|
706
712
|
if (forceNarrowString) {
|
|
707
713
|
return "std::string";
|
|
@@ -950,7 +956,17 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
950
956
|
const ourQualifier = this.ourQualifier(true);
|
|
951
957
|
let cppType;
|
|
952
958
|
let toType;
|
|
953
|
-
this.emitBlock([
|
|
959
|
+
this.emitBlock([
|
|
960
|
+
"inline void adl_serializer<",
|
|
961
|
+
ourQualifier,
|
|
962
|
+
className,
|
|
963
|
+
">::from_json(",
|
|
964
|
+
this.withConst("json"),
|
|
965
|
+
" & j, ",
|
|
966
|
+
ourQualifier,
|
|
967
|
+
className,
|
|
968
|
+
"& x)"
|
|
969
|
+
], false, () => {
|
|
954
970
|
cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, true, false);
|
|
955
971
|
toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, false, false);
|
|
956
972
|
this.emitLine([
|
|
@@ -963,7 +979,14 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
963
979
|
";"
|
|
964
980
|
]);
|
|
965
981
|
});
|
|
966
|
-
this.emitBlock([
|
|
982
|
+
this.emitBlock([
|
|
983
|
+
"inline void adl_serializer<",
|
|
984
|
+
ourQualifier,
|
|
985
|
+
className,
|
|
986
|
+
">::to_json(json & j, ",
|
|
987
|
+
this.withConst([ourQualifier, className]),
|
|
988
|
+
" & x)"
|
|
989
|
+
], false, () => {
|
|
967
990
|
cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, false, false);
|
|
968
991
|
toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, true, false);
|
|
969
992
|
this.emitLine([
|
|
@@ -1131,7 +1154,15 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1131
1154
|
];
|
|
1132
1155
|
const nonNulls = (0, TypeUtils_1.removeNullFromUnion)(u, true)[1];
|
|
1133
1156
|
const variantType = this.cppTypeInOptional(nonNulls, { needsForwardIndirection: false, needsOptionalIndirection: false, inJsonNamespace: true }, false, false);
|
|
1134
|
-
this.emitBlock([
|
|
1157
|
+
this.emitBlock([
|
|
1158
|
+
"inline void adl_serializer<",
|
|
1159
|
+
variantType,
|
|
1160
|
+
">::from_json(",
|
|
1161
|
+
this.withConst("json"),
|
|
1162
|
+
" & j, ",
|
|
1163
|
+
variantType,
|
|
1164
|
+
" & x)"
|
|
1165
|
+
], false, () => {
|
|
1135
1166
|
let onFirst = true;
|
|
1136
1167
|
for (const [kind, func] of functionForKind) {
|
|
1137
1168
|
const typeForKind = (0, collection_utils_1.iterableFind)(nonNulls, t => t.kind === kind);
|