|
1 /* |
|
2 * Copyright (c) 2007 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: SIMPLE Engine simple content |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 // *** system include files go here: |
|
23 #include <e32std.h> |
|
24 #include <s32strm.h> |
|
25 #include "simplecontent.h" |
|
26 #include "simplecommon.h" |
|
27 |
|
28 |
|
29 // *** local constants go here: |
|
30 |
|
31 |
|
32 // ---------------------------------------------------------- |
|
33 // CSimpleContent::CSimpleContent |
|
34 // ---------------------------------------------------------- |
|
35 // |
|
36 CSimpleContent::CSimpleContent( ) |
|
37 { |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CSimpleContent::~CSimpleContent |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 CSimpleContent::~CSimpleContent() |
|
45 { |
|
46 delete iContentID; |
|
47 delete iContentType; |
|
48 delete iBody; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CSimpleContent::NewL |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CSimpleContent* CSimpleContent::NewL( |
|
56 const TDesC8& aContentID, const TDesC8& aContentType ) |
|
57 { |
|
58 CSimpleContent* self = CSimpleContent::NewLC( |
|
59 aContentID, aContentType ); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CSimpleContent::NewLC |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CSimpleContent* CSimpleContent::NewLC( |
|
69 const TDesC8& aContentID, const TDesC8& aContentType ) |
|
70 { |
|
71 CSimpleContent* self = new( ELeave ) CSimpleContent; |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructL( aContentID, aContentType ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 // CSimpleContent::Body |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 TPtrC8 CSimpleContent::Body() |
|
82 { |
|
83 return iBody ? iBody->Des() : TPtrC8(); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CSimpleContent::GiveBodyOwnerShip |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 HBufC8* CSimpleContent::GiveBodyOwnerShip() |
|
91 { |
|
92 HBufC8* body = iBody; |
|
93 iBody = NULL; |
|
94 return body; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CSimpleContent::Close |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CSimpleContent::Close() |
|
102 { |
|
103 delete this; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // CSimpleContent::ConstructL |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 void CSimpleContent::ConstructL( |
|
111 const TDesC8& aContentID, const TDesC8& aContentType ) |
|
112 { |
|
113 iContentID = aContentID.AllocL(); |
|
114 iContentType = aContentType.AllocL(); |
|
115 } |
|
116 |
|
117 |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // CSimpleContent::CopyBodyL |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 void CSimpleContent::CopyBodyL( const TDesC8& aData ) |
|
124 { |
|
125 delete iBody; |
|
126 iBody = NULL; |
|
127 iBody = aData.AllocL(); |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // CSimpleContent::SetBody |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 void CSimpleContent::SetBody( HBufC8* aData ) |
|
135 { |
|
136 delete iBody; |
|
137 iBody = aData; |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // CSimpleContent::ContentID |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 TPtrC8 CSimpleContent::ContentID() |
|
145 { |
|
146 return iContentID ? iContentID->Des() : TPtrC8(); |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // CSimpleContent::ContentType |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 TPtrC8 CSimpleContent::ContentType() |
|
154 { |
|
155 return iContentType ? iContentType->Des() : TPtrC8(); |
|
156 } |
|
157 |
|
158 |
|
159 |