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