1.1 --- a/epoc32/include/commonphoneparser.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/commonphoneparser.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,156 +1,45 @@
1.4 /*
1.5 -* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.7 * All rights reserved.
1.8 * This component and the accompanying materials are made available
1.9 -* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* under the terms of "Eclipse Public License v1.0"
1.11 * which accompanies this distribution, and is available
1.12 -* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.13 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.14 *
1.15 * Initial Contributors:
1.16 * Nokia Corporation - initial contribution.
1.17 *
1.18 * Contributors:
1.19 *
1.20 -* Description: Offers methods for parsing and validating phone numbers.
1.21 +* Description:
1.22 *
1.23 */
1.24
1.25
1.26 +
1.27 #ifndef COMMONPHONEPARSER_H
1.28 #define COMMONPHONEPARSER_H
1.29
1.30 -// INCLUDES
1.31 -#include <coemain.h>
1.32 -
1.33 -
1.34 -// CLASS DECLARATION
1.35 -
1.36 -/**
1.37 -* Class offers static methods for parsing and validating phone numbers.
1.38 -* Phone Parser API provides methods which are used to parse and validate
1.39 -* phone numbers. The API consist of the CommonPhoneParser class.
1.40 -*
1.41 -* Examples of valid phone numbers:
1.42 -* 1. +358501234567
1.43 -* 2. +358 (50) 123 4567
1.44 -*
1.45 -* Even though both of the above examples are valid phone numbers, only 1) is
1.46 -* accepted as a phone number by many systems. To convert 2) to 1), use the
1.47 -* parsing method of the API.
1.48 -*
1.49 -*
1.50 -* Usage:
1.51 -*
1.52 -* @code
1.53 -* #include <commonphoneparser.h>
1.54 -*
1.55 -* // Example shows how to use the parsing method of the API.
1.56 -*
1.57 -* // A number to be parsed.
1.58 -* TBuf<50> number1 = _L("+358 (40) 123 132");
1.59 -*
1.60 -* // Type of the phone number to be parsed is a regular phone number.
1.61 -* TBool validNumber1 =
1.62 -* CommonPhoneParser::ParsePhoneNumber( number1,
1.63 -* CommonPhoneParser::EPlainPhoneNumber );
1.64 -*
1.65 -* // The phone number number1 is a valid regular phone number.
1.66 -* // After parsing validNumber1 is ETrue and
1.67 -* // number1 is "+35840123132".
1.68 -* // Do something like SendSMS( number1 ) etc.
1.69 -*
1.70 -* // A number to be parsed.
1.71 -* TBuf<50> number2 = _L("+358 (40) 123p132"); // note 'p'
1.72 -*
1.73 -* // Type of the phone number to be parsed is a regular phone number.
1.74 -* TBool validNumber2 =
1.75 -* CommonPhoneParser::ParsePhoneNumber( number2,
1.76 -* CommonPhoneParser::EPlainPhoneNumber );
1.77 -*
1.78 -* // The phone number number2 is not a valid regular phone number.
1.79 -* // After parsing validNumber2 is EFalse and
1.80 -* // number2 is "+358 (40) 123p132" (unchanged).
1.81 -* @endcode
1.82 -*
1.83 -* @lib commonengine.lib
1.84 -* @since S60 2.0
1.85 -*/
1.86 +#include <coemain.h>
1.87
1.88 class CommonPhoneParser
1.89 +/**
1.90 +@deprecated
1.91 +@see TulPhoneNumberUtils
1.92 +@note For compatibility with S60 only
1.93 +*/
1.94 {
1.95 - public:
1.96 +public:
1.97 + enum TPhoneNumberType
1.98 + {
1.99 + EPlainPhoneNumber,
1.100 + EContactCardNumber,
1.101 + EPhoneClientNumber,
1.102 + ESMSNumber
1.103 + };
1.104
1.105 - /**
1.106 - * Enumeration for phone number types.
1.107 - * Used to specify the type of phone numbers in methods of
1.108 - * CommonPhoneParser class.
1.109 - */
1.110 - enum TPhoneNumberType
1.111 - {
1.112 - /** The associated phone number is a regular phone number.
1.113 - */
1.114 - EPlainPhoneNumber,
1.115 - /** The associated phone number is a contact card number.
1.116 - */
1.117 - EContactCardNumber,
1.118 - /** The associated phone number is is a phone client number.
1.119 - */
1.120 - EPhoneClientNumber,
1.121 - /** The associated phone number is an SMS number.
1.122 - */
1.123 - ESMSNumber
1.124 - };
1.125 -
1.126 - /**
1.127 - * Parses the supplied phone number. This method removes irrelevant
1.128 - * characters and white spaces from the supplied phone number. Allowed
1.129 - * characters are determined by phone number type.
1.130 - *
1.131 - * @param aNumber will be checked and parsed. After returning contains
1.132 - * the parsed number if the supplied phone number was a valid phone
1.133 - * number. If the number was not valid no parsing will be done.
1.134 - * @param aType is the type of the supplied phone number.
1.135 - * @return ETrue if the supplied phone number is a valid number of the
1.136 - * supplied type and the parsing succeeds. Otherwise EFalse.
1.137 - */
1.138 - IMPORT_C static TBool ParsePhoneNumber( TDes& aNumber,
1.139 - TPhoneNumberType aType );
1.140 -
1.141 - /**
1.142 - * Checks if string is a valid phone number.
1.143 - * This method checks if the supplied phone number is a valid phone
1.144 - * number of the supplied type.
1.145 - *
1.146 - * @param aNumber which validity will be checked.
1.147 - * @param aType is the type of the supplied phone number.
1.148 - * @return ETrue if the supplied phone number is a valid number of the
1.149 - * supplied type. Otherwise EFalse.
1.150 - */
1.151 - IMPORT_C static TBool IsValidPhoneNumber( const TDesC& aNumber,
1.152 - TPhoneNumberType aType );
1.153 -
1.154 - /**
1.155 - * This method is meant for internal use of Phone Parser.
1.156 - * Check if string is a valid phone number
1.157 - *
1.158 - * @param aNumber Number which will be checked
1.159 - * @param aValidChars Characters that are valid for the number.
1.160 - * Note! Some chars have special rules. See Find Item
1.161 - * UI specification for more info.
1.162 - *
1.163 - * @return ETrue if the number was valid, otherwise EFalse.
1.164 - */
1.165 - static TBool IsValidPhoneNumber( const TDesC& aNumber,
1.166 - const TDesC& aValidChars);
1.167 - /**
1.168 - * This method is meant for internal use of Phone Parser.
1.169 - * Parses invalid characters from a string
1.170 - *
1.171 - * @param aNumber Number which will be parsed.
1.172 - * @param aInvalidChars Characters that are invalid.
1.173 - */
1.174 - static void ParseInvalidChars( TDes& aNumber,
1.175 - const TDesC& aInvalidChars);
1.176 + IMPORT_C static TBool ParsePhoneNumber( TDes& aNumber, TInt aType );
1.177 + IMPORT_C static TBool IsValidPhoneNumber( const TDesC& aNumber, TInt aType );
1.178 };
1.179
1.180 #endif // COMMONPHONEPARSER_H