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 PATHEXPRESSION_H 00036 #define PATHEXPRESSION_H 00037 00038 #include "expression.h" 00039 #include "pathexpressionadornment.h" 00040 #include "pathsteptagexpression.h" 00041 00042 // forward declarations 00043 class PathExpressionAdornment; 00044 00054 class PathExpression:public Expression { 00055 00056 public: 00060 PathExpression(); 00061 00065 virtual ~ PathExpression(); 00066 00073 inline void addPathStep(PathStepExpression * ps) { 00074 pathsteps.push_back(ps); 00075 } virtual void print(OutputStream & dos) const; 00079 00085 inline vector < PathStepExpression * >*getPathSteps() { 00086 return &pathsteps; 00087 } 00088 00094 inline unsigned getPathSize() { 00095 return pathsteps.size(); 00096 } 00097 00104 inline PathStepExpression *getPathStepAt(unsigned i) { 00105 return pathsteps[i]; 00106 } 00107 00113 PathStepExpression *getTailPathStep(); 00114 00120 PathStepExpression *getPathStepAfterTextNodeTest(); 00121 00127 unsigned getWeight(); 00128 00134 PathExpressionAdornment *getAdornment(); 00135 00143 inline bool isEmptyPath() { 00144 return pathsteps.size() == 0; 00145 } 00146 00155 bool isDosNodePath(); 00156 00164 bool isSyntacticallyEqualTo(PathExpression * path); 00165 00175 bool isSemanticallyContainedIn(PathExpression * path); 00176 00183 bool hasInnerTextNodeTest(); 00184 00191 bool hasTerminatingTextNodeTest(); 00192 00200 bool hasFollowingDescendantOrDosFrom(unsigned ps_idx); 00201 00209 bool hasPreviousDescendantOrDosUpTo(unsigned ps_idx); 00210 00217 bool selectsNoNode(); 00218 00226 bool containsStarDescendantSequence(unsigned pos); 00227 00248 bool mightHasChildDescendantConflict(PathExpression * path); 00249 00257 void replacePathStepAt(unsigned idx, PathStepExpression * ps); 00258 00264 PathExpression *clone(); 00265 00274 PathExpression *cloneWithoutFinalDosNodeAndAttributes(); 00275 00276 private: 00281 vector < PathStepExpression * >pathsteps; 00282 00287 PathExpressionAdornment *adornment; 00288 }; 00289 00290 #endif // PATHEXPRESSION_H