1 /* |
|
2 * Copyright (c) 2005 - 2006 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 recipient's address |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MUSENGURIPARSER_H |
|
20 #define MUSENGURIPARSER_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include "musunittesting.h" |
|
25 #include <e32cmn.h> |
|
26 |
|
27 const TInt KMaxUriLength = 512; |
|
28 _LIT8( KMusEngAtSign, "@" ); |
|
29 _LIT8( KMusEngPlusSign, "+" ); |
|
30 _LIT8( KMusEngSipPrefix, "sip:" ); |
|
31 _LIT8( KMusEngTelPrefix, "tel:" ); |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * |
|
37 */ |
|
38 class TMusEngUriParser |
|
39 { |
|
40 MUS_UNITTEST( UT_TMusEngUriParser ) |
|
41 |
|
42 public: |
|
43 |
|
44 enum TMusEngUriType |
|
45 { |
|
46 ENotParsed = 0, |
|
47 ESip, |
|
48 ETel |
|
49 }; |
|
50 |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Default constructor |
|
55 */ |
|
56 IMPORT_C TMusEngUriParser( const TDesC16& aUri ); |
|
57 |
|
58 /** |
|
59 * @returns Uri type |
|
60 */ |
|
61 IMPORT_C TMusEngUriType UriType(); |
|
62 |
|
63 /** |
|
64 * @returns Parsed and validated 8-bit version of contained URI |
|
65 * Ownership is transferred |
|
66 * @pre UriType() != ENotParsed |
|
67 * @leave KErrNotReady if precondition is not fulfilled |
|
68 */ |
|
69 IMPORT_C HBufC8* GetUri8L(); |
|
70 |
|
71 /** |
|
72 * @param aPrefix if ETrue, also sip: or tel:prefix is returned |
|
73 * @returns Parsed and validated 16-bit version of contained URI |
|
74 * Ownership is transferred |
|
75 * @pre UriType() != ENotParsed |
|
76 * @leave KErrNotReady if precondition is not fulfilled |
|
77 */ |
|
78 IMPORT_C HBufC16* GetUri16L( TBool aPrefix ); |
|
79 |
|
80 /** |
|
81 * Parses and validates contained URI |
|
82 * @leave KErrCorrupt if URI is not valid SIP or TEL URI |
|
83 * @post UriType() != ENotParsed |
|
84 */ |
|
85 IMPORT_C void ParseUriL(); |
|
86 |
|
87 |
|
88 private: |
|
89 |
|
90 void HandleSipUriL(); |
|
91 void HandleTelUriL(); |
|
92 void HandleLocalTelUriL(); |
|
93 |
|
94 |
|
95 TBuf8<KMaxUriLength> iUri; |
|
96 |
|
97 TMusEngUriType iUriType; |
|
98 |
|
99 }; |
|
100 |
|
101 #endif |
|