|
1 /* |
|
2 * Copyright (c) 2004 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: Notification Event object base class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "DRMEventModify.h" |
|
22 |
|
23 // EXTERNAL DATA STRUCTURES |
|
24 // EXTERNAL FUNCTION PROTOTYPES |
|
25 // CONSTANTS |
|
26 // MACROS |
|
27 // LOCAL CONSTANTS AND MACROS |
|
28 // MODULE DATA STRUCTURES |
|
29 // LOCAL FUNCTION PROTOTYPES |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CDRMEventModify::NewLC |
|
38 // Two phased constructor |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 EXPORT_C CDRMEventModify* CDRMEventModify::NewLC() |
|
42 { |
|
43 CDRMEventModify* self = new (ELeave) CDRMEventModify( 0 ); |
|
44 CleanupStack::PushL( self ); |
|
45 return self; |
|
46 }; |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CDRMEventModify::NewL |
|
50 // Two phased constructor |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 EXPORT_C CDRMEventModify* CDRMEventModify::NewL() |
|
54 { |
|
55 CDRMEventModify* self = NewLC(); |
|
56 CleanupStack::Pop(); |
|
57 return self; |
|
58 }; |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CDRMEventModify::CDRMEventModify |
|
62 // C++ default constructor can NOT contain any code, that |
|
63 // might leave. |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CDRMEventModify::CDRMEventModify( TUint32 aUniqueID ) : |
|
67 MDRMEvent( KEventModify ), |
|
68 iContentID( NULL ), |
|
69 iUniqueID( aUniqueID ) |
|
70 { |
|
71 }; |
|
72 |
|
73 // Destructor |
|
74 EXPORT_C CDRMEventModify::~CDRMEventModify() |
|
75 { |
|
76 if( iContentID ) |
|
77 { |
|
78 delete iContentID; |
|
79 } |
|
80 }; |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CDRMEventModify::SetContentIDL |
|
84 // Reserves memory for the content id, if one has been defined it is freed |
|
85 // (other items were commented in a header). |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C void CDRMEventModify::SetContentIDL( const TDesC8& aContentID ) |
|
89 { |
|
90 if ( iContentID ) |
|
91 { |
|
92 delete iContentID; |
|
93 iContentID = NULL; |
|
94 } |
|
95 iContentID = aContentID.AllocL(); |
|
96 }; |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CDRMEventModify::SetUniqueID |
|
100 // sets the unique id variable |
|
101 // (other items were commented in a header). |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C void CDRMEventModify::SetUniqueID( const TUint32 aUniqueID ) |
|
105 { |
|
106 iUniqueID = aUniqueID; |
|
107 }; |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CDRMEventModify::Status |
|
111 // returns the unique id variable |
|
112 // (other items were commented in a header). |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 EXPORT_C TUint32 CDRMEventModify::UniqueID() const |
|
116 { |
|
117 return iUniqueID; |
|
118 }; |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CDRMEventModify::GetContentIDL |
|
122 // returns the content id as parameter |
|
123 // (other items were commented in a header). |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 EXPORT_C HBufC8* CDRMEventModify::GetContentIDL() const |
|
127 { |
|
128 return iContentID->AllocL(); |
|
129 }; |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CDRMEventModify::ExternalizeL |
|
133 // Writes the data of the object into the given stream |
|
134 // (other items were commented in a header). |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 EXPORT_C void CDRMEventModify::ExternalizeL( |
|
138 RWriteStream& aOutput) |
|
139 { |
|
140 TInt outputLength = 0; |
|
141 |
|
142 MDRMEvent::ExternalizeL(aOutput); |
|
143 |
|
144 // get the output length of the HBufC8* |
|
145 outputLength = iContentID->Size(); |
|
146 aOutput.WriteInt32L(outputLength); |
|
147 |
|
148 // write out the HBufC8* |
|
149 aOutput.WriteL(*iContentID); |
|
150 |
|
151 // this implementation may need to be changed if the size of the enum changes |
|
152 aOutput.WriteUint32L(iUniqueID); |
|
153 }; |
|
154 |
|
155 |
|
156 // --------------------------------------------------------------------------- -- |
|
157 // CDRMEventModify::Internalize |
|
158 // Reads the data of the object from the given stream |
|
159 // (other items were commented in a header). |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 EXPORT_C void CDRMEventModify::InternalizeL( |
|
163 RReadStream& aInput) |
|
164 { |
|
165 TInt inputLength = 0; |
|
166 |
|
167 MDRMEvent::InternalizeL(aInput); |
|
168 |
|
169 // Read the length of the HBufC8* |
|
170 inputLength = aInput.ReadInt32L(); |
|
171 |
|
172 // Reserve the HBufC8* |
|
173 if( !iContentID ) |
|
174 { |
|
175 iContentID = HBufC8::NewL(inputLength); |
|
176 } |
|
177 else |
|
178 { |
|
179 iContentID->ReAllocL(inputLength); |
|
180 } |
|
181 |
|
182 // Read the HBufC8* |
|
183 TPtr8 inRead(iContentID->Des()); |
|
184 aInput.ReadL(inRead,inputLength); |
|
185 |
|
186 // this implementation may need to be changed if the size of the enum changes |
|
187 iUniqueID = aInput.ReadUint32L(); |
|
188 }; |
|
189 |
|
190 // End of File |