quicktype-core 23.3.5 → 23.3.6

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.
@@ -732,11 +732,8 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
732
732
  * a member called 'value' value = value will screw up the compiler
733
733
  */
734
734
  const checkConst = this.lookupGlobalName(utils_1.GlobalNames.CheckConstraint);
735
- if ((property.type instanceof Type_1.UnionType &&
736
- property.type.findMember("null") !== undefined) ||
737
- (property.isOptional &&
738
- property.type.kind !== "null" &&
739
- property.type.kind !== "any")) {
735
+ if (property.type instanceof Type_1.UnionType &&
736
+ property.type.findMember("null") !== undefined) {
740
737
  this.emitLine(rendered, " ", getterName, "() const { return ", name, "; }");
741
738
  if (constraints === null || constraints === void 0 ? void 0 : constraints.has(jsonName)) {
742
739
  this.emitLine("void ", setterName, "(", rendered, " value) { if (value) ", checkConst, "(", this._stringType.createStringLiteral([name]), ", ", this.constraintMember(jsonName), ", *value); this->", name, " = value; }");
@@ -1416,6 +1413,24 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
1416
1413
  this.ensureBlankLine();
1417
1414
  });
1418
1415
  this.ensureBlankLine();
1416
+ this.emitBlock([
1417
+ "inline void ",
1418
+ checkConst,
1419
+ "(",
1420
+ this._stringType.getConstType(),
1421
+ " name, ",
1422
+ this.withConst(classConstraint),
1423
+ " & c, const ",
1424
+ this._optionalType,
1425
+ "<",
1426
+ cppType,
1427
+ "> & value)",
1428
+ ], false, () => {
1429
+ this.emitBlock(["if (value)"], false, () => {
1430
+ this.emitLine(checkConst, "(name, c, *value);");
1431
+ });
1432
+ });
1433
+ this.ensureBlankLine();
1419
1434
  }
1420
1435
  emitConstraintClasses() {
1421
1436
  const ourQualifier = this.ourQualifier(false);
@@ -1537,6 +1552,24 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
1537
1552
  });
1538
1553
  this.ensureBlankLine();
1539
1554
  });
1555
+ this.ensureBlankLine();
1556
+ this.emitBlock([
1557
+ "inline void ",
1558
+ checkConst,
1559
+ "(",
1560
+ this._stringType.getConstType(),
1561
+ " name, ",
1562
+ this.withConst(classConstraint),
1563
+ " & c, const ",
1564
+ this._optionalType,
1565
+ "<",
1566
+ this._stringType.getType(),
1567
+ "> & value)",
1568
+ ], false, () => {
1569
+ this.emitBlock(["if (value)"], false, () => {
1570
+ this.emitLine(checkConst, "(name, c, *value);");
1571
+ });
1572
+ });
1540
1573
  }
1541
1574
  emitHelperFunctions() {
1542
1575
  this._stringType.emitHelperFunctions();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "23.3.5",
3
+ "version": "23.3.6",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",