Created
February 5, 2018 14:42
-
-
Save gavbaa/c53caa63863a322041f67182c5ae6e98 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*eslint-disable block-scoped-var, no-redeclare, no-control-regex, no-prototype-builtins*/ | |
| "use strict"; | |
| var $protobuf = require("protobufjs/minimal"); | |
| // Common aliases | |
| var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; | |
| // Exported root namespace | |
| var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); | |
| $root.CourseDisplay = (function() { | |
| /** | |
| * Properties of a CourseDisplay. | |
| * @exports ICourseDisplay | |
| * @interface ICourseDisplay | |
| * @property {string|null} [title] CourseDisplay title | |
| * @property {number|null} [width] CourseDisplay width | |
| */ | |
| /** | |
| * Constructs a new CourseDisplay. | |
| * @exports CourseDisplay | |
| * @classdesc Represents a CourseDisplay. | |
| * @implements ICourseDisplay | |
| * @constructor | |
| * @param {ICourseDisplay=} [properties] Properties to set | |
| */ | |
| function CourseDisplay(properties) { | |
| if (properties) | |
| for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) | |
| if (properties[keys[i]] != null) | |
| this[keys[i]] = properties[keys[i]]; | |
| } | |
| /** | |
| * CourseDisplay title. | |
| * @member {string} title | |
| * @memberof CourseDisplay | |
| * @instance | |
| */ | |
| CourseDisplay.prototype.title = ""; | |
| /** | |
| * CourseDisplay width. | |
| * @member {number} width | |
| * @memberof CourseDisplay | |
| * @instance | |
| */ | |
| CourseDisplay.prototype.width = 0; | |
| // OneOf field names bound to virtual getters and setters | |
| var $oneOfFields; | |
| /** | |
| * CourseDisplay widthContainer. | |
| * @member {"width"|undefined} widthContainer | |
| * @memberof CourseDisplay | |
| * @instance | |
| */ | |
| Object.defineProperty(CourseDisplay.prototype, "widthContainer", { | |
| get: $util.oneOfGetter($oneOfFields = ["width"]), | |
| set: $util.oneOfSetter($oneOfFields) | |
| }); | |
| /** | |
| * Creates a new CourseDisplay instance using the specified properties. | |
| * @function create | |
| * @memberof CourseDisplay | |
| * @static | |
| * @param {ICourseDisplay=} [properties] Properties to set | |
| * @returns {CourseDisplay} CourseDisplay instance | |
| */ | |
| CourseDisplay.create = function create(properties) { | |
| return new CourseDisplay(properties); | |
| }; | |
| /** | |
| * Encodes the specified CourseDisplay message. Does not implicitly {@link CourseDisplay.verify|verify} messages. | |
| * @function encode | |
| * @memberof CourseDisplay | |
| * @static | |
| * @param {ICourseDisplay} message CourseDisplay message or plain object to encode | |
| * @param {$protobuf.Writer} [writer] Writer to encode to | |
| * @returns {$protobuf.Writer} Writer | |
| */ | |
| CourseDisplay.encode = function encode(message, writer) { | |
| if (!writer) | |
| writer = $Writer.create(); | |
| if (message.title != null && message.hasOwnProperty("title")) | |
| writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); | |
| if (message.width != null && message.hasOwnProperty("width")) | |
| writer.uint32(/* id 2, wireType 0 =*/16).int32(message.width); | |
| return writer; | |
| }; | |
| /** | |
| * Encodes the specified CourseDisplay message, length delimited. Does not implicitly {@link CourseDisplay.verify|verify} messages. | |
| * @function encodeDelimited | |
| * @memberof CourseDisplay | |
| * @static | |
| * @param {ICourseDisplay} message CourseDisplay message or plain object to encode | |
| * @param {$protobuf.Writer} [writer] Writer to encode to | |
| * @returns {$protobuf.Writer} Writer | |
| */ | |
| CourseDisplay.encodeDelimited = function encodeDelimited(message, writer) { | |
| return this.encode(message, writer).ldelim(); | |
| }; | |
| /** | |
| * Decodes a CourseDisplay message from the specified reader or buffer. | |
| * @function decode | |
| * @memberof CourseDisplay | |
| * @static | |
| * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | |
| * @param {number} [length] Message length if known beforehand | |
| * @returns {CourseDisplay} CourseDisplay | |
| * @throws {Error} If the payload is not a reader or valid buffer | |
| * @throws {$protobuf.util.ProtocolError} If required fields are missing | |
| */ | |
| CourseDisplay.decode = function decode(reader, length) { | |
| if (!(reader instanceof $Reader)) | |
| reader = $Reader.create(reader); | |
| var end = length === undefined ? reader.len : reader.pos + length, message = new $root.CourseDisplay(); | |
| while (reader.pos < end) { | |
| var tag = reader.uint32(); | |
| switch (tag >>> 3) { | |
| case 1: | |
| message.title = reader.string(); | |
| break; | |
| case 2: | |
| message.width = reader.int32(); | |
| break; | |
| default: | |
| reader.skipType(tag & 7); | |
| break; | |
| } | |
| } | |
| return message; | |
| }; | |
| /** | |
| * Decodes a CourseDisplay message from the specified reader or buffer, length delimited. | |
| * @function decodeDelimited | |
| * @memberof CourseDisplay | |
| * @static | |
| * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from | |
| * @returns {CourseDisplay} CourseDisplay | |
| * @throws {Error} If the payload is not a reader or valid buffer | |
| * @throws {$protobuf.util.ProtocolError} If required fields are missing | |
| */ | |
| CourseDisplay.decodeDelimited = function decodeDelimited(reader) { | |
| if (!(reader instanceof $Reader)) | |
| reader = new $Reader(reader); | |
| return this.decode(reader, reader.uint32()); | |
| }; | |
| /** | |
| * Verifies a CourseDisplay message. | |
| * @function verify | |
| * @memberof CourseDisplay | |
| * @static | |
| * @param {Object.<string,*>} message Plain object to verify | |
| * @returns {string|null} `null` if valid, otherwise the reason why it is not | |
| */ | |
| CourseDisplay.verify = function verify(message) { | |
| if (typeof message !== "object" || message === null) | |
| return "object expected"; | |
| var properties = {}; | |
| if (message.title != null && message.hasOwnProperty("title")) | |
| if (!$util.isString(message.title)) | |
| return "title: string expected"; | |
| if (message.width != null && message.hasOwnProperty("width")) { | |
| properties.widthContainer = 1; | |
| if (!$util.isInteger(message.width)) | |
| return "width: integer expected"; | |
| } | |
| return null; | |
| }; | |
| /** | |
| * Creates a CourseDisplay message from a plain object. Also converts values to their respective internal types. | |
| * @function fromObject | |
| * @memberof CourseDisplay | |
| * @static | |
| * @param {Object.<string,*>} object Plain object | |
| * @returns {CourseDisplay} CourseDisplay | |
| */ | |
| CourseDisplay.fromObject = function fromObject(object) { | |
| if (object instanceof $root.CourseDisplay) | |
| return object; | |
| var message = new $root.CourseDisplay(); | |
| if (object.title != null) | |
| message.title = String(object.title); | |
| if (object.width != null) | |
| message.width = object.width | 0; | |
| return message; | |
| }; | |
| /** | |
| * Creates a plain object from a CourseDisplay message. Also converts values to other types if specified. | |
| * @function toObject | |
| * @memberof CourseDisplay | |
| * @static | |
| * @param {CourseDisplay} message CourseDisplay | |
| * @param {$protobuf.IConversionOptions} [options] Conversion options | |
| * @returns {Object.<string,*>} Plain object | |
| */ | |
| CourseDisplay.toObject = function toObject(message, options) { | |
| if (!options) | |
| options = {}; | |
| var object = {}; | |
| if (options.defaults) | |
| object.title = ""; | |
| if (message.title != null && message.hasOwnProperty("title")) | |
| object.title = message.title; | |
| if (message.width != null && message.hasOwnProperty("width")) { | |
| object.width = message.width; | |
| if (options.oneofs) | |
| object.widthContainer = "width"; | |
| } | |
| return object; | |
| }; | |
| /** | |
| * Converts this CourseDisplay to JSON. | |
| * @function toJSON | |
| * @memberof CourseDisplay | |
| * @instance | |
| * @returns {Object.<string,*>} JSON object | |
| */ | |
| CourseDisplay.prototype.toJSON = function toJSON() { | |
| return this.constructor.toObject(this, $protobuf.util.toJSONOptions); | |
| }; | |
| return CourseDisplay; | |
| })(); | |
| module.exports = $root; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment