UNPKG

diffusion

Version:

Diffusion JavaScript client

62 lines (61 loc) 2.83 kB
"use strict"; /** * @module Services.Send */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.CountOrParserErrorsSerialiser = exports.CountOrParserErrorsSerialiserClass = void 0; var Codec = require("./../io/codec"); var serialiser_1 = require("./../serialisers/serialiser"); var count_or_parser_errors_1 = require("./../services/count-or-parser-errors"); var error_report_serialiser_1 = require("./../services/error-report-serialiser"); /** * Serialiser for {@link CountOrParserErrors}. */ var CountOrParserErrorsSerialiserClass = /** @class */ (function (_super) { __extends(CountOrParserErrorsSerialiserClass, _super); function CountOrParserErrorsSerialiserClass() { return _super !== null && _super.apply(this, arguments) || this; } /** * Read a {@link CountOrParserErrors} from the stream * * @param bis the input stream * @return the {@link CountOrParserErrors} that was read */ CountOrParserErrorsSerialiserClass.prototype.read = function (bis) { var count = Codec.readInt32(bis); var errors = Codec.readCollection(bis, error_report_serialiser_1.ErrorReportSerialiser.read); return new count_or_parser_errors_1.CountOrParserErrors(count, errors); }; /** * Write a {@link CountOrParserErrors} to the stream * * @param bos the output stream * @param value the {@link CountOrParserErrors} to be written */ CountOrParserErrorsSerialiserClass.prototype.write = function (bos, value) { Codec.writeInt32(bos, value.count); Codec.writeCollection(bos, value.errors, error_report_serialiser_1.ErrorReportSerialiser.write); }; return CountOrParserErrorsSerialiserClass; }(serialiser_1.AbstractSerialiser)); exports.CountOrParserErrorsSerialiserClass = CountOrParserErrorsSerialiserClass; /** * The {@link CountOrParserErrorsSerialiser} singleton */ // eslint-disable-next-line @typescript-eslint/naming-convention exports.CountOrParserErrorsSerialiser = new CountOrParserErrorsSerialiserClass();