|
1 // Copyright (c) 2006-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <ctsy/rmmcustomapi.h> |
|
20 #include <etelext.h> |
|
21 |
|
22 // ======== MEMBER FUNCTIONS ======== |
|
23 |
|
24 CMmCustomPtrHolder::CMmCustomPtrHolder() |
|
25 { |
|
26 } |
|
27 |
|
28 void CMmCustomPtrHolder::ConstructL( |
|
29 const TInt aSizeOfPtrArray, |
|
30 const TInt aSizeOfPtrCArray ) |
|
31 { |
|
32 TPtr8 ptr( NULL, 0 ); |
|
33 TInt i; |
|
34 TInt ret( KErrNone ); |
|
35 for ( i=0; i<aSizeOfPtrArray; i++ ) |
|
36 { |
|
37 ret = iPtrArray.Append( ptr ); |
|
38 // In case of an error, remember to close the array! |
|
39 if ( KErrNone != ret ) |
|
40 { |
|
41 iPtrArray.Close(); |
|
42 User::Leave( ret ); |
|
43 } |
|
44 } |
|
45 TPtrC8 ptrC( NULL,0 ); |
|
46 for ( i=0; i<aSizeOfPtrCArray; i++ ) |
|
47 { |
|
48 ret = iPtrCArray.Append( ptrC ); |
|
49 // In case of an error, remember to close both arrays! |
|
50 if( KErrNone != ret ) |
|
51 { |
|
52 iPtrArray.Close(); |
|
53 iPtrCArray.Close(); |
|
54 User::Leave( ret ); |
|
55 } |
|
56 } |
|
57 } |
|
58 |
|
59 CMmCustomPtrHolder* CMmCustomPtrHolder::NewL( |
|
60 const TInt aSizeOfPtrArray, |
|
61 const TInt aSizeOfPtrCArray ) |
|
62 { |
|
63 |
|
64 CMmCustomPtrHolder* p = new ( ELeave ) CMmCustomPtrHolder(); |
|
65 CleanupStack::PushL( p ); |
|
66 p->ConstructL( aSizeOfPtrArray,aSizeOfPtrCArray ); |
|
67 CleanupStack::Pop(); |
|
68 |
|
69 return p; |
|
70 } |
|
71 |
|
72 CMmCustomPtrHolder::~CMmCustomPtrHolder() |
|
73 { |
|
74 iPtrArray.Close(); |
|
75 iPtrCArray.Close(); |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CMmCustomPtrHolder::Ptr |
|
80 // This method returns pointer from pointer array. |
|
81 // (other items were commented in a header). |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 TPtr8& CMmCustomPtrHolder::Ptr( |
|
85 const TInt aIndex ) |
|
86 { |
|
87 __ASSERT_ALWAYS( aIndex<iPtrArray.Count(), PanicClient( |
|
88 EEtelPanicIndexOutOfRange ) ); |
|
89 |
|
90 return iPtrArray[aIndex]; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CMmCustomPtrHolder::PtrC |
|
95 // This method returns pointer from pointer array. |
|
96 // (other items were commented in a header). |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 TPtrC8& CMmCustomPtrHolder::PtrC( |
|
100 const TInt aIndex ) |
|
101 { |
|
102 __ASSERT_ALWAYS( aIndex<iPtrCArray.Count(), PanicClient( |
|
103 EEtelPanicIndexOutOfRange ) ); |
|
104 |
|
105 return iPtrCArray[aIndex]; |
|
106 } |
|
107 |
|
108 // End of File |