1/** 2 * @license 3 * Protocol Buffer 2 Copyright 2008 Google Inc. 4 * All other code copyright its respective owners. 5 * Copyright (C) 2010 The Libphonenumber Authors 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20/** 21 * @fileoverview Generated Protocol Buffer code for file 22 * phonenumber.proto. 23 */ 24 25goog.provide('i18n.phonenumbers.PhoneNumber'); 26goog.provide('i18n.phonenumbers.PhoneNumber.CountryCodeSource'); 27 28goog.require('goog.proto2.Message'); 29goog.require('goog.proto2.Descriptor'); 30 31 32 33/** 34 * Message PhoneNumber. 35 * @constructor 36 * @extends {goog.proto2.Message} 37 * @final 38 */ 39i18n.phonenumbers.PhoneNumber = function() { 40 goog.proto2.Message.call(this); 41}; 42goog.inherits(i18n.phonenumbers.PhoneNumber, goog.proto2.Message); 43 44 45/** 46 * Descriptor for this message, deserialized lazily in getDescriptor(). 47 * @private {?goog.proto2.Descriptor} 48 */ 49i18n.phonenumbers.PhoneNumber.descriptor_ = null; 50 51 52/** 53 * Overrides {@link goog.proto2.Message#clone} to specify its exact return type. 54 * @return {!i18n.phonenumbers.PhoneNumber} The cloned message. 55 * @override 56 */ 57i18n.phonenumbers.PhoneNumber.prototype.clone; 58 59 60/** 61 * Gets the value of the country_code field. 62 * @return {?number} The value. 63 */ 64i18n.phonenumbers.PhoneNumber.prototype.getCountryCode = function() { 65 return /** @type {?number} */ (this.get$Value(1)); 66}; 67 68 69/** 70 * Gets the value of the country_code field or the default value if not set. 71 * @return {number} The value. 72 */ 73i18n.phonenumbers.PhoneNumber.prototype.getCountryCodeOrDefault = function() { 74 return /** @type {number} */ (this.get$ValueOrDefault(1)); 75}; 76 77 78/** 79 * Sets the value of the country_code field. 80 * @param {number} value The value. 81 */ 82i18n.phonenumbers.PhoneNumber.prototype.setCountryCode = function(value) { 83 this.set$Value(1, value); 84}; 85 86 87/** 88 * @return {boolean} Whether the country_code field has a value. 89 */ 90i18n.phonenumbers.PhoneNumber.prototype.hasCountryCode = function() { 91 return this.has$Value(1); 92}; 93 94 95/** 96 * @return {number} The number of values in the country_code field. 97 */ 98i18n.phonenumbers.PhoneNumber.prototype.countryCodeCount = function() { 99 return this.count$Values(1); 100}; 101 102 103/** 104 * Clears the values in the country_code field. 105 */ 106i18n.phonenumbers.PhoneNumber.prototype.clearCountryCode = function() { 107 this.clear$Field(1); 108}; 109 110 111/** 112 * Gets the value of the national_number field. 113 * @return {?number} The value. 114 */ 115i18n.phonenumbers.PhoneNumber.prototype.getNationalNumber = function() { 116 return /** @type {?number} */ (this.get$Value(2)); 117}; 118 119 120/** 121 * Gets the value of the national_number field or the default value if not set. 122 * @return {number} The value. 123 */ 124i18n.phonenumbers.PhoneNumber.prototype.getNationalNumberOrDefault = function() { 125 return /** @type {number} */ (this.get$ValueOrDefault(2)); 126}; 127 128 129/** 130 * Sets the value of the national_number field. 131 * @param {number} value The value. 132 */ 133i18n.phonenumbers.PhoneNumber.prototype.setNationalNumber = function(value) { 134 this.set$Value(2, value); 135}; 136 137 138/** 139 * @return {boolean} Whether the national_number field has a value. 140 */ 141i18n.phonenumbers.PhoneNumber.prototype.hasNationalNumber = function() { 142 return this.has$Value(2); 143}; 144 145 146/** 147 * @return {number} The number of values in the national_number field. 148 */ 149i18n.phonenumbers.PhoneNumber.prototype.nationalNumberCount = function() { 150 return this.count$Values(2); 151}; 152 153 154/** 155 * Clears the values in the national_number field. 156 */ 157i18n.phonenumbers.PhoneNumber.prototype.clearNationalNumber = function() { 158 this.clear$Field(2); 159}; 160 161 162/** 163 * Gets the value of the extension field. 164 * @return {?string} The value. 165 */ 166i18n.phonenumbers.PhoneNumber.prototype.getExtension = function() { 167 return /** @type {?string} */ (this.get$Value(3)); 168}; 169 170 171/** 172 * Gets the value of the extension field or the default value if not set. 173 * @return {string} The value. 174 */ 175i18n.phonenumbers.PhoneNumber.prototype.getExtensionOrDefault = function() { 176 return /** @type {string} */ (this.get$ValueOrDefault(3)); 177}; 178 179 180/** 181 * Sets the value of the extension field. 182 * @param {string} value The value. 183 */ 184i18n.phonenumbers.PhoneNumber.prototype.setExtension = function(value) { 185 this.set$Value(3, value); 186}; 187 188 189/** 190 * @return {boolean} Whether the extension field has a value. 191 */ 192i18n.phonenumbers.PhoneNumber.prototype.hasExtension = function() { 193 return this.has$Value(3); 194}; 195 196 197/** 198 * @return {number} The number of values in the extension field. 199 */ 200i18n.phonenumbers.PhoneNumber.prototype.extensionCount = function() { 201 return this.count$Values(3); 202}; 203 204 205/** 206 * Clears the values in the extension field. 207 */ 208i18n.phonenumbers.PhoneNumber.prototype.clearExtension = function() { 209 this.clear$Field(3); 210}; 211 212 213/** 214 * Gets the value of the italian_leading_zero field. 215 * @return {?boolean} The value. 216 */ 217i18n.phonenumbers.PhoneNumber.prototype.getItalianLeadingZero = function() { 218 return /** @type {?boolean} */ (this.get$Value(4)); 219}; 220 221 222/** 223 * Gets the value of the italian_leading_zero field or the default value if not set. 224 * @return {boolean} The value. 225 */ 226i18n.phonenumbers.PhoneNumber.prototype.getItalianLeadingZeroOrDefault = function() { 227 return /** @type {boolean} */ (this.get$ValueOrDefault(4)); 228}; 229 230 231/** 232 * Sets the value of the italian_leading_zero field. 233 * @param {boolean} value The value. 234 */ 235i18n.phonenumbers.PhoneNumber.prototype.setItalianLeadingZero = function(value) { 236 this.set$Value(4, value); 237}; 238 239 240/** 241 * @return {boolean} Whether the italian_leading_zero field has a value. 242 */ 243i18n.phonenumbers.PhoneNumber.prototype.hasItalianLeadingZero = function() { 244 return this.has$Value(4); 245}; 246 247 248/** 249 * @return {number} The number of values in the italian_leading_zero field. 250 */ 251i18n.phonenumbers.PhoneNumber.prototype.italianLeadingZeroCount = function() { 252 return this.count$Values(4); 253}; 254 255 256/** 257 * Clears the values in the italian_leading_zero field. 258 */ 259i18n.phonenumbers.PhoneNumber.prototype.clearItalianLeadingZero = function() { 260 this.clear$Field(4); 261}; 262 263 264/** 265 * Gets the value of the number_of_leading_zeros field. 266 * @return {?number} The value. 267 */ 268i18n.phonenumbers.PhoneNumber.prototype.getNumberOfLeadingZeros = function() { 269 return /** @type {?number} */ (this.get$Value(8)); 270}; 271 272 273/** 274 * Gets the value of the number_of_leading_zeros field or the default value if not set. 275 * @return {number} The value. 276 */ 277i18n.phonenumbers.PhoneNumber.prototype.getNumberOfLeadingZerosOrDefault = function() { 278 return /** @type {number} */ (this.get$ValueOrDefault(8)); 279}; 280 281 282/** 283 * Sets the value of the number_of_leading_zeros field. 284 * @param {number} value The value. 285 */ 286i18n.phonenumbers.PhoneNumber.prototype.setNumberOfLeadingZeros = function(value) { 287 this.set$Value(8, value); 288}; 289 290 291/** 292 * @return {boolean} Whether the number_of_leading_zeros field has a value. 293 */ 294i18n.phonenumbers.PhoneNumber.prototype.hasNumberOfLeadingZeros = function() { 295 return this.has$Value(8); 296}; 297 298 299/** 300 * @return {number} The number of values in the number_of_leading_zeros field. 301 */ 302i18n.phonenumbers.PhoneNumber.prototype.numberOfLeadingZerosCount = function() { 303 return this.count$Values(8); 304}; 305 306 307/** 308 * Clears the values in the number_of_leading_zeros field. 309 */ 310i18n.phonenumbers.PhoneNumber.prototype.clearNumberOfLeadingZeros = function() { 311 this.clear$Field(8); 312}; 313 314 315/** 316 * Gets the value of the raw_input field. 317 * @return {?string} The value. 318 */ 319i18n.phonenumbers.PhoneNumber.prototype.getRawInput = function() { 320 return /** @type {?string} */ (this.get$Value(5)); 321}; 322 323 324/** 325 * Gets the value of the raw_input field or the default value if not set. 326 * @return {string} The value. 327 */ 328i18n.phonenumbers.PhoneNumber.prototype.getRawInputOrDefault = function() { 329 return /** @type {string} */ (this.get$ValueOrDefault(5)); 330}; 331 332 333/** 334 * Sets the value of the raw_input field. 335 * @param {string} value The value. 336 */ 337i18n.phonenumbers.PhoneNumber.prototype.setRawInput = function(value) { 338 this.set$Value(5, value); 339}; 340 341 342/** 343 * @return {boolean} Whether the raw_input field has a value. 344 */ 345i18n.phonenumbers.PhoneNumber.prototype.hasRawInput = function() { 346 return this.has$Value(5); 347}; 348 349 350/** 351 * @return {number} The number of values in the raw_input field. 352 */ 353i18n.phonenumbers.PhoneNumber.prototype.rawInputCount = function() { 354 return this.count$Values(5); 355}; 356 357 358/** 359 * Clears the values in the raw_input field. 360 */ 361i18n.phonenumbers.PhoneNumber.prototype.clearRawInput = function() { 362 this.clear$Field(5); 363}; 364 365 366/** 367 * Gets the value of the country_code_source field. 368 * @return {?i18n.phonenumbers.PhoneNumber.CountryCodeSource} The value. 369 */ 370i18n.phonenumbers.PhoneNumber.prototype.getCountryCodeSource = function() { 371 return /** @type {?i18n.phonenumbers.PhoneNumber.CountryCodeSource} */ (this.get$Value(6)); 372}; 373 374 375/** 376 * Gets the value of the country_code_source field or the default value if not set. 377 * @return {!i18n.phonenumbers.PhoneNumber.CountryCodeSource} The value. 378 */ 379i18n.phonenumbers.PhoneNumber.prototype.getCountryCodeSourceOrDefault = function() { 380 return /** @type {!i18n.phonenumbers.PhoneNumber.CountryCodeSource} */ (this.get$ValueOrDefault(6)); 381}; 382 383 384/** 385 * Sets the value of the country_code_source field. 386 * @param {!i18n.phonenumbers.PhoneNumber.CountryCodeSource} value The value. 387 */ 388i18n.phonenumbers.PhoneNumber.prototype.setCountryCodeSource = function(value) { 389 this.set$Value(6, value); 390}; 391 392 393/** 394 * @return {boolean} Whether the country_code_source field has a value. 395 */ 396i18n.phonenumbers.PhoneNumber.prototype.hasCountryCodeSource = function() { 397 return this.has$Value(6); 398}; 399 400 401/** 402 * @return {number} The number of values in the country_code_source field. 403 */ 404i18n.phonenumbers.PhoneNumber.prototype.countryCodeSourceCount = function() { 405 return this.count$Values(6); 406}; 407 408 409/** 410 * Clears the values in the country_code_source field. 411 */ 412i18n.phonenumbers.PhoneNumber.prototype.clearCountryCodeSource = function() { 413 this.clear$Field(6); 414}; 415 416 417/** 418 * Gets the value of the preferred_domestic_carrier_code field. 419 * @return {?string} The value. 420 */ 421i18n.phonenumbers.PhoneNumber.prototype.getPreferredDomesticCarrierCode = function() { 422 return /** @type {?string} */ (this.get$Value(7)); 423}; 424 425 426/** 427 * Gets the value of the preferred_domestic_carrier_code field or the default value if not set. 428 * @return {string} The value. 429 */ 430i18n.phonenumbers.PhoneNumber.prototype.getPreferredDomesticCarrierCodeOrDefault = function() { 431 return /** @type {string} */ (this.get$ValueOrDefault(7)); 432}; 433 434 435/** 436 * Sets the value of the preferred_domestic_carrier_code field. 437 * @param {string} value The value. 438 */ 439i18n.phonenumbers.PhoneNumber.prototype.setPreferredDomesticCarrierCode = function(value) { 440 this.set$Value(7, value); 441}; 442 443 444/** 445 * @return {boolean} Whether the preferred_domestic_carrier_code field has a value. 446 */ 447i18n.phonenumbers.PhoneNumber.prototype.hasPreferredDomesticCarrierCode = function() { 448 return this.has$Value(7); 449}; 450 451 452/** 453 * @return {number} The number of values in the preferred_domestic_carrier_code field. 454 */ 455i18n.phonenumbers.PhoneNumber.prototype.preferredDomesticCarrierCodeCount = function() { 456 return this.count$Values(7); 457}; 458 459 460/** 461 * Clears the values in the preferred_domestic_carrier_code field. 462 */ 463i18n.phonenumbers.PhoneNumber.prototype.clearPreferredDomesticCarrierCode = function() { 464 this.clear$Field(7); 465}; 466 467 468/** 469 * Enumeration CountryCodeSource. 470 * @enum {number} 471 */ 472i18n.phonenumbers.PhoneNumber.CountryCodeSource = { 473 UNSPECIFIED: 0, 474 FROM_NUMBER_WITH_PLUS_SIGN: 1, 475 FROM_NUMBER_WITH_IDD: 5, 476 FROM_NUMBER_WITHOUT_PLUS_SIGN: 10, 477 FROM_DEFAULT_COUNTRY: 20 478}; 479 480 481/** @override */ 482i18n.phonenumbers.PhoneNumber.prototype.getDescriptor = function() { 483 var descriptor = i18n.phonenumbers.PhoneNumber.descriptor_; 484 if (!descriptor) { 485 // The descriptor is created lazily when we instantiate a new instance. 486 var descriptorObj = { 487 0: { 488 name: 'PhoneNumber', 489 fullName: 'i18n.phonenumbers.PhoneNumber' 490 }, 491 1: { 492 name: 'country_code', 493 required: true, 494 fieldType: goog.proto2.Message.FieldType.INT32, 495 type: Number 496 }, 497 2: { 498 name: 'national_number', 499 required: true, 500 fieldType: goog.proto2.Message.FieldType.UINT64, 501 type: Number 502 }, 503 3: { 504 name: 'extension', 505 fieldType: goog.proto2.Message.FieldType.STRING, 506 type: String 507 }, 508 4: { 509 name: 'italian_leading_zero', 510 fieldType: goog.proto2.Message.FieldType.BOOL, 511 type: Boolean 512 }, 513 8: { 514 name: 'number_of_leading_zeros', 515 fieldType: goog.proto2.Message.FieldType.INT32, 516 defaultValue: 1, 517 type: Number 518 }, 519 5: { 520 name: 'raw_input', 521 fieldType: goog.proto2.Message.FieldType.STRING, 522 type: String 523 }, 524 6: { 525 name: 'country_code_source', 526 fieldType: goog.proto2.Message.FieldType.ENUM, 527 defaultValue: i18n.phonenumbers.PhoneNumber.CountryCodeSource.UNSPECIFIED, 528 type: i18n.phonenumbers.PhoneNumber.CountryCodeSource 529 }, 530 7: { 531 name: 'preferred_domestic_carrier_code', 532 fieldType: goog.proto2.Message.FieldType.STRING, 533 type: String 534 } 535 }; 536 i18n.phonenumbers.PhoneNumber.descriptor_ = descriptor = 537 goog.proto2.Message.createDescriptor( 538 i18n.phonenumbers.PhoneNumber, descriptorObj); 539 } 540 return descriptor; 541}; 542 543 544// Export getDescriptor static function robust to minification. 545i18n.phonenumbers.PhoneNumber['ctor'] = i18n.phonenumbers.PhoneNumber; 546i18n.phonenumbers.PhoneNumber['ctor'].getDescriptor = 547 i18n.phonenumbers.PhoneNumber.prototype.getDescriptor; 548