Debian Codegraph @

examples/node/static_codegen/helloworld_pb.js

raw
1 // source: helloworld.proto
2 /**
3 * @fileoverview
4 * @enhanceable
5 * @suppress {messageConventions} JS Compiler reports an error if a variable or
6 * field starts with 'MSG_' and isn't a translatable message.
7 * @public
8 */
9 // GENERATED CODE -- DO NOT EDIT!
10
11 var jspb = require('google-protobuf');
12 var goog = jspb;
13 var global = Function('return this')();
14
15 goog.exportSymbol('proto.helloworld.HelloReply', null, global);
16 goog.exportSymbol('proto.helloworld.HelloRequest', null, global);
17 /**
18 * Generated by JsPbCodeGenerator.
19 * @param {Array=} opt_data Optional initial data array, typically from a
20 * server response, or constructed directly in Javascript. The array is used
21 * in place and becomes part of the constructed object. It is not cloned.
22 * If no data is provided, the constructed object will be empty, but still
23 * valid.
24 * @extends {jspb.Message}
25 * @constructor
26 */
27 proto.helloworld.HelloRequest = function(opt_data) {
28 jspb.Message.initialize(this, opt_data, 0, -1, null, null);
29 };
30 goog.inherits(proto.helloworld.HelloRequest, jspb.Message);
31 if (goog.DEBUG && !COMPILED) {
32 /**
33 * @public
34 * @override
35 */
36 proto.helloworld.HelloRequest.displayName = 'proto.helloworld.HelloRequest';
37 }
38 /**
39 * Generated by JsPbCodeGenerator.
40 * @param {Array=} opt_data Optional initial data array, typically from a
41 * server response, or constructed directly in Javascript. The array is used
42 * in place and becomes part of the constructed object. It is not cloned.
43 * If no data is provided, the constructed object will be empty, but still
44 * valid.
45 * @extends {jspb.Message}
46 * @constructor
47 */
48 proto.helloworld.HelloReply = function(opt_data) {
49 jspb.Message.initialize(this, opt_data, 0, -1, null, null);
50 };
51 goog.inherits(proto.helloworld.HelloReply, jspb.Message);
52 if (goog.DEBUG && !COMPILED) {
53 /**
54 * @public
55 * @override
56 */
57 proto.helloworld.HelloReply.displayName = 'proto.helloworld.HelloReply';
58 }
59
60
61
62 if (jspb.Message.GENERATE_TO_OBJECT) {
63 /**
64 * Creates an object representation of this proto.
65 * Field names that are reserved in JavaScript and will be renamed to pb_name.
66 * Optional fields that are not set will be set to undefined.
67 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
68 * For the list of reserved names please see:
69 * net/proto2/compiler/js/internal/generator.cc#kKeyword.
70 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
71 * JSPB instance for transitional soy proto support:
72 * http://goto/soy-param-migration
73 * @return {!Object}
74 */
75 proto.helloworld.HelloRequest.prototype.toObject = function(opt_includeInstance) {
76 return proto.helloworld.HelloRequest.toObject(opt_includeInstance, this);
77 };
78
79
80 /**
81 * Static version of the {@see toObject} method.
82 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
83 * the JSPB instance for transitional soy proto support:
84 * http://goto/soy-param-migration
85 * @param {!proto.helloworld.HelloRequest} msg The msg instance to transform.
86 * @return {!Object}
87 * @suppress {unusedLocalVariables} f is only used for nested messages
88 */
89 proto.helloworld.HelloRequest.toObject = function(includeInstance, msg) {
90 var f, obj = {
91 name: jspb.Message.getFieldWithDefault(msg, 1, "")
92 };
93
94 if (includeInstance) {
95 obj.$jspbMessageInstance = msg;
96 }
97 return obj;
98 };
99 }
100
101
102 /**
103 * Deserializes binary data (in protobuf wire format).
104 * @param {jspb.ByteSource} bytes The bytes to deserialize.
105 * @return {!proto.helloworld.HelloRequest}
106 */
107 proto.helloworld.HelloRequest.deserializeBinary = function(bytes) {
108 var reader = new jspb.BinaryReader(bytes);
109 var msg = new proto.helloworld.HelloRequest;
110 return proto.helloworld.HelloRequest.deserializeBinaryFromReader(msg, reader);
111 };
112
113
114 /**
115 * Deserializes binary data (in protobuf wire format) from the
116 * given reader into the given message object.
117 * @param {!proto.helloworld.HelloRequest} msg The message object to deserialize into.
118 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
119 * @return {!proto.helloworld.HelloRequest}
120 */
121 proto.helloworld.HelloRequest.deserializeBinaryFromReader = function(msg, reader) {
122 while (reader.nextField()) {
123 if (reader.isEndGroup()) {
124 break;
125 }
126 var field = reader.getFieldNumber();
127 switch (field) {
128 case 1:
129 var value = /** @type {string} */ (reader.readString());
130 msg.setName(value);
131 break;
132 default:
133 reader.skipField();
134 break;
135 }
136 }
137 return msg;
138 };
139
140
141 /**
142 * Serializes the message to binary data (in protobuf wire format).
143 * @return {!Uint8Array}
144 */
145 proto.helloworld.HelloRequest.prototype.serializeBinary = function() {
146 var writer = new jspb.BinaryWriter();
147 proto.helloworld.HelloRequest.serializeBinaryToWriter(this, writer);
148 return writer.getResultBuffer();
149 };
150
151
152 /**
153 * Serializes the given message to binary data (in protobuf wire
154 * format), writing to the given BinaryWriter.
155 * @param {!proto.helloworld.HelloRequest} message
156 * @param {!jspb.BinaryWriter} writer
157 * @suppress {unusedLocalVariables} f is only used for nested messages
158 */
159 proto.helloworld.HelloRequest.serializeBinaryToWriter = function(message, writer) {
160 var f = undefined;
161 f = message.getName();
162 if (f.length > 0) {
163 writer.writeString(
164 1,
165 f
166 );
167 }
168 };
169
170
171 /**
172 * optional string name = 1;
173 * @return {string}
174 */
175 proto.helloworld.HelloRequest.prototype.getName = function() {
176 return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
177 };
178
179
180 /**
181 * @param {string} value
182 * @return {!proto.helloworld.HelloRequest} returns this
183 */
184 proto.helloworld.HelloRequest.prototype.setName = function(value) {
185 return jspb.Message.setProto3StringField(this, 1, value);
186 };
187
188
189
190
191
192 if (jspb.Message.GENERATE_TO_OBJECT) {
193 /**
194 * Creates an object representation of this proto.
195 * Field names that are reserved in JavaScript and will be renamed to pb_name.
196 * Optional fields that are not set will be set to undefined.
197 * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
198 * For the list of reserved names please see:
199 * net/proto2/compiler/js/internal/generator.cc#kKeyword.
200 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
201 * JSPB instance for transitional soy proto support:
202 * http://goto/soy-param-migration
203 * @return {!Object}
204 */
205 proto.helloworld.HelloReply.prototype.toObject = function(opt_includeInstance) {
206 return proto.helloworld.HelloReply.toObject(opt_includeInstance, this);
207 };
208
209
210 /**
211 * Static version of the {@see toObject} method.
212 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
213 * the JSPB instance for transitional soy proto support:
214 * http://goto/soy-param-migration
215 * @param {!proto.helloworld.HelloReply} msg The msg instance to transform.
216 * @return {!Object}
217 * @suppress {unusedLocalVariables} f is only used for nested messages
218 */
219 proto.helloworld.HelloReply.toObject = function(includeInstance, msg) {
220 var f, obj = {
221 message: jspb.Message.getFieldWithDefault(msg, 1, "")
222 };
223
224 if (includeInstance) {
225 obj.$jspbMessageInstance = msg;
226 }
227 return obj;
228 };
229 }
230
231
232 /**
233 * Deserializes binary data (in protobuf wire format).
234 * @param {jspb.ByteSource} bytes The bytes to deserialize.
235 * @return {!proto.helloworld.HelloReply}
236 */
237 proto.helloworld.HelloReply.deserializeBinary = function(bytes) {
238 var reader = new jspb.BinaryReader(bytes);
239 var msg = new proto.helloworld.HelloReply;
240 return proto.helloworld.HelloReply.deserializeBinaryFromReader(msg, reader);
241 };
242
243
244 /**
245 * Deserializes binary data (in protobuf wire format) from the
246 * given reader into the given message object.
247 * @param {!proto.helloworld.HelloReply} msg The message object to deserialize into.
248 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
249 * @return {!proto.helloworld.HelloReply}
250 */
251 proto.helloworld.HelloReply.deserializeBinaryFromReader = function(msg, reader) {
252 while (reader.nextField()) {
253 if (reader.isEndGroup()) {
254 break;
255 }
256 var field = reader.getFieldNumber();
257 switch (field) {
258 case 1:
259 var value = /** @type {string} */ (reader.readString());
260 msg.setMessage(value);
261 break;
262 default:
263 reader.skipField();
264 break;
265 }
266 }
267 return msg;
268 };
269
270
271 /**
272 * Serializes the message to binary data (in protobuf wire format).
273 * @return {!Uint8Array}
274 */
275 proto.helloworld.HelloReply.prototype.serializeBinary = function() {
276 var writer = new jspb.BinaryWriter();
277 proto.helloworld.HelloReply.serializeBinaryToWriter(this, writer);
278 return writer.getResultBuffer();
279 };
280
281
282 /**
283 * Serializes the given message to binary data (in protobuf wire
284 * format), writing to the given BinaryWriter.
285 * @param {!proto.helloworld.HelloReply} message
286 * @param {!jspb.BinaryWriter} writer
287 * @suppress {unusedLocalVariables} f is only used for nested messages
288 */
289 proto.helloworld.HelloReply.serializeBinaryToWriter = function(message, writer) {
290 var f = undefined;
291 f = message.getMessage();
292 if (f.length > 0) {
293 writer.writeString(
294 1,
295 f
296 );
297 }
298 };
299
300
301 /**
302 * optional string message = 1;
303 * @return {string}
304 */
305 proto.helloworld.HelloReply.prototype.getMessage = function() {
306 return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
307 };
308
309
310 /**
311 * @param {string} value
312 * @return {!proto.helloworld.HelloReply} returns this
313 */
314 proto.helloworld.HelloReply.prototype.setMessage = function(value) {
315 return jspb.Message.setProto3StringField(this, 1, value);
316 };
317
318
319 goog.object.extend(exports, proto.helloworld);