|
1 /* |
|
2 * Copyright (c) 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: Lite object for storing container/item structure |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_UPNP_CDS_LITE_OBJECT_H |
|
19 #define C_UPNP_CDS_LITE_OBJECT_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 |
|
24 /** |
|
25 * Defines the CUpnpCdsLiteObject class. Used to store container/item |
|
26 * structure of the CDS. |
|
27 * |
|
28 * @lib upnpsharingalgorithm.lib |
|
29 * @since S60 5.2 |
|
30 */ |
|
31 class CUpnpCdsLiteObject : public CBase |
|
32 { |
|
33 |
|
34 public: // Enums |
|
35 |
|
36 enum TCdsLiteObjectType |
|
37 { |
|
38 EContainer = 1, |
|
39 EItem, |
|
40 EItemReference, |
|
41 EUnknown |
|
42 }; |
|
43 |
|
44 public: // Constructors and destructors |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. Leaves with KErrArgument if the given |
|
48 * parameters are not valid. Can also leave in case of out-of-memory. |
|
49 * |
|
50 * @since S60 5.2 |
|
51 * @param aName, filename/container title of the object |
|
52 * @param aType, type of the object |
|
53 * @param aObjectId, CDS object ID of the object |
|
54 * @param aParentId, CDS object ID of the parent object |
|
55 * @param aObjectClass, object class type |
|
56 * @return CDSLite object |
|
57 */ |
|
58 IMPORT_C static CUpnpCdsLiteObject* NewL( const TDesC8 &aName, |
|
59 const TCdsLiteObjectType aType, |
|
60 const TDesC8 &aObjectId, |
|
61 const TDesC8 &aParentId, |
|
62 const TDesC8 &aObjectClass ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 * |
|
67 * @since S60 5.2 |
|
68 */ |
|
69 IMPORT_C virtual ~CUpnpCdsLiteObject(); |
|
70 |
|
71 public: // Business logic methods |
|
72 |
|
73 /** |
|
74 * Returns the name of the object. For UpnpItems and UpnpItemRefences |
|
75 * this is the filename (including filepath). For UpnpContainer this |
|
76 * it the title of the container. |
|
77 * |
|
78 * @since S60 5.2 |
|
79 * @return object name |
|
80 */ |
|
81 IMPORT_C TDesC8& Name(); |
|
82 |
|
83 /** |
|
84 * Returns the type of the object |
|
85 * |
|
86 * @since S60 5.2 |
|
87 * @return object type |
|
88 */ |
|
89 IMPORT_C CUpnpCdsLiteObject::TCdsLiteObjectType Type(); |
|
90 |
|
91 /** |
|
92 * Returns the CDS object ID of the object |
|
93 * |
|
94 * @since S60 5.2 |
|
95 * @return object id |
|
96 */ |
|
97 IMPORT_C TDesC8& ObjectId(); |
|
98 |
|
99 /** |
|
100 * Returns the CDS object ID of the parent object |
|
101 * |
|
102 * @since S60 5.2 |
|
103 * @return parent object id |
|
104 */ |
|
105 IMPORT_C TDesC8& ParentId(); |
|
106 |
|
107 /** |
|
108 * Returns the object class |
|
109 * |
|
110 * @since S60 5.2 |
|
111 * @return object class |
|
112 */ |
|
113 IMPORT_C TDesC8& ObjectClass(); |
|
114 |
|
115 /** |
|
116 * Returns the CDS object ID of the original object. Leaves with |
|
117 * KErrNotSupported if the type of the object is not EItemReference. |
|
118 * Can also leave in case of out-of-memory. |
|
119 * |
|
120 * @since S60 5.2 |
|
121 * @return original item id |
|
122 */ |
|
123 IMPORT_C TDesC8& OriginalItemIdL(); |
|
124 |
|
125 /** |
|
126 * Sets the CDS object ID of the original object. Leaves with |
|
127 * KErrArgument if the given parameter is not valid. Can also leave |
|
128 * in case of out-of-memory. |
|
129 * |
|
130 * @since S60 5.2 |
|
131 * @param aOriginalItemId, CDS object ID of the original UpnpItem |
|
132 */ |
|
133 IMPORT_C void SetOriginalItemIdL( const TDesC8 &aOriginalItemId ); |
|
134 |
|
135 private: // Constructors |
|
136 |
|
137 /** |
|
138 * Default c++ constructor |
|
139 * |
|
140 * @since S60 5.2 |
|
141 */ |
|
142 CUpnpCdsLiteObject(); |
|
143 |
|
144 /** |
|
145 * Second-phase constructor. |
|
146 * |
|
147 * @since S60 5.2 |
|
148 * @param aName, filename/container title of the object |
|
149 * @param aType, type of the object |
|
150 * @param aObjectId, CDS object ID of the object |
|
151 * @param aParentId, CDS object ID of the parent object |
|
152 * @param aObjectClass, object class type |
|
153 */ |
|
154 void ConstructL( const TDesC8 &aName, |
|
155 const TCdsLiteObjectType aType, |
|
156 const TDesC8 &aObjectId, |
|
157 const TDesC8 &aParentId, |
|
158 const TDesC8 &aObjectClass ); |
|
159 |
|
160 private: // Data members |
|
161 |
|
162 /** |
|
163 * The type of the object |
|
164 */ |
|
165 TCdsLiteObjectType iType; |
|
166 |
|
167 /** |
|
168 * The name of the object. Owned. |
|
169 */ |
|
170 HBufC8* iName; |
|
171 |
|
172 /** |
|
173 * The CDS object ID. Owned. |
|
174 */ |
|
175 HBufC8* iObjectId; |
|
176 |
|
177 /** |
|
178 * The CDS object ID of the parent container. Owned. |
|
179 */ |
|
180 HBufC8* iParentId; |
|
181 |
|
182 /** |
|
183 * The CDS object class type. Owned. |
|
184 */ |
|
185 HBufC8* iObjectClass; |
|
186 |
|
187 /** |
|
188 * The CDS object ID of the original UpnpItem to which this |
|
189 * reference item points to. Used only if the type is EItemReference. |
|
190 * Owned. |
|
191 */ |
|
192 HBufC8* iOriginalItemId; |
|
193 |
|
194 }; |
|
195 |
|
196 #endif /* C_UPNP_CDS_LITE_OBJECT_H */ |
|
197 // End of File |