|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "tsservicesprovider.h" |
|
19 #include "tsservice.h" |
|
20 // ----------------------------------------------------------------------------- |
|
21 CTsServiceProvider* CTsServiceProvider::NewL(const CTsServiceProviderConfig& config) |
|
22 { |
|
23 CTsServiceProvider* self = new (ELeave)CTsServiceProvider(); |
|
24 self->Construct(config); |
|
25 return self; |
|
26 } |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 CTsServiceProvider::CTsServiceProvider() |
|
30 { |
|
31 //No implementation required |
|
32 } |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 void CTsServiceProvider::Construct(const CTsServiceProviderConfig& config) |
|
36 { |
|
37 CTsService* srvPtr(0); |
|
38 for (TInt iter(0); iter < config.count(); ++iter) { |
|
39 TRAP_IGNORE( |
|
40 srvPtr = CTsService::NewLC(config.loadL(iter)); |
|
41 mServices.AppendL(srvPtr); |
|
42 CleanupStack::Pop(srvPtr); |
|
43 ); |
|
44 } |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 CTsServiceProvider::~CTsServiceProvider() |
|
49 { |
|
50 mServices.ResetAndDestroy(); |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 MTsModel& CTsServiceProvider::operator[](TInt offset) const |
|
55 { |
|
56 return *(mServices[offset]); |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 TInt CTsServiceProvider::count() const |
|
61 { |
|
62 return mServices.Count(); |
|
63 } |