|
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 // All memory chunk data functions |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedAll |
|
22 @released |
|
23 */ |
|
24 #ifndef XMLENGCHUNKCONTAINER_H |
|
25 #define XMLENGCHUNKCONTAINER_H |
|
26 |
|
27 #include <xml/dom/xmlengdatacontainer.h> |
|
28 |
|
29 |
|
30 /** |
|
31 This class stores a reference to a RChunk handle within the DOM tree. No |
|
32 ownership is tranferred and the client is expected to close the RChunk when it |
|
33 is no longer required. Multiple chunk containers can refer to the same RChunk, |
|
34 regardless of whether the offsets overlap. |
|
35 |
|
36 This class is most often instantiated by calling |
|
37 RXmlEngDocument::CreateChunkContainerL(). |
|
38 |
|
39 Sample code for creating chunk container: |
|
40 @code |
|
41 RXmlEngDOMImplementation domImpl; |
|
42 domImpl.OpenL(); // opening DOM implementation object |
|
43 RXmlEngDocument iDoc; |
|
44 // create document element |
|
45 TXmlEngElement elem = iDoc.CreateDocumentElementL(_L8("doc")); |
|
46 // create RChunk object with chunkName name and size |
|
47 RChunk chunk; |
|
48 chunk.CreateGlobal(chunkName, size, maxSize); |
|
49 CleanupClosePushL(chunk); |
|
50 // create chunk container from Rchunk object with offset to the |
|
51 // binary data in chunk and binary data size in chunk (binarySize) |
|
52 TXmlEngChunkContainer binData = iDoc.CreateChunkContainerL( |
|
53 cid,chunk,offset,binarySize); |
|
54 // append chunkcontainer to the dom tree |
|
55 TXmlEngNode ref = iDoc.DocumentElement().AppendChildL(binData); |
|
56 // closing all opened objects |
|
57 CleanupStack::PopAndDestroy(); //chunk |
|
58 iDoc.Close(); |
|
59 domImpl.Close(); |
|
60 @endcode |
|
61 */ |
|
62 class TXmlEngChunkContainer : public TXmlEngDataContainer |
|
63 { |
|
64 public: |
|
65 /** Get memory chunk reference |
|
66 @return Memory chunk reference |
|
67 */ |
|
68 IMPORT_C RChunk& Chunk() const; |
|
69 |
|
70 /** Get offset of binary data in memory chunk |
|
71 @return Offset of binary data in memory chunk |
|
72 */ |
|
73 IMPORT_C TUint ChunkOffset() const; |
|
74 |
|
75 protected: |
|
76 /** Default constructor */ |
|
77 inline TXmlEngChunkContainer(); |
|
78 |
|
79 /** |
|
80 Constructor |
|
81 @param aInternal node pointer |
|
82 */ |
|
83 inline TXmlEngChunkContainer(void* aInternal); |
|
84 }; |
|
85 |
|
86 |
|
87 |
|
88 #include <xml/dom/xmlengchunkcontainer.inl> |
|
89 |
|
90 #endif /* XMLENGCHUNKCONTAINER_H */ |
|
91 |