1/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef __CHARACTER_IMPL__
17#define __CHARACTER_IMPL__
18
19#include "NodeImpl.h"
20#include "DOMString.h"
21
22class CharacterDataImpl : public NodeImpl
23{
24private:
25    DOMString* charData;
26public:
27
28     /**
29      * Default Constructor for CharacterDataImpl.
30      */
31     CharacterDataImpl();
32
33     /**
34      * Constructor for CharacterDataImpl.
35      * @param data The specify character data.
36      */
37     CharacterDataImpl(const DOMString* data);
38
39    /**
40     * The character data of the node that implements this interface. The DOM
41     * implementation may not put arbitrary limits on the amount of data
42     * that may be stored in a <code>CharacterData</code> node. However,
43     * implementation limits may mean that the entirety of a node's data may
44     * not fit into a single <code>DOMString</code>. In such cases, the user
45     * may call <code>substringData</code> to retrieve the data in
46     * appropriately sized pieces.
47     * @exception DOMException
48     *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
49     * @exception DOMException
50     *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
51     *   fit in a <code>DOMString</code> variable on the implementation
52     *   platform.
53     * @return the character data.
54     */
55    const DOMString* getData() const throw (DOMException);
56
57    /**
58     * The character data of the node that implements this interface. The DOM
59     * implementation may not put arbitrary limits on the amount of data
60     * that may be stored in a <code>CharacterData</code> node. However,
61     * implementation limits may mean that the entirety of a node's data may
62     * not fit into a single <code>DOMString</code>. In such cases, the user
63     * may call <code>substringData</code> to retrieve the data in
64     * appropriately sized pieces.
65     * @param data the specify character data.
66     * @exception DOMException
67     *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
68     * @exception DOMException
69     *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than
70     *   fit in a <code>DOMString</code> variable on the implementation
71     *   platform.
72     */
73    void setData(const DOMString* data) throw (DOMException);
74
75    /**
76     * The number of 16-bit units that are available through <code>data</code>
77     * and the <code>substringData</code> method below. This may have the
78     * value zero, i.e., <code>CharacterData</code> nodes may be empty.
79     * @return the size of characters data.
80     */
81    int getLength() const;
82
83    /**
84     * Append the string to the end of the character data of the node. Upon
85     * success, <code>data</code> provides access to the concatenation of
86     * <code>data</code> and the <code>DOMString</code> specified.
87     * @param arg The <code>DOMString</code> to append.
88     * @exception DOMException
89     *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
90     */
91    void appendData(const DOMString* arg) throw(DOMException);
92
93    /** Override getNodeValue() method in NodeImpl.h.*/
94    const DOMString* getNodeValue() const throw(DOMException);
95
96    /** Override setNodeValue() method in NodeImpl.h */
97    void setNodeValue(DOMString* nodeValue) throw(DOMException);
98
99    ~CharacterDataImpl();
100};
101#endif /*__CHARACTER_IMPL__*/
102
103