00001 00002 /* 00003 | Author: Michael Schmidt; 00004 | Gunnar Jehl 00005 | 00006 | ************************* SOFTWARE LICENSE AGREEMENT *********************** 00007 | This source code is published under the BSD License. 00008 | 00009 | See file 'LICENSE.txt' that comes with this distribution or 00010 | http://dbis.informatik.uni-freiburg.de/index.php?project=GCX/license.php 00011 | for the full license agreement. 00012 | 00013 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00014 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00016 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00017 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00018 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00019 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00020 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00021 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00022 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00023 | POSSIBILITY OF SUCH DAMAGE. 00024 | **************************************************************************** 00025 */ 00026 00035 #ifndef PATHSTEPEXPRESSION_H 00036 #define PATHSTEPEXPRESSION_H 00037 00038 #include "expression.h" 00039 #include "pathstepattribute.h" 00040 00047 #define WEIGHT_AXIS_CHILD 1 00048 00055 #define WEIGHT_AXIS_DESCENDANT 3 00056 00063 #define WEIGHT_AXIS_DOS 3 00064 00071 #define WEIGHT_INNER_NODETEST 1 00072 00081 class PathStepExpression:public Expression { 00082 00083 public: 00091 PathStepExpression(EXP_TYPE _type, AXIS_TYPE _axis, 00092 PathStepAttribute * _attribute); 00093 00097 virtual ~ PathStepExpression(); 00098 00105 virtual void print(OutputStream & dos) const = 0; 00106 00112 inline AXIS_TYPE getAxisType() { 00113 return axis; 00114 } inline void setAxisType(AXIS_TYPE _axis) { 00121 axis = _axis; 00122 } 00123 00129 NODETEST_TYPE getNodeTestType(); 00130 00137 inline PathStepAttribute *getAttribute() { 00138 return attribute; 00139 } 00140 00147 inline void setAttribute(PathStepAttribute * _attribute) { 00148 attribute = _attribute; 00149 } 00150 00158 unsigned getStepWeight(bool is_last_step); 00159 00166 inline bool isTagNodeTest() { 00167 return type == et_pathsteptag; 00168 } 00169 00176 inline bool isStarNodeTest() { 00177 return type == et_pathstepstar; 00178 } 00179 00186 inline bool isNodeNodeTest() { 00187 return type == et_pathstepnode; 00188 } 00189 00196 inline bool isTextNodeTest() { 00197 return type == et_pathsteptext; 00198 } 00199 00200 00207 inline bool isDosNodeStep() { 00208 return axis == at_dos && type == et_pathstepnode; 00209 } 00210 00218 bool isSyntacticallyEqualTo(PathStepExpression * ps); 00219 00227 virtual bool isMatchingTag(TAG tag) = 0; 00228 00235 inline bool hasAttribute() { 00236 return attribute != NULL; 00237 } 00238 00244 virtual PathStepExpression *clone() = 0; 00245 00254 virtual PathStepExpression *cloneWithoutAttributes() = 0; 00255 00256 protected: 00261 AXIS_TYPE axis; 00262 00268 PathStepAttribute *attribute; 00269 }; 00270 00271 #endif // PATHSTEPEXPRESSION_H