From cd269d78932a37680a9b8a1816c2d49ce2aab386 Mon Sep 17 00:00:00 2001 From: Crayon Date: Sat, 29 Jun 2024 15:40:01 -0400 Subject: [PATCH 1/3] Fix typos --- .../src/language/CPlusPlus/CPlusPlusRenderer.ts | 4 ++-- packages/quicktype-core/src/rewrites/ExpandStrings.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts b/packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts index 4b70339f2..f48288ada 100644 --- a/packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts +++ b/packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts @@ -198,7 +198,7 @@ export class CPlusPlusRenderer extends ConvenienceRenderer { // }; // // checking to see if the collapse of the variant has - // occured and then doing the isCycleBreakerType check + // occurred and then doing the isCycleBreakerType check // on the single type the variant would contain seems // to solve the problem. But does this point to a problem // with the core library or with the CPlusPlus package @@ -916,7 +916,7 @@ export class CPlusPlusRenderer extends ConvenienceRenderer { if (constraints === undefined) return; const { minMax, minMaxLength, pattern } = constraints; - // TODO is there a better way to check if property.type is an interger or a number? + // TODO is there a better way to check if property.type is an integer or a number? const cppType = this.cppType( property.type, { diff --git a/packages/quicktype-core/src/rewrites/ExpandStrings.ts b/packages/quicktype-core/src/rewrites/ExpandStrings.ts index abddcfab5..f8a86385a 100644 --- a/packages/quicktype-core/src/rewrites/ExpandStrings.ts +++ b/packages/quicktype-core/src/rewrites/ExpandStrings.ts @@ -173,7 +173,7 @@ export function expandStrings(ctx: RunContext, graph: TypeGraph, inference: Enum const transformations = mappedStringTypes.transformations; // FIXME: This is probably wrong, or at least overly conservative. This is for the case // where some attributes are identity ones, i.e. where we can't merge the primitive types, - // like it happens in the line after the `if`. The case where this occured was with URI + // like it happens in the line after the `if`. The case where this occurred was with URI // attributes: we had two separate string types with different URI attributes, but because // both are rewritten via `getPrimitiveType` below without any attributes, they end up // being the same string type. From 70ec32886e2e3250c37fd71ca679eb62fbd4b5a4 Mon Sep 17 00:00:00 2001 From: Crayon Date: Sat, 29 Jun 2024 16:23:04 -0400 Subject: [PATCH 2/3] Fix text in C++ default statement --- .../src/language/CPlusPlus/CPlusPlusRenderer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts b/packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts index f48288ada..e9694d857 100644 --- a/packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts +++ b/packages/quicktype-core/src/language/CPlusPlus/CPlusPlusRenderer.ts @@ -1627,7 +1627,9 @@ export class CPlusPlusRenderer extends ConvenienceRenderer { ); }); this.emitLine( - `default: throw std::runtime_error("Unexpected value in enumeration \\"${enumName}\\": " + std::to_string(static_cast(x)));` + `default: throw std::runtime_error("Unexpected value in enumeration \\"`, + enumName, + `\\": " + std::to_string(static_cast(x)));` ); }); } From 807a4def33703adeedb6d144f0f11167226f597a Mon Sep 17 00:00:00 2001 From: Crayon Date: Wed, 3 Jul 2024 02:33:48 -0400 Subject: [PATCH 3/3] Remove whitespace characters in cpp file --- test/fixtures/cplusplus/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fixtures/cplusplus/main.cpp b/test/fixtures/cplusplus/main.cpp index 3052e3c21..d963530b5 100644 --- a/test/fixtures/cplusplus/main.cpp +++ b/test/fixtures/cplusplus/main.cpp @@ -14,14 +14,14 @@ int main(int argc, const char * argv[]) { std::cerr << "Usage: " << argv[0] << " FILE"; return 1; } - + std::ifstream t(argv[1]); std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); TopLevel tl = json::parse(str); json j2 = tl; - + std::cout << j2 << std::endl; return 0;