[2674] | 1 | /* |
---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 3 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 4 | * this work for additional information regarding copyright ownership. |
---|
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 6 | * (the "License"); you may not use this file except in compliance with |
---|
| 7 | * the License. You may obtain a copy of the License at |
---|
| 8 | * |
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 10 | * |
---|
| 11 | * Unless required by applicable law or agreed to in writing, software |
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 14 | * See the License for the specific language governing permissions and |
---|
| 15 | * limitations under the License. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | /* |
---|
| 19 | * $Id: DOM_Range.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | #ifndef DOM_Range_HEADER_GUARD_ |
---|
| 23 | #define DOM_Range_HEADER_GUARD_ |
---|
| 24 | |
---|
| 25 | #include <xercesc/util/XercesDefs.hpp> |
---|
| 26 | #include "DOM_Node.hpp" |
---|
| 27 | #include "DOMString.hpp" |
---|
| 28 | #include "DOM_DocumentFragment.hpp" |
---|
| 29 | |
---|
| 30 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | class RangeImpl; |
---|
| 34 | |
---|
| 35 | //class RangeImpl; |
---|
| 36 | |
---|
| 37 | class DEPRECATED_DOM_EXPORT DOM_Range { |
---|
| 38 | public: |
---|
| 39 | |
---|
| 40 | enum CompareHow { |
---|
| 41 | START_TO_START = 0, |
---|
| 42 | START_TO_END = 1, |
---|
| 43 | END_TO_END = 2, |
---|
| 44 | END_TO_START = 3 |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | //c'tor & d'tor |
---|
| 48 | DOM_Range(); |
---|
| 49 | DOM_Range(const DOM_Range& other); |
---|
| 50 | ~DOM_Range(); |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | DOM_Range & operator = (const DOM_Range &other); |
---|
| 54 | DOM_Range & operator = (const DOM_NullPtr *other); |
---|
| 55 | bool operator != (const DOM_Range & other) const; |
---|
| 56 | bool operator == (const DOM_Range & other) const; |
---|
| 57 | bool operator != (const DOM_NullPtr * other) const; |
---|
| 58 | bool operator == (const DOM_NullPtr * other) const; |
---|
| 59 | |
---|
| 60 | //getter functions |
---|
| 61 | DOM_Node getStartContainer() const; |
---|
| 62 | unsigned int getStartOffset() const; |
---|
| 63 | DOM_Node getEndContainer() const; |
---|
| 64 | unsigned int getEndOffset() const; |
---|
| 65 | bool getCollapsed() const; |
---|
| 66 | const DOM_Node getCommonAncestorContainer() const; |
---|
| 67 | |
---|
| 68 | //setter functions |
---|
| 69 | void setStart(const DOM_Node &parent, unsigned int offset); |
---|
| 70 | void setEnd(const DOM_Node &parent, unsigned int offset); |
---|
| 71 | |
---|
| 72 | void setStartBefore(const DOM_Node &refNode); |
---|
| 73 | void setStartAfter(const DOM_Node &refNode); |
---|
| 74 | void setEndBefore(const DOM_Node &refNode); |
---|
| 75 | void setEndAfter(const DOM_Node &refNode); |
---|
| 76 | |
---|
| 77 | //misc functions |
---|
| 78 | void collapse(bool toStart); |
---|
| 79 | void selectNode(const DOM_Node &node); |
---|
| 80 | void selectNodeContents(const DOM_Node &node); |
---|
| 81 | |
---|
| 82 | //Functions related to comparing range Boundrary-Points |
---|
| 83 | short compareBoundaryPoints(CompareHow how, const DOM_Range& range) const; |
---|
| 84 | void deleteContents(); |
---|
| 85 | DOM_DocumentFragment extractContents(); |
---|
| 86 | DOM_DocumentFragment cloneContents() const; |
---|
| 87 | void insertNode(DOM_Node& node); |
---|
| 88 | //Misc functions |
---|
| 89 | void surroundContents(DOM_Node &node); |
---|
| 90 | DOM_Range cloneRange() const; |
---|
| 91 | DOMString toString() const; |
---|
| 92 | void detach(); |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | protected: |
---|
| 98 | |
---|
| 99 | DOM_Range(RangeImpl *); |
---|
| 100 | RangeImpl *fImpl; |
---|
| 101 | |
---|
| 102 | friend class DOM_Document; |
---|
| 103 | }; |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | XERCES_CPP_NAMESPACE_END |
---|
| 109 | |
---|
| 110 | #endif |
---|