quicktype-core 7.0.35 → 7.0.36
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.d.ts +4 -1
- package/dist/language/CPlusPlus.js +102 -70
- package/package.json +2 -2
|
@@ -12,7 +12,6 @@ export declare const cPlusPlusOptions: {
|
|
|
12
12
|
includeLocation: EnumOption<boolean>;
|
|
13
13
|
codeFormat: EnumOption<boolean>;
|
|
14
14
|
wstring: EnumOption<boolean>;
|
|
15
|
-
msbuildPermissive: EnumOption<boolean>;
|
|
16
15
|
westConst: EnumOption<boolean>;
|
|
17
16
|
justTypes: BooleanOption;
|
|
18
17
|
namespace: StringOption;
|
|
@@ -189,6 +188,10 @@ export declare class CPlusPlusRenderer extends ConvenienceRenderer {
|
|
|
189
188
|
protected emitExtraIncludes(): void;
|
|
190
189
|
protected emitHelper(): void;
|
|
191
190
|
protected emitTypes(): void;
|
|
191
|
+
protected gatherUserNamespaceForwardDecls(): Sourcelike[];
|
|
192
|
+
protected gatherNlohmannNamespaceForwardDecls(): Sourcelike[];
|
|
193
|
+
protected emitUserNamespaceImpls(): void;
|
|
194
|
+
protected emitNlohmannNamespaceImpls(): void;
|
|
192
195
|
protected emitGenerators(): void;
|
|
193
196
|
protected emitSingleSourceStructure(proposedFilename: string): void;
|
|
194
197
|
protected updateIncludes(isClassMember: boolean, includes: IncludeMap, propertyType: Type, _defName: string): void;
|
|
@@ -38,10 +38,6 @@ exports.cPlusPlusOptions = {
|
|
|
38
38
|
["use-string", false],
|
|
39
39
|
["use-wstring", true]
|
|
40
40
|
], "use-string"),
|
|
41
|
-
msbuildPermissive: new RendererOptions_1.EnumOption("msbuildPermissive", "Moves to_json and from_json types into the nlohmann::details namespace, so that msbuild can build it with conformance mode disabled", [
|
|
42
|
-
["not-permissive", false],
|
|
43
|
-
["use-permissive", true]
|
|
44
|
-
], "not-permissive", "secondary"),
|
|
45
41
|
westConst: new RendererOptions_1.EnumOption("const-style", "Put const to the left/west (const T) or right/east (T const)", [
|
|
46
42
|
["west-const", true],
|
|
47
43
|
["east-const", false]
|
|
@@ -86,7 +82,6 @@ class CPlusPlusTargetLanguage extends TargetLanguage_1.TargetLanguage {
|
|
|
86
82
|
exports.cPlusPlusOptions.namespace,
|
|
87
83
|
exports.cPlusPlusOptions.codeFormat,
|
|
88
84
|
exports.cPlusPlusOptions.wstring,
|
|
89
|
-
exports.cPlusPlusOptions.msbuildPermissive,
|
|
90
85
|
exports.cPlusPlusOptions.westConst,
|
|
91
86
|
exports.cPlusPlusOptions.typeSourceStyle,
|
|
92
87
|
exports.cPlusPlusOptions.includeLocation,
|
|
@@ -571,18 +566,18 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
571
566
|
]);
|
|
572
567
|
if (this._options.typeSourceStyle) {
|
|
573
568
|
this.forEachTopLevel("none", (_, topLevelName) => {
|
|
574
|
-
this.emitLine("// ",
|
|
569
|
+
this.emitLine("// ", topLevelName, " data = nlohmann::json::parse(jsonString);");
|
|
575
570
|
});
|
|
576
571
|
}
|
|
577
572
|
else {
|
|
578
|
-
this.emitLine("// ",
|
|
573
|
+
this.emitLine("// ", basename, " data = nlohmann::json::parse(jsonString);");
|
|
579
574
|
}
|
|
580
575
|
if (this._options.wstring) {
|
|
581
576
|
this.emitLine("//");
|
|
582
577
|
this.emitLine("// You can get std::wstring data back out using");
|
|
583
578
|
this.emitLine("//");
|
|
584
579
|
this.forEachTopLevel("none", (_, topLevelName) => {
|
|
585
|
-
this.emitLine("// std::wcout << ",
|
|
580
|
+
this.emitLine("// std::wcout << ", "wdump((nlohmann::json) ", topLevelName, ");");
|
|
586
581
|
});
|
|
587
582
|
}
|
|
588
583
|
}
|
|
@@ -679,12 +674,10 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
679
674
|
return [optionalType, "<", variant, ">"];
|
|
680
675
|
}
|
|
681
676
|
ourQualifier(inJsonNamespace) {
|
|
682
|
-
return inJsonNamespace
|
|
683
|
-
? [collection_utils_1.arrayIntercalate("::", this._namespaceNames), "::"]
|
|
684
|
-
: [];
|
|
677
|
+
return inJsonNamespace ? [collection_utils_1.arrayIntercalate("::", this._namespaceNames), "::"] : [];
|
|
685
678
|
}
|
|
686
679
|
jsonQualifier(inJsonNamespace) {
|
|
687
|
-
return inJsonNamespace
|
|
680
|
+
return inJsonNamespace ? [] : "nlohmann::";
|
|
688
681
|
}
|
|
689
682
|
variantIndirection(needIndirection, typeSrc) {
|
|
690
683
|
if (!needIndirection)
|
|
@@ -704,16 +697,10 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
704
697
|
}
|
|
705
698
|
let typeSource = TypeUtils_1.matchType(t, _anyType => {
|
|
706
699
|
isOptional = false;
|
|
707
|
-
return Source_1.maybeAnnotated(withIssues, Annotation_1.anyTypeIssueAnnotation, [
|
|
708
|
-
this.jsonQualifier(inJsonNamespace),
|
|
709
|
-
"json"
|
|
710
|
-
]);
|
|
700
|
+
return Source_1.maybeAnnotated(withIssues, Annotation_1.anyTypeIssueAnnotation, [this.jsonQualifier(inJsonNamespace), "json"]);
|
|
711
701
|
}, _nullType => {
|
|
712
702
|
isOptional = false;
|
|
713
|
-
return Source_1.maybeAnnotated(withIssues, Annotation_1.nullTypeIssueAnnotation, [
|
|
714
|
-
this.jsonQualifier(inJsonNamespace),
|
|
715
|
-
"json"
|
|
716
|
-
]);
|
|
703
|
+
return Source_1.maybeAnnotated(withIssues, Annotation_1.nullTypeIssueAnnotation, [this.jsonQualifier(inJsonNamespace), "json"]);
|
|
717
704
|
}, _boolType => "bool", _integerType => "int64_t", _doubleType => "double", _stringType => {
|
|
718
705
|
if (forceNarrowString) {
|
|
719
706
|
return "std::string";
|
|
@@ -941,25 +928,28 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
941
928
|
});
|
|
942
929
|
}
|
|
943
930
|
emitTopLevelHeaders(t, className) {
|
|
944
|
-
//
|
|
931
|
+
// Forward declarations for std::map<std::wstring, Key> (need to convert UTF16 <-> UTF8)
|
|
945
932
|
if (t instanceof Type_1.MapType && this._stringType !== this.NarrowString) {
|
|
946
933
|
const ourQualifier = this.ourQualifier(true);
|
|
947
|
-
this.emitLine("
|
|
948
|
-
this.
|
|
934
|
+
this.emitLine("template <>");
|
|
935
|
+
this.emitBlock(["struct adl_serializer<", ourQualifier, className, ">"], true, () => {
|
|
936
|
+
this.emitLine("static void from_json(", this.withConst("json"), " & j, ", ourQualifier, className, " & x);");
|
|
937
|
+
this.emitLine("static void to_json(json & j, ", this.withConst([ourQualifier, className]), " & x);");
|
|
938
|
+
});
|
|
949
939
|
}
|
|
950
940
|
}
|
|
951
941
|
emitClassHeaders(className) {
|
|
952
|
-
const ourQualifier = this.ourQualifier(
|
|
942
|
+
const ourQualifier = this.ourQualifier(false);
|
|
953
943
|
this.emitLine("void from_json(", this.withConst("json"), " & j, ", ourQualifier, className, " & x);");
|
|
954
944
|
this.emitLine("void to_json(json & j, ", this.withConst([ourQualifier, className]), " & x);");
|
|
955
945
|
}
|
|
956
946
|
emitTopLevelFunction(t, className) {
|
|
957
|
-
//
|
|
947
|
+
// Function definitions for std::map<std::wstring, Key> (need to convert UTF16 <-> UTF8)
|
|
958
948
|
if (t instanceof Type_1.MapType && this._stringType !== this.NarrowString) {
|
|
959
949
|
const ourQualifier = this.ourQualifier(true);
|
|
960
950
|
let cppType;
|
|
961
951
|
let toType;
|
|
962
|
-
this.emitBlock(["inline void from_json(", this.withConst("json"), " & j, ", ourQualifier, className, "& x)"], false, () => {
|
|
952
|
+
this.emitBlock(["inline void adl_serializer<", ourQualifier, className, ">::from_json(", this.withConst("json"), " & j, ", ourQualifier, className, "& x)"], false, () => {
|
|
963
953
|
cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, true, false);
|
|
964
954
|
toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, false, false);
|
|
965
955
|
this.emitLine([
|
|
@@ -972,7 +962,7 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
972
962
|
";"
|
|
973
963
|
]);
|
|
974
964
|
});
|
|
975
|
-
this.emitBlock(["inline void to_json(json & j, ", this.withConst([ourQualifier, className]), " & x)"], false, () => {
|
|
965
|
+
this.emitBlock(["inline void adl_serializer<", ourQualifier, className, ">::to_json(json & j, ", this.withConst([ourQualifier, className]), " & x)"], false, () => {
|
|
976
966
|
cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, false, false);
|
|
977
967
|
toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, true, false);
|
|
978
968
|
this.emitLine([
|
|
@@ -984,7 +974,7 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
984
974
|
}
|
|
985
975
|
}
|
|
986
976
|
emitClassFunctions(c, className) {
|
|
987
|
-
const ourQualifier = this.ourQualifier(
|
|
977
|
+
const ourQualifier = this.ourQualifier(false);
|
|
988
978
|
let cppType;
|
|
989
979
|
let toType;
|
|
990
980
|
this.emitBlock(["inline void from_json(", this.withConst("json"), " & j, ", ourQualifier, className, "& x)"], false, () => {
|
|
@@ -1023,12 +1013,12 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1023
1013
|
cppType = this.cppTypeInOptional(typeSet, {
|
|
1024
1014
|
needsForwardIndirection: false,
|
|
1025
1015
|
needsOptionalIndirection: false,
|
|
1026
|
-
inJsonNamespace:
|
|
1016
|
+
inJsonNamespace: false
|
|
1027
1017
|
}, false, true);
|
|
1028
1018
|
toType = this.cppTypeInOptional(typeSet, {
|
|
1029
1019
|
needsForwardIndirection: false,
|
|
1030
1020
|
needsOptionalIndirection: false,
|
|
1031
|
-
inJsonNamespace:
|
|
1021
|
+
inJsonNamespace: false
|
|
1032
1022
|
}, false, false);
|
|
1033
1023
|
this.emitLine(assignment.wrap([], [
|
|
1034
1024
|
this._stringType.wrapEncodingChange([ourQualifier], [optionalType, "<", cppType, ">"], [optionalType, "<", toType, ">"], [
|
|
@@ -1043,8 +1033,8 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1043
1033
|
return;
|
|
1044
1034
|
}
|
|
1045
1035
|
}
|
|
1046
|
-
cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace:
|
|
1047
|
-
toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace:
|
|
1036
|
+
cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: false }, false, true, p.isOptional);
|
|
1037
|
+
toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: false }, false, false, p.isOptional);
|
|
1048
1038
|
this.emitLine(assignment.wrap([], this._stringType.wrapEncodingChange([ourQualifier], cppType, toType, [
|
|
1049
1039
|
"j.at(",
|
|
1050
1040
|
this._stringType.wrapEncodingChange([ourQualifier], this._stringType.getType(), this.NarrowString.getType(), this._stringType.createStringLiteral([Strings_1.stringEscape(json)])),
|
|
@@ -1059,8 +1049,8 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1059
1049
|
this.emitLine("j = json::object();");
|
|
1060
1050
|
this.forEachClassProperty(c, "none", (name, json, p) => {
|
|
1061
1051
|
const t = p.type;
|
|
1062
|
-
cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace:
|
|
1063
|
-
toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace:
|
|
1052
|
+
cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: false }, false, false, p.isOptional);
|
|
1053
|
+
toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: false }, false, true, p.isOptional);
|
|
1064
1054
|
const [getterName, ,] = Support_1.defined(this._gettersAndSettersForPropertyName.get(name));
|
|
1065
1055
|
let getter;
|
|
1066
1056
|
if (this._options.codeFormat) {
|
|
@@ -1112,12 +1102,21 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1112
1102
|
this.emitLine("using ", unionName, " = ", this.variantType(u, false), ";");
|
|
1113
1103
|
}
|
|
1114
1104
|
emitUnionHeaders(u) {
|
|
1105
|
+
// Forward declarations for boost::variant<Ts...>. If none of the Ts were defined by us (e.g. if we have
|
|
1106
|
+
// boost::variant<int32_t, std::string>) then we need to specialize nlohmann::adl_serializer for our
|
|
1107
|
+
// variant type. If at least one of the Ts is our type then we could get away with regular adl definitions,
|
|
1108
|
+
// but it's nontrivial to detect that (consider variant<string, variant<map<string, string>, int>> which
|
|
1109
|
+
// does need an adl_serializer specialization) so we'll just specialize every time.
|
|
1115
1110
|
const nonNulls = TypeUtils_1.removeNullFromUnion(u, true)[1];
|
|
1116
1111
|
const variantType = this.cppTypeInOptional(nonNulls, { needsForwardIndirection: false, needsOptionalIndirection: false, inJsonNamespace: true }, false, false);
|
|
1117
|
-
this.emitLine("
|
|
1118
|
-
this.
|
|
1112
|
+
this.emitLine("template <>");
|
|
1113
|
+
this.emitBlock(["struct adl_serializer<", variantType, ">"], true, () => {
|
|
1114
|
+
this.emitLine("static void from_json(", this.withConst("json"), " & j, ", variantType, " & x);");
|
|
1115
|
+
this.emitLine("static void to_json(json & j, ", this.withConst(variantType), " & x);");
|
|
1116
|
+
});
|
|
1119
1117
|
}
|
|
1120
1118
|
emitUnionFunctions(u) {
|
|
1119
|
+
// Function definitions for boost::variant<Ts...>.
|
|
1121
1120
|
const ourQualifier = this.ourQualifier(true);
|
|
1122
1121
|
const functionForKind = [
|
|
1123
1122
|
["bool", "is_boolean"],
|
|
@@ -1131,7 +1130,7 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1131
1130
|
];
|
|
1132
1131
|
const nonNulls = TypeUtils_1.removeNullFromUnion(u, true)[1];
|
|
1133
1132
|
const variantType = this.cppTypeInOptional(nonNulls, { needsForwardIndirection: false, needsOptionalIndirection: false, inJsonNamespace: true }, false, false);
|
|
1134
|
-
this.emitBlock(["inline void from_json(", this.withConst("json"), " & j, ", variantType, " & x)"], false, () => {
|
|
1133
|
+
this.emitBlock(["inline void adl_serializer<", variantType, ">::from_json(", this.withConst("json"), " & j, ", variantType, " & x)"], false, () => {
|
|
1135
1134
|
let onFirst = true;
|
|
1136
1135
|
for (const [kind, func] of functionForKind) {
|
|
1137
1136
|
const typeForKind = collection_utils_1.iterableFind(nonNulls, t => t.kind === kind);
|
|
@@ -1152,7 +1151,7 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1152
1151
|
this.emitLine('else throw "Could not deserialize";');
|
|
1153
1152
|
});
|
|
1154
1153
|
this.ensureBlankLine();
|
|
1155
|
-
this.emitBlock(["inline void to_json(json & j, ", this.withConst(variantType), " & x)"], false, () => {
|
|
1154
|
+
this.emitBlock(["inline void adl_serializer<", variantType, ">::to_json(json & j, ", this.withConst(variantType), " & x)"], false, () => {
|
|
1156
1155
|
this.emitBlock(["switch (x.", this._variantIndexMethodName, "())"], false, () => {
|
|
1157
1156
|
let i = 0;
|
|
1158
1157
|
for (const t of nonNulls) {
|
|
@@ -1182,7 +1181,7 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1182
1181
|
});
|
|
1183
1182
|
}
|
|
1184
1183
|
emitEnumHeaders(enumName) {
|
|
1185
|
-
const ourQualifier = this.ourQualifier(
|
|
1184
|
+
const ourQualifier = this.ourQualifier(false);
|
|
1186
1185
|
this.emitLine("void from_json(", this.withConst("json"), " & j, ", ourQualifier, enumName, " & x);");
|
|
1187
1186
|
this.emitLine("void to_json(json & j, ", this.withConst([ourQualifier, enumName]), " & x);");
|
|
1188
1187
|
}
|
|
@@ -1192,7 +1191,7 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1192
1191
|
return e.cases.size > 15;
|
|
1193
1192
|
}
|
|
1194
1193
|
emitEnumFunctions(e, enumName) {
|
|
1195
|
-
const ourQualifier = this.ourQualifier(
|
|
1194
|
+
const ourQualifier = this.ourQualifier(false);
|
|
1196
1195
|
this.emitBlock(["inline void from_json(", this.withConst("json"), " & j, ", ourQualifier, enumName, " & x)"], false, () => {
|
|
1197
1196
|
if (this.isLargeEnum(e)) {
|
|
1198
1197
|
this.emitBlock([
|
|
@@ -1236,7 +1235,7 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1236
1235
|
this.emitLine("using ", name, " = ", this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: false }, true, false, false), ";");
|
|
1237
1236
|
}
|
|
1238
1237
|
emitAllUnionFunctions() {
|
|
1239
|
-
this.forEachUniqueUnion("interposing", u => this.sourcelikeToString(this.cppTypeInOptional(TypeUtils_1.removeNullFromUnion(u, true)[1], { needsForwardIndirection: false, needsOptionalIndirection: false, inJsonNamespace: true }, false, false)), (u) => this.emitUnionFunctions(u));
|
|
1238
|
+
this.forEachUniqueUnion("leading-and-interposing", u => this.sourcelikeToString(this.cppTypeInOptional(TypeUtils_1.removeNullFromUnion(u, true)[1], { needsForwardIndirection: false, needsOptionalIndirection: false, inJsonNamespace: true }, false, false)), (u) => this.emitUnionFunctions(u));
|
|
1240
1239
|
}
|
|
1241
1240
|
emitAllUnionHeaders() {
|
|
1242
1241
|
this.forEachUniqueUnion("interposing", u => this.sourcelikeToString(this.cppTypeInOptional(TypeUtils_1.removeNullFromUnion(u, true)[1], { needsForwardIndirection: false, needsOptionalIndirection: false, inJsonNamespace: true }, false, false)), (u) => this.emitUnionHeaders(u));
|
|
@@ -1421,9 +1420,9 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1421
1420
|
this.ensureBlankLine();
|
|
1422
1421
|
}
|
|
1423
1422
|
this.ensureBlankLine();
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
this._namespaceNames.forEach(
|
|
1423
|
+
let untypedMacroName = "NLOHMANN_UNTYPED_";
|
|
1424
|
+
let optionalMacroName = "NLOHMANN_OPTIONAL_";
|
|
1425
|
+
this._namespaceNames.forEach(value => {
|
|
1427
1426
|
// We can't use upper name, because namespaces are case sensitive
|
|
1428
1427
|
untypedMacroName += value;
|
|
1429
1428
|
untypedMacroName += "_";
|
|
@@ -1523,35 +1522,68 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
1523
1522
|
return;
|
|
1524
1523
|
this.forEachTopLevel("leading", (t, name) => this.emitTopLevelTypedef(t, name), t => this.namedTypeToNameForTopLevel(t) === undefined);
|
|
1525
1524
|
}
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
})
|
|
1531
|
-
|
|
1532
|
-
|
|
1525
|
+
gatherUserNamespaceForwardDecls() {
|
|
1526
|
+
return this.gatherSource(() => {
|
|
1527
|
+
this.forEachObject("leading-and-interposing", (_, className) => this.emitClassHeaders(className));
|
|
1528
|
+
this.forEachEnum("leading-and-interposing", (_, enumName) => this.emitEnumHeaders(enumName));
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
gatherNlohmannNamespaceForwardDecls() {
|
|
1532
|
+
return this.gatherSource(() => {
|
|
1533
|
+
this.forEachTopLevel("leading-and-interposing", (t, className) => this.emitTopLevelHeaders(t, className));
|
|
1533
1534
|
this.ensureBlankLine();
|
|
1535
|
+
this.emitAllUnionHeaders();
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
emitUserNamespaceImpls() {
|
|
1539
|
+
this.forEachObject("leading-and-interposing", (c, className) => this.emitClassFunctions(c, className));
|
|
1540
|
+
this.forEachEnum("leading-and-interposing", (e, enumName) => this.emitEnumFunctions(e, enumName));
|
|
1541
|
+
}
|
|
1542
|
+
emitNlohmannNamespaceImpls() {
|
|
1543
|
+
this.forEachTopLevel("leading-and-interposing", (t, name) => this.emitTopLevelFunction(t, name), t => this.namedTypeToNameForTopLevel(t) === undefined);
|
|
1544
|
+
this.ensureBlankLine();
|
|
1545
|
+
this.emitAllUnionFunctions();
|
|
1546
|
+
}
|
|
1547
|
+
emitGenerators() {
|
|
1548
|
+
if (this._options.justTypes) {
|
|
1549
|
+
let didEmit = false;
|
|
1550
|
+
const gathered = this.gatherSource(() => this.emitNamespaces(this._namespaceNames, () => {
|
|
1551
|
+
didEmit = this.forEachTopLevel("none", (t, name) => this.emitTopLevelTypedef(t, name), t => this.namedTypeToNameForTopLevel(t) === undefined);
|
|
1552
|
+
}));
|
|
1553
|
+
if (didEmit) {
|
|
1554
|
+
this.emitGatheredSource(gathered);
|
|
1555
|
+
this.ensureBlankLine();
|
|
1556
|
+
}
|
|
1534
1557
|
}
|
|
1535
|
-
|
|
1536
|
-
let
|
|
1537
|
-
|
|
1538
|
-
|
|
1558
|
+
else {
|
|
1559
|
+
let userNamespaceForwardDecls = this.gatherUserNamespaceForwardDecls();
|
|
1560
|
+
let nlohmannNamespaceForwardDecls = this.gatherNlohmannNamespaceForwardDecls();
|
|
1561
|
+
if (userNamespaceForwardDecls.length == 0 && nlohmannNamespaceForwardDecls.length > 0) {
|
|
1562
|
+
this.emitNamespaces(["nlohmann"], () => {
|
|
1563
|
+
this.emitGatheredSource(nlohmannNamespaceForwardDecls);
|
|
1564
|
+
this.emitNlohmannNamespaceImpls();
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
else if (userNamespaceForwardDecls.length > 0 && nlohmannNamespaceForwardDecls.length == 0) {
|
|
1568
|
+
this.emitNamespaces(this._namespaceNames, () => {
|
|
1569
|
+
this.emitGatheredSource(userNamespaceForwardDecls);
|
|
1570
|
+
this.emitUserNamespaceImpls();
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
else if (userNamespaceForwardDecls.length > 0 && nlohmannNamespaceForwardDecls.length > 0) {
|
|
1574
|
+
this.emitNamespaces(this._namespaceNames, () => {
|
|
1575
|
+
this.emitGatheredSource(userNamespaceForwardDecls);
|
|
1576
|
+
});
|
|
1577
|
+
this.emitNamespaces(["nlohmann"], () => {
|
|
1578
|
+
this.emitGatheredSource(nlohmannNamespaceForwardDecls);
|
|
1579
|
+
});
|
|
1580
|
+
this.emitNamespaces(this._namespaceNames, () => {
|
|
1581
|
+
this.emitUserNamespaceImpls();
|
|
1582
|
+
});
|
|
1583
|
+
this.emitNamespaces(["nlohmann"], () => {
|
|
1584
|
+
this.emitNlohmannNamespaceImpls();
|
|
1585
|
+
});
|
|
1539
1586
|
}
|
|
1540
|
-
this.emitNamespaces(namespaces, () => {
|
|
1541
|
-
this.forEachObject("leading-and-interposing", (_, className) => this.emitClassHeaders(className));
|
|
1542
|
-
this.forEachTopLevel("leading-and-interposing", (t, className) => this.emitTopLevelHeaders(t, className));
|
|
1543
|
-
this.forEachEnum("leading-and-interposing", (_, enumName) => this.emitEnumHeaders(enumName));
|
|
1544
|
-
if (this.haveUnions) {
|
|
1545
|
-
this.emitAllUnionHeaders();
|
|
1546
|
-
}
|
|
1547
|
-
this.ensureBlankLine();
|
|
1548
|
-
this.forEachObject("leading-and-interposing", (c, className) => this.emitClassFunctions(c, className));
|
|
1549
|
-
this.forEachEnum("leading-and-interposing", (e, enumName) => this.emitEnumFunctions(e, enumName));
|
|
1550
|
-
if (this.haveUnions) {
|
|
1551
|
-
this.emitAllUnionFunctions();
|
|
1552
|
-
}
|
|
1553
|
-
this.forEachTopLevel("leading-and-interposing", (t, name) => this.emitTopLevelFunction(t, name), t => this.namedTypeToNameForTopLevel(t) === undefined);
|
|
1554
|
-
});
|
|
1555
1587
|
}
|
|
1556
1588
|
}
|
|
1557
1589
|
emitSingleSourceStructure(proposedFilename) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quicktype-core",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.36",
|
|
4
4
|
"description": "The quicktype engine as a library",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"fs": false
|
|
46
46
|
},
|
|
47
47
|
"config": {
|
|
48
|
-
"commit": "
|
|
48
|
+
"commit": "05dad2ee30fb9db7ef5a26db39e57299445c6dc8"
|
|
49
49
|
}
|
|
50
50
|
}
|