30 TInt CCreatorContactSet::LinkId() const |
30 TInt CCreatorContactSet::LinkId() const |
31 { |
31 { |
32 return iLinkId; |
32 return iLinkId; |
33 } |
33 } |
34 |
34 |
|
35 void CCreatorContactSet::AppendL(QContactLocalId aContactLink) |
|
36 { |
|
37 iContactLinks.AppendL(aContactLink); |
|
38 } |
|
39 |
|
40 RArray<QContactLocalId> CCreatorContactSet::ContactLinks() |
|
41 { |
|
42 return iContactLinks; |
|
43 } |
|
44 |
|
45 const RArray<QContactLocalId> CCreatorContactSet::ContactLinks() const |
|
46 { |
|
47 return iContactLinks; |
|
48 } |
|
49 |
|
50 |
|
51 TInt CCreatorContactSet::NumberOfExistingContacts() const |
|
52 { |
|
53 return iNumOfExistingContacts; |
|
54 } |
35 |
55 |
36 CCreatorContactSet::~CCreatorContactSet() |
56 CCreatorContactSet::~CCreatorContactSet() |
37 { |
57 { |
|
58 iContactLinks.Reset(); |
|
59 iContactLinks.Close(); |
38 } |
60 } |
39 |
61 |
40 |
62 |
41 CCreatorContactSet::CCreatorContactSet(TInt aLinkId, TInt aNumOfExistingContacts) |
63 CCreatorContactSet::CCreatorContactSet(TInt aLinkId, TInt aNumOfExistingContacts) |
42 { |
64 { |
48 { |
70 { |
49 public: |
71 public: |
50 static CContactLinkCacheImp* NewL(); |
72 static CContactLinkCacheImp* NewL(); |
51 virtual ~CContactLinkCacheImp(); |
73 virtual ~CContactLinkCacheImp(); |
52 virtual void AppendL(CCreatorContactSet* aContactSet); |
74 virtual void AppendL(CCreatorContactSet* aContactSet); |
|
75 |
|
76 virtual RArray<QContactLocalId> ContactLinks(TInt aLinkId); |
|
77 virtual const RArray<QContactLocalId> ContactLinks(TInt aLinkId) const; |
|
78 |
53 virtual RPointerArray<CCreatorContactSet>& ContactSets(); |
79 virtual RPointerArray<CCreatorContactSet>& ContactSets(); |
54 virtual const RPointerArray<CCreatorContactSet>& ContactSets() const; |
80 virtual const RPointerArray<CCreatorContactSet>& ContactSets() const; |
55 virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const; |
81 virtual const CCreatorContactSet& ContactSet(TInt aLinkId) const; |
56 virtual CCreatorContactSet& ContactSet(TInt aLinkId); |
82 virtual CCreatorContactSet& ContactSet(TInt aLinkId); |
57 |
83 |
58 private: |
84 private: |
59 void ConstructL(); |
85 void ConstructL(); |
60 CContactLinkCacheImp(); |
86 CContactLinkCacheImp(); |
|
87 |
|
88 RArray<QContactLocalId> iEmptyLinks; |
|
89 |
61 RPointerArray<CCreatorContactSet> iContactSets; |
90 RPointerArray<CCreatorContactSet> iContactSets; |
62 CCreatorContactSet* iDummyContactSet; |
91 CCreatorContactSet* iDummyContactSet; |
63 }; |
92 }; |
64 |
93 |
65 CContactLinkCacheImp* CContactLinkCacheImp::NewL() |
94 CContactLinkCacheImp* CContactLinkCacheImp::NewL() |
81 : iDummyContactSet(0) |
110 : iDummyContactSet(0) |
82 {} |
111 {} |
83 |
112 |
84 CContactLinkCacheImp::~CContactLinkCacheImp() |
113 CContactLinkCacheImp::~CContactLinkCacheImp() |
85 { |
114 { |
|
115 iEmptyLinks.Reset();// just in case... |
|
116 iEmptyLinks.Close(); |
|
117 |
86 iContactSets.ResetAndDestroy(); |
118 iContactSets.ResetAndDestroy(); |
87 iContactSets.Close(); |
119 iContactSets.Close(); |
88 delete iDummyContactSet; |
120 delete iDummyContactSet; |
89 } |
121 } |
90 void CContactLinkCacheImp::AppendL(CCreatorContactSet* aContactSet) |
122 void CContactLinkCacheImp::AppendL(CCreatorContactSet* aContactSet) |
91 { |
123 { |
92 iContactSets.AppendL(aContactSet); |
124 iContactSets.AppendL(aContactSet); |
93 } |
125 } |
|
126 RArray<QContactLocalId> CContactLinkCacheImp::ContactLinks(TInt aLinkId) |
|
127 { |
|
128 for( TInt i = 0; i < iContactSets.Count(); ++i ) |
|
129 { |
|
130 if( iContactSets[i]->LinkId() == aLinkId ) |
|
131 { |
|
132 return iContactSets[i]->ContactLinks(); |
|
133 } |
|
134 } |
|
135 return iEmptyLinks; |
|
136 } |
|
137 |
|
138 const RArray<QContactLocalId> CContactLinkCacheImp::ContactLinks(TInt aLinkId) const |
|
139 { |
|
140 for( TInt i = 0; i < iContactSets.Count(); ++i ) |
|
141 { |
|
142 if( iContactSets[i]->LinkId() == aLinkId ) |
|
143 { |
|
144 return iContactSets[i]->ContactLinks(); |
|
145 } |
|
146 } |
|
147 return iEmptyLinks; |
|
148 } |
|
149 |
94 |
150 |
95 const CCreatorContactSet& CContactLinkCacheImp::ContactSet(TInt aLinkId) const |
151 const CCreatorContactSet& CContactLinkCacheImp::ContactSet(TInt aLinkId) const |
96 { |
152 { |
97 for( TInt i = 0; i < iContactSets.Count(); ++i ) |
153 for( TInt i = 0; i < iContactSets.Count(); ++i ) |
98 { |
154 { |