1 | /*
|
---|
2 | * Copyright 1999-2002,2004 The Apache Software Foundation.
|
---|
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 |
|
---|
17 | /*
|
---|
18 | * $Id: DOM_Range.hpp,v 1.5 2004/09/08 13:55:43 peiyongz Exp $
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef DOM_Range_HEADER_GUARD_
|
---|
22 | #define DOM_Range_HEADER_GUARD_
|
---|
23 |
|
---|
24 | #include <xercesc/util/XercesDefs.hpp>
|
---|
25 | #include "DOM_Node.hpp"
|
---|
26 | #include "DOMString.hpp"
|
---|
27 | #include "DOM_DocumentFragment.hpp"
|
---|
28 |
|
---|
29 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
30 |
|
---|
31 |
|
---|
32 | class RangeImpl;
|
---|
33 |
|
---|
34 | //class RangeImpl;
|
---|
35 |
|
---|
36 | class DEPRECATED_DOM_EXPORT DOM_Range {
|
---|
37 | public:
|
---|
38 |
|
---|
39 | enum CompareHow {
|
---|
40 | START_TO_START = 0,
|
---|
41 | START_TO_END = 1,
|
---|
42 | END_TO_END = 2,
|
---|
43 | END_TO_START = 3
|
---|
44 | };
|
---|
45 |
|
---|
46 | //c'tor & d'tor
|
---|
47 | DOM_Range();
|
---|
48 | DOM_Range(const DOM_Range& other);
|
---|
49 | ~DOM_Range();
|
---|
50 |
|
---|
51 |
|
---|
52 | DOM_Range & operator = (const DOM_Range &other);
|
---|
53 | DOM_Range & operator = (const DOM_NullPtr *other);
|
---|
54 | bool operator != (const DOM_Range & other) const;
|
---|
55 | bool operator == (const DOM_Range & other) const;
|
---|
56 | bool operator != (const DOM_NullPtr * other) const;
|
---|
57 | bool operator == (const DOM_NullPtr * other) const;
|
---|
58 |
|
---|
59 | //getter functions
|
---|
60 | DOM_Node getStartContainer() const;
|
---|
61 | unsigned int getStartOffset() const;
|
---|
62 | DOM_Node getEndContainer() const;
|
---|
63 | unsigned int getEndOffset() const;
|
---|
64 | bool getCollapsed() const;
|
---|
65 | const DOM_Node getCommonAncestorContainer() const;
|
---|
66 |
|
---|
67 | //setter functions
|
---|
68 | void setStart(const DOM_Node &parent, unsigned int offset);
|
---|
69 | void setEnd(const DOM_Node &parent, unsigned int offset);
|
---|
70 |
|
---|
71 | void setStartBefore(const DOM_Node &refNode);
|
---|
72 | void setStartAfter(const DOM_Node &refNode);
|
---|
73 | void setEndBefore(const DOM_Node &refNode);
|
---|
74 | void setEndAfter(const DOM_Node &refNode);
|
---|
75 |
|
---|
76 | //misc functions
|
---|
77 | void collapse(bool toStart);
|
---|
78 | void selectNode(const DOM_Node &node);
|
---|
79 | void selectNodeContents(const DOM_Node &node);
|
---|
80 |
|
---|
81 | //Functions related to comparing range Boundrary-Points
|
---|
82 | short compareBoundaryPoints(CompareHow how, const DOM_Range& range) const;
|
---|
83 | void deleteContents();
|
---|
84 | DOM_DocumentFragment extractContents();
|
---|
85 | DOM_DocumentFragment cloneContents() const;
|
---|
86 | void insertNode(DOM_Node& node);
|
---|
87 | //Misc functions
|
---|
88 | void surroundContents(DOM_Node &node);
|
---|
89 | DOM_Range cloneRange() const;
|
---|
90 | DOMString toString() const;
|
---|
91 | void detach();
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | protected:
|
---|
97 |
|
---|
98 | DOM_Range(RangeImpl *);
|
---|
99 | RangeImpl *fImpl;
|
---|
100 |
|
---|
101 | friend class DOM_Document;
|
---|
102 | };
|
---|
103 |
|
---|
104 |
|
---|
105 |
|
---|
106 |
|
---|
107 | XERCES_CPP_NAMESPACE_END
|
---|
108 |
|
---|
109 | #endif
|
---|