UNPKG

diffusion

Version:

Diffusion JavaScript client

63 lines (62 loc) 2.53 kB
"use strict"; /** * @module Services */ 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.ErrorReportSerialiser = exports.ErrorReportSerialiserClass = void 0; var Codec = require("./../io/codec"); var serialiser_1 = require("./../serialisers/serialiser"); var error_report_1 = require("./../services/error-report"); /** * Serialiser for {@link ErrorReport} */ var ErrorReportSerialiserClass = /** @class */ (function (_super) { __extends(ErrorReportSerialiserClass, _super); function ErrorReportSerialiserClass() { return _super !== null && _super.apply(this, arguments) || this; } /** * Read an error report from the stream * * @param bis the input stream * @return the error report that was read */ ErrorReportSerialiserClass.prototype.read = function (input) { var message = Codec.readString(input); var line = Codec.readInt32(input); var column = Codec.readInt32(input); return new error_report_1.ErrorReportImpl(message, line, column); }; /** * Write an error report to the stream * * @param bis the input stream * @param value the error report to be written */ ErrorReportSerialiserClass.prototype.write = function (output, value) { Codec.writeString(output, value.message); Codec.writeInt32(output, value.line); Codec.writeInt32(output, value.column); }; return ErrorReportSerialiserClass; }(serialiser_1.AbstractSerialiser)); exports.ErrorReportSerialiserClass = ErrorReportSerialiserClass; /** * The {@link ErrorReportSerialiser} singleton */ // eslint-disable-next-line @typescript-eslint/naming-convention exports.ErrorReportSerialiser = new ErrorReportSerialiserClass();