HasCountryCode |
|
|
CountryCodeDigits DisplayCountryCode MakeValidCountryCode |
|
CountryCode |
Define Class HasCountryCode;
mixes in with Object;
attribute CountryCode: Text, readOnly, noGetter;
// Returns a human-readable country code like '+81' or '+33'
// must override to return this text from where it is stored
operation DisplayCountryCode(): Text;
// returns the country code without the ISO3166 code (if it was present)
// for 'CA+1', returns '+1'
intrinsic CountryCodeDigits(countryCode: HasText): Text;
// Returns just the digits portion of a countryCode. For '+81', returns
// '81'. For 'CA+1', returns '1'.
intrinsic MakeValidCountryCode(countryCode: HasText): Text;
// Returns a valid country code text object from a possibly ill-formed
// country code. A valid country code is either '+81' ("+" and country
// code) or 'CA+1' (ISO3166 code "+" country code).
// MakeValidCountryCode will parse countryCode and add the '+' if it's
// missing. Returns nilObject if countryCode is invalid.
end class;