1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: It is parser for phone numbers. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPHONEGSMPHONENUMBERPARSER_H |
|
20 #define CPHONEGSMPHONENUMBERPARSER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "cphonegsmparserbase.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class CPhoneGsmOptionContainer; |
|
27 // CONSTANTS |
|
28 |
|
29 /* |
|
30 * PHONE NUMBER UIDS |
|
31 */ |
|
32 |
|
33 const TUint32 KPhoneUidPhoneNumber = |
|
34 PHONE_MAKE_UID( KPhoneGsmUidDialPhoneNumber, 0 ); |
|
35 |
|
36 /* |
|
37 * Dial phone number related constants, store to aux information field. |
|
38 */ |
|
39 |
|
40 /* |
|
41 * There was no prefix, use default clir. |
|
42 */ |
|
43 const TUint KPhoneDialDefaultClir = 0; |
|
44 |
|
45 /* |
|
46 * There was clir suppress prefix. |
|
47 */ |
|
48 const TUint KPhoneDialSuppressClir = 1; |
|
49 |
|
50 /* |
|
51 * There was clir invoke prefix. |
|
52 */ |
|
53 const TUint KPhoneDialInvokeClir = 2; |
|
54 |
|
55 // CLASS DECLARATION |
|
56 |
|
57 /** |
|
58 * It is parser for phone numbers. |
|
59 * |
|
60 * @since 1.0 |
|
61 * @lib phoneparser.lib |
|
62 */ |
|
63 NONSHARABLE_CLASS( CPhoneGsmPhoneNumberParser ) |
|
64 : public CPhoneGsmParserBase |
|
65 { |
|
66 public: // Constructors and destructor |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 */ |
|
71 static CPhoneGsmPhoneNumberParser* NewLC(); |
|
72 |
|
73 public: // Functions from base classes |
|
74 |
|
75 /** |
|
76 * From CPhoneGsmParserBase. |
|
77 * Parse string. |
|
78 * |
|
79 * @param aString It is string to be parsed. |
|
80 * @param aResult It will contain result. |
|
81 * @param aOptionUid It is the uid of the option. |
|
82 * @return It returns boolean value indicating success of parsing. |
|
83 */ |
|
84 TBool ParseL( |
|
85 const TDesC& aString, |
|
86 CPhoneGsmParserResult& aResult, |
|
87 CPhoneGsmOptionContainerBase& aOptions ); |
|
88 |
|
89 private: |
|
90 |
|
91 /** |
|
92 * C++ default constructor. |
|
93 */ |
|
94 CPhoneGsmPhoneNumberParser(); |
|
95 |
|
96 /** |
|
97 * Parse. |
|
98 * |
|
99 * @param aString It is string to be parsed. |
|
100 * @param aResult It will contain result. |
|
101 * @param aOptionUid It is the uid of the option. |
|
102 * @return It returns boolean value indicating success of parsing. |
|
103 */ |
|
104 TBool DoParseL( |
|
105 const TDesC& aString, |
|
106 CPhoneGsmParserResult& aResult, |
|
107 CPhoneGsmOptionContainer& aOptions ); |
|
108 |
|
109 |
|
110 /** |
|
111 * Handle supplementary service prefixes. |
|
112 * Checks is there clir suppress/invoke prefix in the string. |
|
113 * @param aLex Contains string to be handled. |
|
114 * @param aResult It will contain result. |
|
115 */ |
|
116 TBool HandleServicePrefix( |
|
117 TLex& aLex, |
|
118 CPhoneGsmParserResult& aResult ); |
|
119 |
|
120 /** |
|
121 * Takes a main part of the phone number( before 'p','w' or |
|
122 * second '+' marks ). |
|
123 * And add it to parameter of the aResult with or without optional |
|
124 * international prefix. |
|
125 * @param aLex Contains string to be handled. |
|
126 * @param aResult It will contain result. |
|
127 */ |
|
128 TBool TakeNumberPartL( |
|
129 TLex& aLex, |
|
130 CPhoneGsmParserResult& aResult ); |
|
131 |
|
132 /** |
|
133 * Takes Dtmf postfix and add it to parameter of the aResult. |
|
134 * @param aLex Contains string to be handled. |
|
135 * @param aResult It will contain result. |
|
136 */ |
|
137 TBool TakeDtmfPostfixL( |
|
138 TLex& aLex, |
|
139 CPhoneGsmParserResult& aResult ); |
|
140 |
|
141 /** |
|
142 * Checks if param aLeft is prefix of param aDest. |
|
143 */ |
|
144 static TBool EqualsLeft( const TDesC& aDest, const TDesC& aLeft ); |
|
145 |
|
146 /** |
|
147 * Checks if string contains p or w characters. |
|
148 * |
|
149 * @param aString It is string to be checked. |
|
150 * @return ETrue if string contains p or w characters. |
|
151 */ |
|
152 TBool ContainsPauseOrWaitChars( const TDesC& aString ) const; |
|
153 |
|
154 /** |
|
155 * Checks if rightmost character in string is #. |
|
156 * |
|
157 * @param aString It is string to be checked. |
|
158 * @return ETrue if string is hash string. |
|
159 */ |
|
160 TBool IsHashString( const TDesC& aString ) const; |
|
161 |
|
162 /** |
|
163 * Checks if string is zero and zero dialling is on and |
|
164 * it is not in call situation. |
|
165 * |
|
166 * @param aString It is string to be checked. |
|
167 * @param aOptions Is call options |
|
168 * @return ETrue if zero dialling. |
|
169 */ |
|
170 TBool IsZeroDialling( const TDesC& aString, |
|
171 CPhoneGsmOptionContainer& aOptions ) const; |
|
172 |
|
173 /** |
|
174 * Checks if two digit dialling is on and string |
|
175 * is two digit string. |
|
176 * |
|
177 * @param aString It is string to be checked. |
|
178 * @return ETrue if two digit dialling. |
|
179 */ |
|
180 TBool IsTwoDigitDialling( const TDesC& aString ) const; |
|
181 |
|
182 /** |
|
183 * Checks if Input string is a 2 digit starting with a "1" |
|
184 * and it is not in call situation. |
|
185 * |
|
186 * @param aString It is string to be checked. |
|
187 * @param aOptions Is call options |
|
188 * @return ETrue if 1x dialling situation. |
|
189 */ |
|
190 TBool Is1xDialling( const TDesC& aString, |
|
191 CPhoneGsmOptionContainer& aOptions ) const; |
|
192 |
|
193 }; |
|
194 |
|
195 #endif // CPHONEGSMPHONENUMBERPARSER_H |
|
196 |
|
197 // End of File |
|