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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // All memory chunk data functions
24 #ifndef XMLENGCHUNKCONTAINER_H
25 #define XMLENGCHUNKCONTAINER_H
27 #include <xml/dom/xmlengdatacontainer.h>
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.
36 This class is most often instantiated by calling
37 RXmlEngDocument::CreateChunkContainerL().
39 Sample code for creating chunk container:
41 RXmlEngDOMImplementation domImpl;
42 domImpl.OpenL(); // opening DOM implementation object
44 // create document element
45 TXmlEngElement elem = iDoc.CreateDocumentElementL(_L8("doc"));
46 // create RChunk object with chunkName name and size
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
62 class TXmlEngChunkContainer : public TXmlEngDataContainer
65 /** Get memory chunk reference
66 @return Memory chunk reference
68 IMPORT_C RChunk& Chunk() const;
70 /** Get offset of binary data in memory chunk
71 @return Offset of binary data in memory chunk
73 IMPORT_C TUint ChunkOffset() const;
76 /** Default constructor */
77 inline TXmlEngChunkContainer();
81 @param aInternal node pointer
83 inline TXmlEngChunkContainer(void* aInternal);
88 #include <xml/dom/xmlengchunkcontainer.inl>
90 #endif /* XMLENGCHUNKCONTAINER_H */