helloworld_pb.js 9.3 KB

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