|
1 /* |
|
2 * Copyright (c) 2005 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: DM Tree module |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __NSMLDMIAPMATCHER_H__ |
|
19 #define __NSMLDMIAPMATCHER_H__ |
|
20 |
|
21 // ------------------------------------------------------------------------------------------------ |
|
22 // Includes |
|
23 // ------------------------------------------------------------------------------------------------ |
|
24 #include <e32base.h> |
|
25 #include "nsmldmuri.h" |
|
26 |
|
27 //CLASS FORWARDS |
|
28 class MSmlDmCallback; |
|
29 |
|
30 _LIT8( KNSmlDMIAPUri, "AP" ); |
|
31 _LIT8( KNSmlDMSeparator8, "/" ); |
|
32 _LIT8( KNSmlDMIAPUriDotSlash, "./" ); |
|
33 |
|
34 const TUint8 KNSmlDMSlash = 0x2f; //forward slash |
|
35 /** |
|
36 * CNSmlDMIAPMatcher contains services for generating URI from IAPId and |
|
37 * vice versa in DM plug-in adapters. The class needs the working |
|
38 * MSmlDmCallback callback interface for operating, so ths can be used only |
|
39 * by DM plug-in adapters |
|
40 * |
|
41 * @since |
|
42 */ |
|
43 class CNSmlDMIAPMatcher : public CBase |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Destructor |
|
48 */ |
|
49 ~CNSmlDMIAPMatcher(); |
|
50 |
|
51 /** |
|
52 * Two-phased constructor |
|
53 * @param aDmCallback Pointer to callback interface |
|
54 * @return Pointer to newly created module instance |
|
55 */ |
|
56 static CNSmlDMIAPMatcher* NewL(MSmlDmCallback* aDmCallback); |
|
57 |
|
58 /** |
|
59 * Two-phased constructor, pushes pointer to cleanup stack. |
|
60 * @param aDmCallback Pointer to callback interface |
|
61 * @return Pointer to newly created module instance |
|
62 */ |
|
63 static CNSmlDMIAPMatcher* NewLC(MSmlDmCallback* aDmCallback); |
|
64 |
|
65 /** |
|
66 * Gets the IAP id which corresponds to given URI |
|
67 * @param aURI Accespoint URI |
|
68 * @return Accespoint id in AP database |
|
69 */ |
|
70 TInt IAPIdFromURIL(const TDesC8& aURI); |
|
71 |
|
72 /** |
|
73 * Generates the URI which corresponds to given IAP Id |
|
74 * @param aIAPId Accespoint Id |
|
75 * @return Accesspoint URI in DM |
|
76 */ |
|
77 HBufC8* URIFromIAPIdL(TInt aIAPId); |
|
78 |
|
79 private: |
|
80 /** |
|
81 * Second phase constructor |
|
82 * @param aDmCallback Pointer to callback interface |
|
83 */ |
|
84 void ConstructL(MSmlDmCallback* aDmCallback); |
|
85 |
|
86 /** |
|
87 * Changes the given descriptor to Integer |
|
88 * @param aLuid Luid in descriptor format |
|
89 * @return Luid in TInt type |
|
90 */ |
|
91 TInt DesToInt(const TDesC8& aLuid); |
|
92 |
|
93 /** |
|
94 * Return the URI without ./ at the beginning, if those exist |
|
95 * @param aURI Uri |
|
96 * @return Uri without ./ |
|
97 */ |
|
98 TPtrC8 RemoveDotSlash(const TDesC8& aURI) const; |
|
99 |
|
100 /** |
|
101 * Return the last uri segment of the aURI |
|
102 * @param aURI Uri |
|
103 * @return The last uri segment |
|
104 */ |
|
105 TPtrC8 LastURISeg(const TDesC8& aURI) const; |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * Pointer to callback interface |
|
111 */ |
|
112 MSmlDmCallback* iCallback; |
|
113 |
|
114 }; |
|
115 |
|
116 #endif // __NSMLDMIAPMATCHER_H__ |