|
1 /* |
|
2 * Copyright (c) 2004-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: |
|
15 * Name : sipcodecutils.h |
|
16 * Part of : SIP Codec |
|
17 * Interface : SDK API, SIP Codec API |
|
18 * Version : SIP/4.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 /** |
|
26 @internalComponent |
|
27 */ |
|
28 |
|
29 #ifndef SIPCODECUTILS_H |
|
30 #define SIPCODECUTILS_H |
|
31 |
|
32 // INCLUDES |
|
33 #include <e32base.h> |
|
34 #include "_sipcodecdefs.h" |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CSIPRouteHeaderBase; |
|
38 class CSIPRouteHeader; |
|
39 class CSIPRecordRouteHeader; |
|
40 class CSIPAddress; |
|
41 class CURIContainer; |
|
42 class RStringF; |
|
43 class RWriteStream; |
|
44 |
|
45 // CLASS DECLARATION |
|
46 /** |
|
47 * Class providing utilities that do not logically belong to |
|
48 * any API class and utility functions that are EXPORTed but not published |
|
49 * as part of the API. |
|
50 * |
|
51 * @lib sipcodec.lib |
|
52 */ |
|
53 class SIPCodecUtils |
|
54 { |
|
55 public: // New functions |
|
56 |
|
57 /** |
|
58 * Creates a deep copy of the given CSIPRouteHeaderBase instance |
|
59 * and puts it to CleanupStack |
|
60 * @param aHeader Route-, Record-Route- or Service-Route-header |
|
61 * to be copied |
|
62 * @returns a new instance of CSIPRouteHeader |
|
63 */ |
|
64 IMPORT_C static CSIPRouteHeader* |
|
65 CreateRouteHeaderLC(const CSIPRouteHeaderBase& aHeader); |
|
66 |
|
67 /** |
|
68 * Creates a deep copy of the given CSIPRouteHeaderBase instance |
|
69 * and puts it to CleanupStack |
|
70 * @param aHeader Route-, Record-Route- or Service-Route-header |
|
71 * to be copied |
|
72 * @returns a new instance of CSIPRecordRouteHeader |
|
73 */ |
|
74 IMPORT_C static CSIPRecordRouteHeader* |
|
75 CreateRecordRouteHeaderLC(const CSIPRouteHeaderBase& aHeader); |
|
76 |
|
77 /** |
|
78 * Creates a new CSIPAddress instance and puts it to CleanupStack |
|
79 * @param aURI the ownership is transferred |
|
80 * @returns a new instance of CSIPAddress |
|
81 */ |
|
82 IMPORT_C static CSIPAddress* CreateSIPAddressLC(CURIContainer* aURI); |
|
83 |
|
84 |
|
85 public: // New functions, not imported |
|
86 |
|
87 /** |
|
88 * Checks the token's syntax and creates RStringF from it. |
|
89 * @param aToken A token to be checked. |
|
90 * @param aLeaveCode Leaves with this code if the check fails. |
|
91 * @returns An openned RStringF. |
|
92 * RStringF::Close() should be called for this. |
|
93 */ |
|
94 static RStringF |
|
95 CheckAndCreateTokenL(const TDesC8& aToken, TInt aLeaveCode); |
|
96 |
|
97 /** |
|
98 * Removes quotes from the quoted string. |
|
99 * @param aValue A quoted string. |
|
100 * @param aWithoutQuotes On return contains the string without quotes. |
|
101 * @returns KErrNone or KErrArgument error code if the aValue is invalid |
|
102 */ |
|
103 static TInt |
|
104 ValueWithoutQuotes(const TDesC8& aValue, TPtrC8& aWithoutQuotes); |
|
105 |
|
106 /** |
|
107 * Checks the token's syntax and assigns the right value to aBuffer. |
|
108 * @param aBuffer On return contains the checked string. |
|
109 * @param aValue A token value. |
|
110 * @param aErr Leaves with this code if the check fails. |
|
111 */ |
|
112 static void |
|
113 CheckAndSetValueL(HBufC8*& aBuffer,const TDesC8& aValue,TInt aErr); |
|
114 |
|
115 /** |
|
116 * Reads the descriptor length and value from the stream. |
|
117 * @param aReadStream A stream where to read. |
|
118 * @returns a pointer to the descriptor that was read |
|
119 * from the stream. The ownership is transferred. |
|
120 */ |
|
121 static HBufC8* ReadDescFromStreamL(RReadStream& aReadStream); |
|
122 |
|
123 private: // Contructors |
|
124 |
|
125 SIPCodecUtils(); |
|
126 }; |
|
127 |
|
128 #endif // SIPCODECUTILS_H |
|
129 |
|
130 // End of File |