LCOV - code coverage report
Current view: directory - content/xslt/src/xslt - txExecutionState.h (source / functions) Found Hit Coverage
Test: app.info Lines: 16 0 0.0 %
Date: 2012-06-02 Functions: 7 0 0.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                 :  * Jonas Sicking.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2002
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Jonas Sicking <jonas@sicking.cc>
      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                 : #ifndef TRANSFRMX_TXEXECUTIONSTATE_H
      40                 : #define TRANSFRMX_TXEXECUTIONSTATE_H
      41                 : 
      42                 : #include "txCore.h"
      43                 : #include "txStack.h"
      44                 : #include "txXMLUtils.h"
      45                 : #include "txIXPathContext.h"
      46                 : #include "txVariableMap.h"
      47                 : #include "nsTHashtable.h"
      48                 : #include "nsHashKeys.h"
      49                 : #include "txKey.h"
      50                 : #include "txStylesheet.h"
      51                 : #include "txXPathTreeWalker.h"
      52                 : #include "nsTArray.h"
      53                 : 
      54                 : class txAOutputHandlerFactory;
      55                 : class txAXMLEventHandler;
      56                 : class txInstruction;
      57                 : class txIOutputHandlerFactory;
      58                 : 
      59                 : class txLoadedDocumentEntry : public nsStringHashKey
      60                 : {
      61                 : public:
      62               0 :     txLoadedDocumentEntry(KeyTypePointer aStr) : nsStringHashKey(aStr),
      63               0 :                                                  mLoadResult(NS_OK)
      64                 :     {
      65               0 :     }
      66                 :     txLoadedDocumentEntry(const txLoadedDocumentEntry& aToCopy)
      67                 :         : nsStringHashKey(aToCopy)
      68                 :     {
      69                 :         NS_ERROR("We're horked.");
      70                 :     }
      71               0 :     ~txLoadedDocumentEntry()
      72               0 :     {
      73               0 :         if (mDocument) {
      74               0 :             txXPathNodeUtils::release(mDocument);
      75                 :         }
      76               0 :     }
      77               0 :     bool LoadingFailed()
      78                 :     {
      79               0 :         NS_ASSERTION(NS_SUCCEEDED(mLoadResult) || !mDocument,
      80                 :                      "Load failed but we still got a document?");
      81                 : 
      82               0 :         return NS_FAILED(mLoadResult);
      83                 :     }
      84                 : 
      85                 :     nsAutoPtr<txXPathNode> mDocument;
      86                 :     nsresult mLoadResult;
      87                 : };
      88                 : 
      89                 : class txLoadedDocumentsHash : public nsTHashtable<txLoadedDocumentEntry>
      90               0 : {
      91                 : public:
      92                 :     ~txLoadedDocumentsHash();
      93                 :     nsresult init(txXPathNode* aSourceDocument);
      94                 : 
      95                 : private:
      96                 :     friend class txExecutionState;
      97                 :     txXPathNode* mSourceDocument;
      98                 : };
      99                 : 
     100                 : 
     101                 : class txExecutionState : public txIMatchContext
     102                 : {
     103                 : public:
     104                 :     txExecutionState(txStylesheet* aStylesheet, bool aDisableLoads);
     105                 :     ~txExecutionState();
     106                 :     nsresult init(const txXPathNode& aNode,
     107                 :                   txOwningExpandedNameMap<txIGlobalParameter>* aGlobalParams);
     108                 :     nsresult end(nsresult aResult);
     109                 : 
     110                 :     TX_DECL_MATCH_CONTEXT;
     111                 : 
     112                 :     /**
     113                 :      * Struct holding information about a current template rule
     114                 :      */
     115               0 :     class TemplateRule {
     116                 :     public:
     117                 :         txStylesheet::ImportFrame* mFrame;
     118                 :         PRInt32 mModeNsId;
     119                 :         nsCOMPtr<nsIAtom> mModeLocalName;
     120                 :         txVariableMap* mParams;
     121                 :     };
     122                 : 
     123                 :     // Stack functions
     124                 :     nsresult pushEvalContext(txIEvalContext* aContext);
     125                 :     txIEvalContext* popEvalContext();
     126                 :     nsresult pushBool(bool aBool);
     127                 :     bool popBool();
     128                 :     nsresult pushResultHandler(txAXMLEventHandler* aHandler);
     129                 :     txAXMLEventHandler* popResultHandler();
     130                 :     void pushTemplateRule(txStylesheet::ImportFrame* aFrame,
     131                 :                           const txExpandedName& aMode,
     132                 :                           txVariableMap* aParams);
     133                 :     void popTemplateRule();
     134                 :     nsresult pushParamMap(txVariableMap* aParams);
     135                 :     txVariableMap* popParamMap();
     136                 : 
     137                 :     // state-getting functions
     138                 :     txIEvalContext* getEvalContext();
     139                 :     const txXPathNode* retrieveDocument(const nsAString& aUri);
     140                 :     nsresult getKeyNodes(const txExpandedName& aKeyName,
     141                 :                          const txXPathNode& aRoot,
     142                 :                          const nsAString& aKeyValue, bool aIndexIfNotFound,
     143                 :                          txNodeSet** aResult);
     144                 :     TemplateRule* getCurrentTemplateRule();
     145               0 :     const txXPathNode& getSourceDocument()
     146                 :     {
     147               0 :         NS_ASSERTION(mLoadedDocuments.mSourceDocument,
     148                 :                      "Need a source document!");
     149                 : 
     150               0 :         return *mLoadedDocuments.mSourceDocument;
     151                 :     }
     152                 : 
     153                 :     // state-modification functions
     154                 :     txInstruction* getNextInstruction();
     155                 :     nsresult runTemplate(txInstruction* aInstruction);
     156                 :     nsresult runTemplate(txInstruction* aInstruction,
     157                 :                          txInstruction* aReturnTo);
     158                 :     void gotoInstruction(txInstruction* aNext);
     159                 :     void returnFromTemplate();
     160                 :     nsresult bindVariable(const txExpandedName& aName,
     161                 :                           txAExprResult* aValue);
     162                 :     void removeVariable(const txExpandedName& aName);
     163                 : 
     164                 :     txAXMLEventHandler* mOutputHandler;
     165                 :     txAXMLEventHandler* mResultHandler;
     166                 :     nsAutoPtr<txAXMLEventHandler> mObsoleteHandler;
     167                 :     txAOutputHandlerFactory* mOutputHandlerFactory;
     168                 : 
     169                 :     nsAutoPtr<txVariableMap> mTemplateParams;
     170                 : 
     171                 :     nsRefPtr<txStylesheet> mStylesheet;
     172                 : 
     173                 : private:
     174                 :     txStack mReturnStack;
     175                 :     txStack mLocalVarsStack;
     176                 :     txStack mEvalContextStack;
     177                 :     nsTArray<bool> mBoolStack;
     178                 :     txStack mResultHandlerStack;
     179                 :     txStack mParamStack;
     180                 :     txInstruction* mNextInstruction;
     181                 :     txVariableMap* mLocalVariables;
     182                 :     txVariableMap mGlobalVariableValues;
     183                 :     nsRefPtr<txAExprResult> mGlobalVarPlaceholderValue;
     184                 :     PRInt32 mRecursionDepth;
     185                 : 
     186                 :     AutoInfallibleTArray<TemplateRule, 10> mTemplateRules;
     187                 : 
     188                 :     txIEvalContext* mEvalContext;
     189                 :     txIEvalContext* mInitialEvalContext;
     190                 :     //Document* mRTFDocument;
     191                 :     txOwningExpandedNameMap<txIGlobalParameter>* mGlobalParams;
     192                 : 
     193                 :     txLoadedDocumentsHash mLoadedDocuments;
     194                 :     txKeyHash mKeyHash;
     195                 :     nsRefPtr<txResultRecycler> mRecycler;
     196                 :     bool mDisableLoads;
     197                 : 
     198                 :     static const PRInt32 kMaxRecursionDepth;
     199                 : };
     200                 : 
     201                 : #endif

Generated by: LCOV version 1.7