LCOV - code coverage report
Current view: directory - content/xslt/src/xpath - txExprParser.h (source / functions) Found Hit Coverage
Test: app.info Lines: 2 2 100.0 %
Date: 2012-06-02 Functions: 1 1 100.0 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (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                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is TransforMiiX XSLT processor code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * The MITRE Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1999
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Keith Visco <kvisco@ziplink.net> (Original Author)
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : /**
      40                 :  * ExprParser
      41                 :  * This class is used to parse XSL Expressions
      42                 :  * @see ExprLexer
      43                 : **/
      44                 : 
      45                 : #ifndef MITREXSL_EXPRPARSER_H
      46                 : #define MITREXSL_EXPRPARSER_H
      47                 : 
      48                 : #include "txCore.h"
      49                 : #include "nsAutoPtr.h"
      50                 : #include "nsString.h"
      51                 : 
      52                 : class AttributeValueTemplate;
      53                 : class Expr;
      54                 : class txExprLexer;
      55                 : class FunctionCall;
      56                 : class LocationStep;
      57                 : class nsIAtom;
      58                 : class PredicateList;
      59                 : class Token;
      60                 : class txIParseContext;
      61                 : class txNodeTest;
      62                 : class txNodeTypeTest;
      63                 : 
      64                 : class txExprParser
      65                 : {
      66                 : public:
      67                 : 
      68              42 :     static nsresult createExpr(const nsSubstring& aExpression,
      69                 :                                txIParseContext* aContext, Expr** aExpr)
      70                 :     {
      71              42 :         return createExprInternal(aExpression, 0, aContext, aExpr);
      72                 :     }
      73                 : 
      74                 :     /**
      75                 :      * Creates an Attribute Value Template using the given value
      76                 :      */
      77                 :     static nsresult createAVT(const nsSubstring& aAttrValue,
      78                 :                               txIParseContext* aContext,
      79                 :                               Expr** aResult);
      80                 : 
      81                 : 
      82                 : protected:
      83                 :     static nsresult createExprInternal(const nsSubstring& aExpression,
      84                 :                                        PRUint32 aSubStringPos,
      85                 :                                        txIParseContext* aContext,
      86                 :                                        Expr** aExpr);
      87                 :     /**
      88                 :      * Using nsAutoPtr& to optimize passing the ownership to the
      89                 :      * created binary expression objects.
      90                 :      */
      91                 :     static nsresult createBinaryExpr(nsAutoPtr<Expr>& left,
      92                 :                                      nsAutoPtr<Expr>& right, Token* op,
      93                 :                                      Expr** aResult);
      94                 :     static nsresult createExpr(txExprLexer& lexer, txIParseContext* aContext,
      95                 :                                Expr** aResult);
      96                 :     static nsresult createFilterOrStep(txExprLexer& lexer,
      97                 :                                        txIParseContext* aContext,
      98                 :                                        Expr** aResult);
      99                 :     static nsresult createFunctionCall(txExprLexer& lexer,
     100                 :                                        txIParseContext* aContext,
     101                 :                                        Expr** aResult);
     102                 :     static nsresult createLocationStep(txExprLexer& lexer,
     103                 :                                        txIParseContext* aContext,
     104                 :                                        Expr** aResult);
     105                 :     static nsresult createNodeTypeTest(txExprLexer& lexer,
     106                 :                                        txNodeTest** aResult);
     107                 :     static nsresult createPathExpr(txExprLexer& lexer,
     108                 :                                    txIParseContext* aContext,
     109                 :                                    Expr** aResult);
     110                 :     static nsresult createUnionExpr(txExprLexer& lexer,
     111                 :                                     txIParseContext* aContext,
     112                 :                                     Expr** aResult);
     113                 :                   
     114                 :     static bool isLocationStepToken(Token* aToken);
     115                 :                   
     116                 :     static short precedence(Token* aToken);
     117                 : 
     118                 :     /**
     119                 :      * Resolve a QName, given the mContext parse context.
     120                 :      * Returns prefix and localName as well as namespace ID
     121                 :      */
     122                 :     static nsresult resolveQName(const nsAString& aQName, nsIAtom** aPrefix,
     123                 :                                  txIParseContext* aContext,
     124                 :                                  nsIAtom** aLocalName, PRInt32& aNamespace,
     125                 :                                  bool aIsNameTest = false);
     126                 : 
     127                 :     /**
     128                 :      * Using the given lexer, parses the tokens if they represent a
     129                 :      * predicate list
     130                 :      * If an error occurs a non-zero String pointer will be returned
     131                 :      * containing the error message.
     132                 :      * @param predicateList, the PredicateList to add predicate expressions to
     133                 :      * @param lexer the ExprLexer to use for parsing tokens
     134                 :      * @return 0 if successful, or a String pointer to the error message
     135                 :      */
     136                 :     static nsresult parsePredicates(PredicateList* aPredicateList,
     137                 :                                     txExprLexer& lexer,
     138                 :                                     txIParseContext* aContext);
     139                 :     static nsresult parseParameters(FunctionCall* aFnCall, txExprLexer& lexer,
     140                 :                                     txIParseContext* aContext);
     141                 : 
     142                 : };
     143                 : 
     144                 : #endif

Generated by: LCOV version 1.7