|
| 1 | +"use strict"; // eslint-disable-line strict |
| 2 | + |
| 3 | +var $protobuf = require("../../runtime"); |
| 4 | + |
| 5 | +// Lazily resolved type references |
| 6 | +var $lazyTypes = []; |
| 7 | + |
| 8 | +// Exported root namespace |
| 9 | +var $root = {}; |
| 10 | + |
| 11 | +/** @alias A */ |
| 12 | +$root.A = (function() { |
| 13 | + |
| 14 | + /** |
| 15 | + * Constructs a new A. |
| 16 | + * @exports A |
| 17 | + * @constructor |
| 18 | + * @param {Object} [properties] Properties to set |
| 19 | + */ |
| 20 | + function A(properties) { |
| 21 | + if (properties) { |
| 22 | + var keys = Object.keys(properties); |
| 23 | + for (var i = 0; i < keys.length; ++i) |
| 24 | + this[keys[i]] = properties[keys[i]]; |
| 25 | + } |
| 26 | + } |
| 27 | + |
| 28 | + /** @alias A.prototype */ |
| 29 | + var $prototype = A.prototype; |
| 30 | + |
| 31 | + /** |
| 32 | + * A whatever. |
| 33 | + * @name A#whatever |
| 34 | + * @type {string} |
| 35 | + */ |
| 36 | + $prototype["whatever"] = ""; |
| 37 | + |
| 38 | + /** |
| 39 | + * Encodes the specified A. |
| 40 | + * @function |
| 41 | + * @param {A|Object} message A or plain object to encode |
| 42 | + * @param {Writer} [writer] Writer to encode to |
| 43 | + * @returns {Writer} Writer |
| 44 | + */ |
| 45 | + A.encode = (function() { |
| 46 | + /* eslint-disable */ |
| 47 | + var Writer = $protobuf.Writer; |
| 48 | + var util = $protobuf.util; |
| 49 | + var types; $lazyTypes.push(types = [null]); |
| 50 | + return function encode(m, w) { |
| 51 | + w||(w=Writer.create()) |
| 52 | + if(m["whatever"]!==undefined&&m["whatever"]!=="") |
| 53 | + w.uint32(10).string(m["whatever"]) |
| 54 | + return w |
| 55 | + } |
| 56 | + /* eslint-enable */ |
| 57 | + })(); |
| 58 | + |
| 59 | + /** |
| 60 | + * Encodes the specified A, length delimited. |
| 61 | + * @param {A|Object} message A or plain object to encode |
| 62 | + * @param {Writer} [writer] Writer to encode to |
| 63 | + * @returns {Writer} Writer |
| 64 | + */ |
| 65 | + A.encodeDelimited = function encodeDelimited(message, writer) { |
| 66 | + return this.encode(message, writer).ldelim(); |
| 67 | + }; |
| 68 | + |
| 69 | + /** |
| 70 | + * Decodes a A from the specified reader or buffer. |
| 71 | + * @function |
| 72 | + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from |
| 73 | + * @param {number} [length] Message length if known beforehand |
| 74 | + * @returns {A} A |
| 75 | + */ |
| 76 | + A.decode = (function() { |
| 77 | + /* eslint-disable */ |
| 78 | + var Reader = $protobuf.Reader; |
| 79 | + var util = $protobuf.util; |
| 80 | + var types; $lazyTypes.push(types = [null]); |
| 81 | + return function decode(r, l) { |
| 82 | + r instanceof Reader||(r=Reader.create(r)) |
| 83 | + var c=l===undefined?r.len:r.pos+l,m=new $root.A |
| 84 | + while(r.pos<c){ |
| 85 | + var t=r.int32() |
| 86 | + switch(t>>>3){ |
| 87 | + case 1: |
| 88 | + m["whatever"]=r.string() |
| 89 | + break |
| 90 | + default: |
| 91 | + r.skipType(t&7) |
| 92 | + break |
| 93 | + } |
| 94 | + } |
| 95 | + return m |
| 96 | + } |
| 97 | + /* eslint-enable */ |
| 98 | + })(); |
| 99 | + |
| 100 | + /** |
| 101 | + * Decodes a A from the specified reader or buffer, length delimited. |
| 102 | + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from |
| 103 | + * @returns {A} A |
| 104 | + */ |
| 105 | + A.decodeDelimited = function decodeDelimited(readerOrBuffer) { |
| 106 | + readerOrBuffer = readerOrBuffer instanceof $protobuf.Reader ? readerOrBuffer : $protobuf.Reader(readerOrBuffer); |
| 107 | + return this.decode(readerOrBuffer, readerOrBuffer.uint32()); |
| 108 | + }; |
| 109 | + |
| 110 | + /** |
| 111 | + * Verifies a A. |
| 112 | + * @function |
| 113 | + * @param {A|Object} message A or plain object to verify |
| 114 | + * @returns {?string} `null` if valid, otherwise the reason why it is not |
| 115 | + */ |
| 116 | + A.verify = (function() { |
| 117 | + /* eslint-disable */ |
| 118 | + var util = $protobuf.util; |
| 119 | + var types; $lazyTypes.push(types = [null]); |
| 120 | + return function verify(m) { |
| 121 | + if(m["whatever"]!==undefined){ |
| 122 | + if(!util.isString(m["whatever"])) |
| 123 | + return"invalid value for field .A.whatever (string expected)" |
| 124 | + } |
| 125 | + return null |
| 126 | + } |
| 127 | + /* eslint-enable */ |
| 128 | + })(); |
| 129 | + |
| 130 | + return A; |
| 131 | +})(); |
| 132 | + |
| 133 | +/** @alias B */ |
| 134 | +$root.B = (function() { |
| 135 | + |
| 136 | + /** |
| 137 | + * Constructs a new B. |
| 138 | + * @exports B |
| 139 | + * @constructor |
| 140 | + * @param {Object} [properties] Properties to set |
| 141 | + */ |
| 142 | + function B(properties) { |
| 143 | + if (properties) { |
| 144 | + var keys = Object.keys(properties); |
| 145 | + for (var i = 0; i < keys.length; ++i) |
| 146 | + this[keys[i]] = properties[keys[i]]; |
| 147 | + } |
| 148 | + } |
| 149 | + |
| 150 | + /** @alias B.prototype */ |
| 151 | + var $prototype = B.prototype; |
| 152 | + |
| 153 | + /** |
| 154 | + * B A. |
| 155 | + * @name B#A |
| 156 | + * @type {A} |
| 157 | + */ |
| 158 | + $prototype["A"] = null; |
| 159 | + |
| 160 | + /** |
| 161 | + * Encodes the specified B. |
| 162 | + * @function |
| 163 | + * @param {B|Object} message B or plain object to encode |
| 164 | + * @param {Writer} [writer] Writer to encode to |
| 165 | + * @returns {Writer} Writer |
| 166 | + */ |
| 167 | + B.encode = (function() { |
| 168 | + /* eslint-disable */ |
| 169 | + var Writer = $protobuf.Writer; |
| 170 | + var util = $protobuf.util; |
| 171 | + var types; $lazyTypes.push(types = ["A"]); |
| 172 | + return function encode(m, w) { |
| 173 | + w||(w=Writer.create()) |
| 174 | + if(m["A"]!==undefined&&m["A"]!==null) |
| 175 | + types[0].encode(m["A"],w.fork()).len&&w.ldelim(1)||w.reset() |
| 176 | + return w |
| 177 | + } |
| 178 | + /* eslint-enable */ |
| 179 | + })(); |
| 180 | + |
| 181 | + /** |
| 182 | + * Encodes the specified B, length delimited. |
| 183 | + * @param {B|Object} message B or plain object to encode |
| 184 | + * @param {Writer} [writer] Writer to encode to |
| 185 | + * @returns {Writer} Writer |
| 186 | + */ |
| 187 | + B.encodeDelimited = function encodeDelimited(message, writer) { |
| 188 | + return this.encode(message, writer).ldelim(); |
| 189 | + }; |
| 190 | + |
| 191 | + /** |
| 192 | + * Decodes a B from the specified reader or buffer. |
| 193 | + * @function |
| 194 | + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from |
| 195 | + * @param {number} [length] Message length if known beforehand |
| 196 | + * @returns {B} B |
| 197 | + */ |
| 198 | + B.decode = (function() { |
| 199 | + /* eslint-disable */ |
| 200 | + var Reader = $protobuf.Reader; |
| 201 | + var util = $protobuf.util; |
| 202 | + var types; $lazyTypes.push(types = ["A"]); |
| 203 | + return function decode(r, l) { |
| 204 | + r instanceof Reader||(r=Reader.create(r)) |
| 205 | + var c=l===undefined?r.len:r.pos+l,m=new $root.B |
| 206 | + while(r.pos<c){ |
| 207 | + var t=r.int32() |
| 208 | + switch(t>>>3){ |
| 209 | + case 1: |
| 210 | + m["A"]=types[0].decode(r,r.uint32()) |
| 211 | + break |
| 212 | + default: |
| 213 | + r.skipType(t&7) |
| 214 | + break |
| 215 | + } |
| 216 | + } |
| 217 | + return m |
| 218 | + } |
| 219 | + /* eslint-enable */ |
| 220 | + })(); |
| 221 | + |
| 222 | + /** |
| 223 | + * Decodes a B from the specified reader or buffer, length delimited. |
| 224 | + * @param {Reader|Uint8Array} readerOrBuffer Reader or buffer to decode from |
| 225 | + * @returns {B} B |
| 226 | + */ |
| 227 | + B.decodeDelimited = function decodeDelimited(readerOrBuffer) { |
| 228 | + readerOrBuffer = readerOrBuffer instanceof $protobuf.Reader ? readerOrBuffer : $protobuf.Reader(readerOrBuffer); |
| 229 | + return this.decode(readerOrBuffer, readerOrBuffer.uint32()); |
| 230 | + }; |
| 231 | + |
| 232 | + /** |
| 233 | + * Verifies a B. |
| 234 | + * @function |
| 235 | + * @param {B|Object} message B or plain object to verify |
| 236 | + * @returns {?string} `null` if valid, otherwise the reason why it is not |
| 237 | + */ |
| 238 | + B.verify = (function() { |
| 239 | + /* eslint-disable */ |
| 240 | + var util = $protobuf.util; |
| 241 | + var types; $lazyTypes.push(types = ["A"]); |
| 242 | + return function verify(m) { |
| 243 | + if(m["A"]!==undefined&&m["A"]!==null){ |
| 244 | + var r; |
| 245 | + if(r=types[0].verify(m["A"])) |
| 246 | + return r |
| 247 | + } |
| 248 | + return null |
| 249 | + } |
| 250 | + /* eslint-enable */ |
| 251 | + })(); |
| 252 | + |
| 253 | + return B; |
| 254 | +})(); |
| 255 | + |
| 256 | +// Resolve lazy types |
| 257 | +$lazyTypes.forEach(function(types) { |
| 258 | + types.forEach(function(path, i) { |
| 259 | + if (!path) |
| 260 | + return; |
| 261 | + path = path.split('.'); |
| 262 | + var ptr = $root; |
| 263 | + while (path.length) |
| 264 | + ptr = ptr[path.shift()]; |
| 265 | + types[i] = ptr; |
| 266 | + }); |
| 267 | +}); |
| 268 | + |
| 269 | +$protobuf.roots["test_ambiguous-names"] = $root; |
| 270 | + |
| 271 | +module.exports = $root; |
0 commit comments