|
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: Source file for UPnP Browse cache item implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <upnpobjectlist.h> |
|
21 #include "upnpbrowsecacheitem.h" |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS ============================ |
|
24 |
|
25 // -------------------------------------------------------------------------- |
|
26 // CUPnPBrowseCacheItem::CUPnPBrowseCacheItem |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // -------------------------------------------------------------------------- |
|
30 // |
|
31 CUPnPBrowseCacheItem::CUPnPBrowseCacheItem() |
|
32 { |
|
33 } |
|
34 |
|
35 // -------------------------------------------------------------------------- |
|
36 // CUPnPBrowseCacheItem::ConstructL |
|
37 // Symbian 2nd phase constructor can leave. |
|
38 // -------------------------------------------------------------------------- |
|
39 void CUPnPBrowseCacheItem::ConstructL( const TDesC8& aContainer, |
|
40 TInt aHighLightedItem, |
|
41 TInt aFirstItem ) |
|
42 { |
|
43 iContainerData = aContainer.AllocL(); |
|
44 iFirstItem = aFirstItem; |
|
45 iHighLightedItem = aHighLightedItem; |
|
46 iItemArray.ResetAndDestroy(); |
|
47 } |
|
48 |
|
49 // -------------------------------------------------------------------------- |
|
50 // CUPnPBrowseCacheItem::NewL |
|
51 // Two-phased constructor. |
|
52 // -------------------------------------------------------------------------- |
|
53 EXPORT_C CUPnPBrowseCacheItem* CUPnPBrowseCacheItem::NewL( |
|
54 const TDesC8& aContainer, |
|
55 TInt aHighLightedItem, |
|
56 TInt aFirstItem ) |
|
57 { |
|
58 CUPnPBrowseCacheItem* self = new( ELeave ) CUPnPBrowseCacheItem; |
|
59 |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL( aContainer, aHighLightedItem, aFirstItem ); |
|
62 CleanupStack::Pop(); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // Destructor |
|
67 CUPnPBrowseCacheItem::~CUPnPBrowseCacheItem() |
|
68 { |
|
69 if ( iItemArray.Count() > 0 ) |
|
70 { |
|
71 iItemArray.ResetAndDestroy(); |
|
72 } |
|
73 iItemArray.Close(); |
|
74 delete iContainerData; |
|
75 } |
|
76 |
|
77 // -------------------------------------------------------------------------- |
|
78 // CUPnPBrowseCacheItem::ContainerId |
|
79 // -------------------------------------------------------------------------- |
|
80 EXPORT_C const HBufC8& CUPnPBrowseCacheItem::ContainerId() const |
|
81 { |
|
82 return *iContainerData; |
|
83 } |
|
84 |
|
85 // -------------------------------------------------------------------------- |
|
86 // CUPnPBrowseCacheItem::SetItemArrayL |
|
87 // -------------------------------------------------------------------------- |
|
88 EXPORT_C void CUPnPBrowseCacheItem::SetItemArrayL( |
|
89 const RPointerArray<CUpnpObject>& aBrowseArray ) |
|
90 { |
|
91 iItemArray.ResetAndDestroy(); |
|
92 for ( TInt index=0; index < aBrowseArray.Count(); index++ ) |
|
93 { |
|
94 iItemArray.AppendL( aBrowseArray[ index ] ); |
|
95 } |
|
96 } |
|
97 |
|
98 // -------------------------------------------------------------------------- |
|
99 // CUPnPBrowseCacheItem::SetFirstItem |
|
100 // -------------------------------------------------------------------------- |
|
101 EXPORT_C void CUPnPBrowseCacheItem::SetFirstItem( const TInt aFirstItem ) |
|
102 { |
|
103 iFirstItem = aFirstItem; |
|
104 } |
|
105 |
|
106 // -------------------------------------------------------------------------- |
|
107 // CUPnPBrowseCacheItem::SetTotalCount |
|
108 // -------------------------------------------------------------------------- |
|
109 void CUPnPBrowseCacheItem::SetTotalCount( const TInt aTotalCount ) |
|
110 { |
|
111 iTotalCount = aTotalCount; |
|
112 } |
|
113 |
|
114 // -------------------------------------------------------------------------- |
|
115 // CUPnPBrowseCacheItem::SetHighLightedItem |
|
116 // -------------------------------------------------------------------------- |
|
117 EXPORT_C void CUPnPBrowseCacheItem::SetHighLightedItem( |
|
118 const TInt aHighLightedItem ) |
|
119 { |
|
120 iHighLightedItem = aHighLightedItem; |
|
121 } |
|
122 |
|
123 // -------------------------------------------------------------------------- |
|
124 // CUPnPBrowseCacheItem::GetItem |
|
125 // -------------------------------------------------------------------------- |
|
126 EXPORT_C const CUpnpObject* CUPnPBrowseCacheItem::GetItem( |
|
127 const TInt aItemToGet ) |
|
128 { |
|
129 return iItemArray[ aItemToGet ]; |
|
130 } |
|
131 |
|
132 // -------------------------------------------------------------------------- |
|
133 // CUPnPBrowseCacheItem::GetNumberOfItems |
|
134 // -------------------------------------------------------------------------- |
|
135 EXPORT_C TInt CUPnPBrowseCacheItem::GetNumberOfItems() const |
|
136 { |
|
137 return iItemArray.Count(); |
|
138 } |
|
139 |
|
140 // -------------------------------------------------------------------------- |
|
141 // CUPnPBrowseCacheItem::GetTotalCount |
|
142 // -------------------------------------------------------------------------- |
|
143 TInt CUPnPBrowseCacheItem::GetTotalCount() const |
|
144 { |
|
145 return iTotalCount; |
|
146 } |
|
147 |
|
148 // -------------------------------------------------------------------------- |
|
149 // CUPnPBrowseCacheItem::GetUpperMostItem |
|
150 // -------------------------------------------------------------------------- |
|
151 EXPORT_C TInt CUPnPBrowseCacheItem::GetUpperMostItem() const |
|
152 { |
|
153 return iFirstItem; |
|
154 } |
|
155 |
|
156 // -------------------------------------------------------------------------- |
|
157 // CUPnPBrowseCacheItem::GetHighlightedItem |
|
158 // -------------------------------------------------------------------------- |
|
159 EXPORT_C TInt CUPnPBrowseCacheItem::GetHighlightedItem() const |
|
160 { |
|
161 return iHighLightedItem; |
|
162 } |
|
163 |
|
164 // End of file |