|
1 /* |
|
2 * Copyright (c) 2008 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: Parser for emergency numbers. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CPhoneGsmEmergencyNumberParser.h" |
|
21 #include "CPhoneGsmParserResult.h" |
|
22 #include "CPhoneGsmOptionContainer.h" |
|
23 #include "CPhoneParserFeatures.h" |
|
24 |
|
25 // ============================ MEMBER FUNCTIONS =============================== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CPhoneGsmEmergencyNumberParser::CPhoneGsmEmergencyNumberParser |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CPhoneGsmEmergencyNumberParser::CPhoneGsmEmergencyNumberParser() |
|
32 { |
|
33 } |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CPhoneGsmEmergencyNumberParser::NewLC |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CPhoneGsmEmergencyNumberParser* CPhoneGsmEmergencyNumberParser::NewLC() |
|
40 { |
|
41 CPhoneGsmEmergencyNumberParser* self = |
|
42 new ( ELeave ) CPhoneGsmEmergencyNumberParser; |
|
43 |
|
44 CleanupStack::PushL( self ); |
|
45 |
|
46 return self; |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CPhoneGsmEmergencyNumberParser::ParseL |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 TBool CPhoneGsmEmergencyNumberParser::ParseL( |
|
54 const TDesC& aString, |
|
55 CPhoneGsmParserResult& aResult, |
|
56 CPhoneGsmOptionContainerBase& aOptions ) |
|
57 { |
|
58 aResult.ClearL(); |
|
59 |
|
60 TBool result = DoParseL( |
|
61 aString, |
|
62 aResult, |
|
63 static_cast<CPhoneGsmOptionContainer&>( aOptions ) ); |
|
64 |
|
65 if ( !result ) |
|
66 { |
|
67 aResult.ClearL(); |
|
68 } |
|
69 |
|
70 return result; |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CPhoneGsmEmergencyNumberParser::DoParseL |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 TBool CPhoneGsmEmergencyNumberParser::DoParseL( |
|
78 const TDesC& aString, |
|
79 CPhoneGsmParserResult& aResult, |
|
80 CPhoneGsmOptionContainer& aOptions ) |
|
81 { |
|
82 TBool result( EFalse ); |
|
83 |
|
84 if ( aOptions.FindOptionStatus( KPhoneOptionSend ) ) |
|
85 { |
|
86 iEmergencyPhoneNumber.Zero(); |
|
87 |
|
88 if ( CPhoneParserFeatures::IsEmergencyNumber( |
|
89 aString, iEmergencyPhoneNumber )) |
|
90 { |
|
91 aResult.AddParameterL( iEmergencyPhoneNumber ); |
|
92 aResult.SetUid( KPhoneUidEmergencyNumber ); |
|
93 result = ETrue; |
|
94 } |
|
95 } |
|
96 |
|
97 return result; |
|
98 } |
|
99 |
|
100 |
|
101 // End of File |