|
1 // Copyright (c) 2001-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 */ |
|
19 |
|
20 #ifndef __GMXMLCHARACTERDATA_H__ |
|
21 #define __GMXMLCHARACTERDATA_H__ |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 #include <gmxmlnode.h> |
|
26 |
|
27 class CMDXMLCharacterData : public CMDXMLNode |
|
28 /** Base class for text sections, such as CDATA sections, comments and processing |
|
29 instructions, of an XML file. |
|
30 |
|
31 Objects with this interface contain text, but cannot have child nodes. |
|
32 @publishedPartner |
|
33 @released |
|
34 */ |
|
35 { |
|
36 public: |
|
37 /** Destructor. */ |
|
38 IMPORT_C virtual ~CMDXMLCharacterData(); |
|
39 |
|
40 /** Gets the text of the section. |
|
41 |
|
42 @return The text of the section */ |
|
43 IMPORT_C virtual TDesC& Data(); |
|
44 |
|
45 /** Sets the whole of the section text. |
|
46 |
|
47 @param aData Text to set |
|
48 @leave KErrNoMemory Memory allocation failed */ |
|
49 IMPORT_C virtual void SetDataL( TDesC& aData ); |
|
50 |
|
51 /** Gets the length of the section text. |
|
52 |
|
53 @return Returns the length of the text */ |
|
54 IMPORT_C virtual TInt Length(); |
|
55 |
|
56 /** Appends text to the section. |
|
57 |
|
58 @param aData The text to append. |
|
59 @leave KErrNoMemory Memory allocation failed */ |
|
60 IMPORT_C virtual void AppendL( TDesC& aData ); |
|
61 |
|
62 /** Inserts text at a specified point in the section. |
|
63 |
|
64 @param aInsertPos The position at which to insert the text. 0 means insert |
|
65 at the start. |
|
66 @param aData Text to insert |
|
67 @leave KErrNoMemory Memory allocation failed |
|
68 @return Returns KErrNone if successful or KErrNotFound if the insert position |
|
69 is out of range */ |
|
70 IMPORT_C virtual TInt InsertL( TInt aInsertPos, TDesC& aData ); |
|
71 |
|
72 /** Replaces a block of text in the section. |
|
73 |
|
74 @param aInsertPos The position at which to insert the text. 0 means insert |
|
75 at the start. |
|
76 @param aLength The number of characters to replace |
|
77 @param aData The text to insert |
|
78 @leave KErrNoMemory Memory allocation failed |
|
79 @return Returns KErrNone if successful or KErrNotFoundif the replace block |
|
80 is out of range */ |
|
81 IMPORT_C virtual TInt ReplaceL( TInt aInsertPos, TInt aLength, TDesC& aData ); |
|
82 |
|
83 |
|
84 /** Check the children of this node for validity. |
|
85 |
|
86 For a character data section, there can be no children so this is always true. |
|
87 |
|
88 @return Always true. */ |
|
89 IMPORT_C virtual TBool CheckChildren(); |
|
90 |
|
91 protected: |
|
92 /* |
|
93 * Constructor |
|
94 * @param aNodeType The node type of the derived object |
|
95 * @param aOwnerDocument The Document at the root of the DOM tree. |
|
96 */ |
|
97 CMDXMLCharacterData( TDOMNodeType aNodeType, CMDXMLDocument* aOwnerDocument ); |
|
98 |
|
99 private: |
|
100 HBufC* iData; // Buffer to hold the actual text of the CDATA section |
|
101 }; |
|
102 |
|
103 |
|
104 #endif |