| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> |
| 3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 private: | 58 private: |
| 59 virtual Value evaluate() const; | 59 virtual Value evaluate() const; |
| 60 virtual Value::Type resultType() const { return Value::NumberValue;
} | 60 virtual Value::Type resultType() const { return Value::NumberValue;
} |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 class NumericOp : public Expression { | 63 class NumericOp : public Expression { |
| 64 public: | 64 public: |
| 65 enum Opcode { | 65 enum Opcode { |
| 66 OP_Add, OP_Sub, OP_Mul, OP_Div, OP_Mod | 66 OP_Add, OP_Sub, OP_Mul, OP_Div, OP_Mod |
| 67 }; | 67 }; |
| 68 NumericOp(Opcode, Expression* lhs, Expression* rhs); | 68 NumericOp(Opcode, PassOwnPtr<Expression> lhs, PassOwnPtr<Expression>
rhs); |
| 69 private: | 69 private: |
| 70 virtual Value evaluate() const; | 70 virtual Value evaluate() const; |
| 71 virtual Value::Type resultType() const { return Value::NumberValue;
} | 71 virtual Value::Type resultType() const { return Value::NumberValue;
} |
| 72 | 72 |
| 73 Opcode m_opcode; | 73 Opcode m_opcode; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class EqTestOp : public Expression { | 76 class EqTestOp : public Expression { |
| 77 public: | 77 public: |
| 78 enum Opcode { OP_EQ, OP_NE, OP_GT, OP_LT, OP_GE, OP_LE }; | 78 enum Opcode { OP_EQ, OP_NE, OP_GT, OP_LT, OP_GE, OP_LE }; |
| 79 EqTestOp(Opcode, Expression* lhs, Expression* rhs); | 79 EqTestOp(Opcode, PassOwnPtr<Expression> lhs, PassOwnPtr<Expression>
rhs); |
| 80 virtual Value evaluate() const; | 80 virtual Value evaluate() const; |
| 81 private: | 81 private: |
| 82 virtual Value::Type resultType() const { return Value::BooleanValue;
} | 82 virtual Value::Type resultType() const { return Value::BooleanValue;
} |
| 83 bool compare(const Value&, const Value&) const; | 83 bool compare(const Value&, const Value&) const; |
| 84 | 84 |
| 85 Opcode m_opcode; | 85 Opcode m_opcode; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class LogicalOp : public Expression { | 88 class LogicalOp : public Expression { |
| 89 public: | 89 public: |
| 90 enum Opcode { OP_And, OP_Or }; | 90 enum Opcode { OP_And, OP_Or }; |
| 91 LogicalOp(Opcode, Expression* lhs, Expression* rhs); | 91 LogicalOp(Opcode, PassOwnPtr<Expression> lhs, PassOwnPtr<Expression>
rhs); |
| 92 private: | 92 private: |
| 93 virtual Value::Type resultType() const { return Value::BooleanValue;
} | 93 virtual Value::Type resultType() const { return Value::BooleanValue;
} |
| 94 bool shortCircuitOn() const; | 94 bool shortCircuitOn() const; |
| 95 virtual Value evaluate() const; | 95 virtual Value evaluate() const; |
| 96 | 96 |
| 97 Opcode m_opcode; | 97 Opcode m_opcode; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 class Union : public Expression { | 100 class Union : public Expression { |
| 101 private: | 101 private: |
| 102 virtual Value evaluate() const; | 102 virtual Value evaluate() const; |
| 103 virtual Value::Type resultType() const { return Value::NodeSetValue;
} | 103 virtual Value::Type resultType() const { return Value::NodeSetValue;
} |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 class Predicate { | 106 class Predicate { |
| 107 WTF_MAKE_NONCOPYABLE(Predicate); WTF_MAKE_FAST_ALLOCATED; | 107 WTF_MAKE_NONCOPYABLE(Predicate); WTF_MAKE_FAST_ALLOCATED; |
| 108 public: | 108 public: |
| 109 explicit Predicate(Expression*); | 109 explicit Predicate(PassOwnPtr<Expression>); |
| 110 ~Predicate(); | 110 ~Predicate(); |
| 111 bool evaluate() const; | 111 bool evaluate() const; |
| 112 | 112 |
| 113 bool isContextPositionSensitive() const { return m_expr->isContextPo
sitionSensitive() || m_expr->resultType() == Value::NumberValue; } | 113 bool isContextPositionSensitive() const { return m_expr->isContextPo
sitionSensitive() || m_expr->resultType() == Value::NumberValue; } |
| 114 bool isContextSizeSensitive() const { return m_expr->isContextSizeSe
nsitive(); } | 114 bool isContextSizeSensitive() const { return m_expr->isContextSizeSe
nsitive(); } |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 Expression* m_expr; | 117 OwnPtr<Expression> m_expr; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } | 120 } |
| 121 | 121 |
| 122 } | 122 } |
| 123 | 123 |
| 124 #endif // XPathPredicate_h | 124 #endif // XPathPredicate_h |
| OLD | NEW |