40 // FORWARD DECLARATIONS |
40 // FORWARD DECLARATIONS |
41 |
41 |
42 |
42 |
43 // ============================= LOCAL FUNCTIONS =============================== |
43 // ============================= LOCAL FUNCTIONS =============================== |
44 |
44 |
45 |
45 |
46 // ============================ MEMBER FUNCTIONS =============================== |
46 // ============================ MEMBER FUNCTIONS =============================== |
47 |
47 |
48 // ----------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
49 // CDRMParentStorage::CDRMParentStorage |
49 // CDRMParentStorage::CDRMParentStorage |
50 // |
50 // |
51 // Default constructor |
51 // Default constructor |
52 // ----------------------------------------------------------------------------- |
52 // ----------------------------------------------------------------------------- |
53 // |
53 // |
54 CDRMParentStorage::CDRMParentStorage(): |
54 CDRMParentStorage::CDRMParentStorage(): |
55 iParents( 1 ) |
55 iParents( 1 ) |
56 { |
56 { |
57 } |
57 } |
58 |
58 |
59 // ----------------------------------------------------------------------------- |
59 // ----------------------------------------------------------------------------- |
60 // CDRMParentStorage::~CDRMParentStorage |
60 // CDRMParentStorage::~CDRMParentStorage |
61 // |
61 // |
62 // Desetructor. |
62 // Desetructor. |
63 // ----------------------------------------------------------------------------- |
63 // ----------------------------------------------------------------------------- |
67 if ( iParentIDs ) |
67 if ( iParentIDs ) |
68 { |
68 { |
69 iParentIDs->Reset(); |
69 iParentIDs->Reset(); |
70 delete iParentIDs; |
70 delete iParentIDs; |
71 } |
71 } |
72 |
72 |
73 // The lists inside are autocleaning, so deletion causes |
73 // The lists inside are autocleaning, so deletion causes |
74 // the contents to also be deleted |
74 // the contents to also be deleted |
75 iParents.ResetAndDestroy(); |
75 iParents.ResetAndDestroy(); |
76 } |
76 } |
77 |
77 |
78 // ----------------------------------------------------------------------------- |
78 // ----------------------------------------------------------------------------- |
79 // CDRMParentStorage::NewLC |
79 // CDRMParentStorage::NewLC |
80 // |
80 // |
81 // Two-phase constructor |
81 // Two-phase constructor |
82 // ----------------------------------------------------------------------------- |
82 // ----------------------------------------------------------------------------- |
83 // |
83 // |
84 CDRMParentStorage* CDRMParentStorage::NewLC() |
84 CDRMParentStorage* CDRMParentStorage::NewLC() |
85 { |
85 { |
86 CDRMParentStorage* self = new( ELeave ) CDRMParentStorage; |
86 CDRMParentStorage* self = new( ELeave ) CDRMParentStorage; |
87 CleanupStack::PushL( self ); |
87 CleanupStack::PushL( self ); |
88 |
88 |
89 self->ConstructL(); |
89 self->ConstructL(); |
90 |
90 |
91 return self; |
91 return self; |
92 } |
92 } |
93 |
93 |
94 // ----------------------------------------------------------------------------- |
94 // ----------------------------------------------------------------------------- |
95 // CDRMParentStorage::NewL |
95 // CDRMParentStorage::NewL |
96 // |
96 // |
97 // Two-phase constructor |
97 // Two-phase constructor |
98 // ----------------------------------------------------------------------------- |
98 // ----------------------------------------------------------------------------- |
99 // |
99 // |
100 CDRMParentStorage* CDRMParentStorage::NewL() |
100 CDRMParentStorage* CDRMParentStorage::NewL() |
101 { |
101 { |
102 CDRMParentStorage* self = CDRMParentStorage::NewLC(); |
102 CDRMParentStorage* self = CDRMParentStorage::NewLC(); |
103 CleanupStack::Pop(); // sefl |
103 CleanupStack::Pop(); // sefl |
104 |
104 |
105 return self; |
105 return self; |
106 } |
106 } |
107 |
107 |
108 // ----------------------------------------------------------------------------- |
108 // ----------------------------------------------------------------------------- |
109 // CDRMParentStorage::ConstructL |
109 // CDRMParentStorage::ConstructL |
110 // |
110 // |
111 // 2nd phase constructor |
111 // 2nd phase constructor |
112 // ----------------------------------------------------------------------------- |
112 // ----------------------------------------------------------------------------- |
113 // |
113 // |
114 void CDRMParentStorage::ConstructL() |
114 void CDRMParentStorage::ConstructL() |
115 { |
115 { |
116 iParentIDs = new( ELeave ) CDesC8ArraySeg( KDefaultGranularity ); |
116 iParentIDs = new( ELeave ) CDesC8ArraySeg( KDefaultGranularity ); |
117 } |
117 } |
118 |
118 |
119 // ----------------------------------------------------------------------------- |
119 // ----------------------------------------------------------------------------- |
120 // CDRMParentStorage::NewListL |
120 // CDRMParentStorage::NewListL |
121 // |
121 // |
122 // Insert a new list to the storage, and return a handle to it. |
122 // Insert a new list to the storage, and return a handle to it. |
123 // ----------------------------------------------------------------------------- |
123 // ----------------------------------------------------------------------------- |
124 // |
124 // |
125 CDRMPermissionList& CDRMParentStorage::NewListL() |
125 CDRMPermissionList& CDRMParentStorage::NewListL() |
126 { |
126 { |
127 __ASSERT_DEBUG( iParents.Count() >= iParentIDs->Count(), User::Invariant() ); |
127 __ASSERT_DEBUG( iParents.Count() >= iParentIDs->Count(), User::Invariant() ); |
128 |
128 |
129 if ( iParents.Count() == iParentIDs->Count() ) |
129 if ( iParents.Count() == iParentIDs->Count() ) |
130 { |
130 { |
131 // Balanced lists. |
131 // Balanced lists. |
132 CDRMPermissionList* newList = CDRMPermissionList::NewLC(); |
132 CDRMPermissionList* newList = CDRMPermissionList::NewLC(); |
133 newList->SetAutoCleanup( ETrue ); |
133 newList->SetAutoCleanup( ETrue ); |
134 |
134 |
135 iParents.AppendL( newList ); |
135 iParents.AppendL( newList ); |
136 CleanupStack::Pop(); |
136 CleanupStack::Pop(); |
137 } |
137 } |
138 |
138 |
139 return *( iParents[ iParents.Count() - 1 ] ); |
139 return *( iParents[ iParents.Count() - 1 ] ); |
140 } |
140 } |
141 |
141 |
142 // ----------------------------------------------------------------------------- |
142 // ----------------------------------------------------------------------------- |
143 // CDRMParentStorage::AddL |
143 // CDRMParentStorage::AddL |
144 // |
144 // |
145 // Add an entry to the ID table. |
145 // Add an entry to the ID table. |
146 // ----------------------------------------------------------------------------- |
146 // ----------------------------------------------------------------------------- |