Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 #include <featdiscovery.h>
20 #include "featdiscoveryimpl.h"
22 // -----------------------------------------------------------------------------
23 // TFeatureSet::TFeatureSet()
24 // -----------------------------------------------------------------------------
26 EXPORT_C TFeatureSet::TFeatureSet() :
31 // -----------------------------------------------------------------------------
32 // TFeatureSet::~TFeatureSet()
33 // -----------------------------------------------------------------------------
35 EXPORT_C TFeatureSet::~TFeatureSet()
40 // -----------------------------------------------------------------------------
41 // TFeatureSet::Append(TUid)
42 // -----------------------------------------------------------------------------
44 EXPORT_C TInt TFeatureSet::Append( TUid aFeature )
48 feature.iFeatureID = aFeature;
49 feature.iSupported=EFalse;
51 err = iStatus.Append( feature );
60 // -----------------------------------------------------------------------------
61 // TFeatureSet::IsFeatureSupported(TUid)
62 // -----------------------------------------------------------------------------
64 EXPORT_C TBool TFeatureSet::IsFeatureSupported( TUid aFeature ) const
66 TBool featureSupported( EFalse );
68 feature.iFeatureID = aFeature;
69 TInt index = iStatus.Find( feature );
70 if( index != KErrNotFound )
72 featureSupported = iStatus[index].iSupported;
75 return featureSupported;
78 // -----------------------------------------------------------------------------
79 // TFeatureSet::AreAllFeaturesSupported()
80 // -----------------------------------------------------------------------------
82 EXPORT_C TBool TFeatureSet::AreAllFeaturesSupported() const
84 //if the request array is empty return true
85 if( !iCount ) return ETrue;
87 TBool allSupported( ETrue );
88 TInt count( iStatus.Count() );
92 // Features have been removed from array, because they don't exist.
93 allSupported = EFalse;
97 for(TInt i(0); i < count; i++)
99 if( !iStatus[i].iSupported )
101 allSupported = EFalse;
110 // -----------------------------------------------------------------------------
111 // TFeatureSet::Count()
112 // -----------------------------------------------------------------------------
114 TInt TFeatureSet::Count()
116 return iStatus.Count();
119 // -----------------------------------------------------------------------------
120 // TFeatureSet::Reset()
121 // -----------------------------------------------------------------------------
123 TUid TFeatureSet::FeatureId( TInt aIndex ) const
125 return iStatus[aIndex].iFeatureID;
128 // -----------------------------------------------------------------------------
129 // TFeatureSet::Reset()
130 // -----------------------------------------------------------------------------
132 void TFeatureSet::Reset()
137 // -----------------------------------------------------------------------------
138 // TFeatureSet::Append()
139 // -----------------------------------------------------------------------------
141 TInt TFeatureSet::Append( TUid aFeature, TBool aSupported )
143 TFeatureStat feature;
144 feature.iFeatureID = aFeature;
145 feature.iSupported = aSupported;
147 return iStatus.Append( feature );
150 // -----------------------------------------------------------------------------
151 // CFeatureDiscovery::CFeatureDiscovery* NewL()
152 // -----------------------------------------------------------------------------
154 EXPORT_C CFeatureDiscovery* CFeatureDiscovery::NewL()
156 CFeatureDiscovery* self = NewLC();
157 CleanupStack::Pop( self);
163 // -----------------------------------------------------------------------------
164 // CFeatureDiscovery::CFeatureDiscovery* NewLC()
165 // -----------------------------------------------------------------------------
167 EXPORT_C CFeatureDiscovery* CFeatureDiscovery::NewLC()
169 CFeatureDiscovery* self = new( ELeave ) CFeatureDiscovery();
170 CleanupStack::PushL( self );
176 // ---------------------------------------------------------
177 // CFeatureDiscovery::ConstructL
179 // Symbian OS default constructor, initializes variables and cache
180 // ---------------------------------------------------------
182 void CFeatureDiscovery::ConstructL()
184 iImpl = CFeatureDiscoveryImpl::NewL();
188 // -----------------------------------------------------------------------------
189 // CFeatureDiscovery::~CFeatureDiscovery()
190 // -----------------------------------------------------------------------------
192 CFeatureDiscovery::~CFeatureDiscovery()
198 // -----------------------------------------------------------------------------
199 // CFeatureDiscovery::CFeatureDiscovery()
200 // -----------------------------------------------------------------------------
202 CFeatureDiscovery::CFeatureDiscovery()
207 // -----------------------------------------------------------------------------
208 // CFeatureDiscovery::IsFeatureSupportedL(TInt)
209 // -----------------------------------------------------------------------------
211 EXPORT_C TBool CFeatureDiscovery::IsFeatureSupportedL(TInt aFeature)
213 return CFeatureDiscoveryImpl::IsFeatureSupportedL( TUid::Uid( aFeature ) );
216 // -----------------------------------------------------------------------------
217 // CFeatureDiscovery::IsFeatureSupportedL(TUid)
218 // -----------------------------------------------------------------------------
220 EXPORT_C TBool CFeatureDiscovery::IsFeatureSupportedL(TUid aFeature)
222 return CFeatureDiscoveryImpl::IsFeatureSupportedL( aFeature );
225 // -----------------------------------------------------------------------------
226 // CFeatureDiscovery::IsSupported(TInt)
227 // -----------------------------------------------------------------------------
229 EXPORT_C TBool CFeatureDiscovery::IsSupported(TInt aFeature) const
231 return iImpl->IsSupported( TUid::Uid( aFeature ) );
234 // -----------------------------------------------------------------------------
235 // CFeatureDiscovery::IsSupported(TUid)
236 // -----------------------------------------------------------------------------
238 EXPORT_C TBool CFeatureDiscovery::IsSupported(TUid aFeature) const
240 return iImpl->IsSupported( aFeature );
243 // -----------------------------------------------------------------------------
244 // CFeatureDiscovery::FeaturesSupportedL(TFeatureSet&)
245 // -----------------------------------------------------------------------------
247 EXPORT_C void CFeatureDiscovery::FeaturesSupportedL( TFeatureSet& aFeatures )
249 CFeatureDiscoveryImpl::FeaturesSupportedL( aFeatures );
252 // -----------------------------------------------------------------------------
253 // CFeatureDiscovery::FeaturesSupported(TFeatureSet&)
254 // -----------------------------------------------------------------------------
256 EXPORT_C TInt CFeatureDiscovery::FeaturesSupported( TFeatureSet& aFeatures ) const
258 return iImpl->FeaturesSupported( aFeatures );