author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 3 | e1b950c65cb4 |
permissions | -rw-r--r-- |
williamr@4 | 1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 2 |
// All rights reserved. |
williamr@4 | 3 |
// This component and the accompanying materials are made available |
williamr@4 | 4 |
// under the terms of "Eclipse Public License v1.0" |
williamr@4 | 5 |
// which accompanies this distribution, and is available |
williamr@4 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 7 |
// |
williamr@4 | 8 |
// Initial Contributors: |
williamr@4 | 9 |
// Nokia Corporation - initial contribution. |
williamr@4 | 10 |
// |
williamr@4 | 11 |
// Contributors: |
williamr@4 | 12 |
// |
williamr@4 | 13 |
// Description: |
williamr@4 | 14 |
// All memory chunk data functions |
williamr@4 | 15 |
// |
williamr@2 | 16 |
|
williamr@2 | 17 |
|
williamr@2 | 18 |
|
williamr@2 | 19 |
/** |
williamr@4 | 20 |
@file |
williamr@4 | 21 |
@publishedAll |
williamr@4 | 22 |
@released |
williamr@4 | 23 |
*/ |
williamr@4 | 24 |
#ifndef XMLENGCHUNKCONTAINER_H |
williamr@4 | 25 |
#define XMLENGCHUNKCONTAINER_H |
williamr@4 | 26 |
|
williamr@4 | 27 |
#include <xml/dom/xmlengdatacontainer.h> |
williamr@4 | 28 |
|
williamr@4 | 29 |
|
williamr@4 | 30 |
/** |
williamr@4 | 31 |
This class stores a reference to a RChunk handle within the DOM tree. No |
williamr@4 | 32 |
ownership is tranferred and the client is expected to close the RChunk when it |
williamr@4 | 33 |
is no longer required. Multiple chunk containers can refer to the same RChunk, |
williamr@4 | 34 |
regardless of whether the offsets overlap. |
williamr@4 | 35 |
|
williamr@4 | 36 |
This class is most often instantiated by calling |
williamr@4 | 37 |
RXmlEngDocument::CreateChunkContainerL(). |
williamr@4 | 38 |
|
williamr@4 | 39 |
Sample code for creating chunk container: |
williamr@4 | 40 |
@code |
williamr@4 | 41 |
RXmlEngDOMImplementation domImpl; |
williamr@4 | 42 |
domImpl.OpenL(); // opening DOM implementation object |
williamr@4 | 43 |
RXmlEngDocument iDoc; |
williamr@4 | 44 |
// create document element |
williamr@4 | 45 |
TXmlEngElement elem = iDoc.CreateDocumentElementL(_L8("doc")); |
williamr@4 | 46 |
// create RChunk object with chunkName name and size |
williamr@4 | 47 |
RChunk chunk; |
williamr@4 | 48 |
chunk.CreateGlobal(chunkName, size, maxSize); |
williamr@4 | 49 |
CleanupClosePushL(chunk); |
williamr@4 | 50 |
// create chunk container from Rchunk object with offset to the |
williamr@4 | 51 |
// binary data in chunk and binary data size in chunk (binarySize) |
williamr@4 | 52 |
TXmlEngChunkContainer binData = iDoc.CreateChunkContainerL( |
williamr@4 | 53 |
cid,chunk,offset,binarySize); |
williamr@4 | 54 |
// append chunkcontainer to the dom tree |
williamr@4 | 55 |
TXmlEngNode ref = iDoc.DocumentElement().AppendChildL(binData); |
williamr@4 | 56 |
// closing all opened objects |
williamr@4 | 57 |
CleanupStack::PopAndDestroy(); //chunk |
williamr@4 | 58 |
iDoc.Close(); |
williamr@4 | 59 |
domImpl.Close(); |
williamr@4 | 60 |
@endcode |
williamr@2 | 61 |
*/ |
williamr@2 | 62 |
class TXmlEngChunkContainer : public TXmlEngDataContainer |
williamr@2 | 63 |
{ |
williamr@2 | 64 |
public: |
williamr@4 | 65 |
/** Get memory chunk reference |
williamr@4 | 66 |
@return Memory chunk reference |
williamr@4 | 67 |
*/ |
williamr@2 | 68 |
IMPORT_C RChunk& Chunk() const; |
williamr@2 | 69 |
|
williamr@4 | 70 |
/** Get offset of binary data in memory chunk |
williamr@4 | 71 |
@return Offset of binary data in memory chunk |
williamr@4 | 72 |
*/ |
williamr@2 | 73 |
IMPORT_C TUint ChunkOffset() const; |
williamr@2 | 74 |
|
williamr@2 | 75 |
protected: |
williamr@4 | 76 |
/** Default constructor */ |
williamr@2 | 77 |
inline TXmlEngChunkContainer(); |
williamr@2 | 78 |
|
williamr@2 | 79 |
/** |
williamr@4 | 80 |
Constructor |
williamr@4 | 81 |
@param aInternal node pointer |
williamr@4 | 82 |
*/ |
williamr@2 | 83 |
inline TXmlEngChunkContainer(void* aInternal); |
williamr@2 | 84 |
}; |
williamr@2 | 85 |
|
williamr@2 | 86 |
|
williamr@2 | 87 |
|
williamr@4 | 88 |
#include <xml/dom/xmlengchunkcontainer.inl> |
williamr@2 | 89 |
|
williamr@4 | 90 |
#endif /* XMLENGCHUNKCONTAINER_H */ |
williamr@4 | 91 |