cpp/src/phonenumbers/phonenumberutil.cc
// Returns a pointer to the description inside the metadata of the appropriate
// type.
Returns a pointer to the description inside the metadata of the appropriate
type.
Returns a pointer to the description inside the metadata of the appropriate type .
const PhoneNumberDesc* GetNumberDescByType(
    const PhoneMetadata& metadata,
    PhoneNumberUtil::PhoneNumberType type) {
  switch (type) {
    case PhoneNumberUtil::PREMIUM_RATE:
      return &metadata.premium_rate();
    case PhoneNumberUtil::TOLL_FREE:
      return &metadata.toll_free();
    case PhoneNumberUtil::MOBILE:
      return &metadata.mobile();
    case PhoneNumberUtil::FIXED_LINE:
    case PhoneNumberUtil::FIXED_LINE_OR_MOBILE:
      return &metadata.fixed_line();
    case PhoneNumberUtil::SHARED_COST:
      return &metadata.shared_cost();
    case PhoneNumberUtil::VOIP:
      return &metadata.voip();
    case PhoneNumberUtil::PERSONAL_NUMBER:
      return &metadata.personal_number();
    case PhoneNumberUtil::PAGER:
      return &metadata.pager();
    case PhoneNumberUtil::UAN:
      return &metadata.uan();
    case PhoneNumberUtil::VOICEMAIL:
      return &metadata.voicemail();
    default:
      return &metadata.general_desc();
  }
}
const PhoneNumberDesc * GetNumberDescByType ( const PhoneMetadata & metadata , PhoneNumberUtil :: PhoneNumberType type ) { switch ( type ) { case PhoneNumberUtil :: PREMIUM_RATE : return & metadata . premium_rate ( ) ; case PhoneNumberUtil :: TOLL_FREE : return & metadata . toll_free ( ) ; case PhoneNumberUtil :: MOBILE : return & metadata . mobile ( ) ; case PhoneNumberUtil :: FIXED_LINE : case PhoneNumberUtil :: FIXED_LINE_OR_MOBILE : return & metadata . fixed_line ( ) ; case PhoneNumberUtil :: SHARED_COST : return & metadata . shared_cost ( ) ; case PhoneNumberUtil :: VOIP : return & metadata . voip ( ) ; case PhoneNumberUtil :: PERSONAL_NUMBER : return & metadata . personal_number ( ) ; case PhoneNumberUtil :: PAGER : return & metadata . pager ( ) ; case PhoneNumberUtil :: UAN : return & metadata . uan ( ) ; case PhoneNumberUtil :: VOICEMAIL : return & metadata . voicemail ( ) ; default : return & metadata . general_desc ( ) ; } }
Returns a pointer to the description inside the metadata of the appropriate
type.
Returns a pointer to the description inside the metadata of the appropriate type .