LCOV - code coverage report
Current view: directory - content/xslt/src/xslt - txXPathResultComparator.h (source / functions) Found Hit Coverage
Test: app.info Lines: 7 0 0.0 %
Date: 2012-06-02 Functions: 10 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) 2001
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Jonas Sicking <sicking@bigfoot.com>
      24                 :  *   Peter Van der Beken <peterv@propagandism.org>
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      28                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 : 
      40                 : #ifndef TRANSFRMX_XPATHRESULTCOMPARATOR_H
      41                 : #define TRANSFRMX_XPATHRESULTCOMPARATOR_H
      42                 : 
      43                 : #include "txCore.h"
      44                 : #include "nsCOMPtr.h"
      45                 : #include "nsICollation.h"
      46                 : #include "nsString.h"
      47                 : 
      48                 : class Expr;
      49                 : class txIEvalContext;
      50                 : 
      51                 : /*
      52                 :  * Result comparators
      53                 :  */
      54                 : class txXPathResultComparator
      55               0 : {
      56                 : public:
      57               0 :     virtual ~txXPathResultComparator()
      58               0 :     {
      59               0 :     }
      60                 : 
      61                 :     /*
      62                 :      * Compares two XPath results. Returns -1 if val1 < val2,
      63                 :      * 1 if val1 > val2 and 0 if val1 == val2.
      64                 :      */
      65                 :     virtual int compareValues(txObject* val1, txObject* val2) = 0;
      66                 :     
      67                 :     /*
      68                 :      * Create a sortable value.
      69                 :      */
      70                 :     virtual nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
      71                 :                                          txObject *&aResult) = 0;
      72                 : };
      73                 : 
      74                 : /*
      75                 :  * Compare results as stings (data-type="text")
      76                 :  */
      77                 : class txResultStringComparator : public txXPathResultComparator
      78               0 : {
      79                 : public:
      80                 :     txResultStringComparator(bool aAscending, bool aUpperFirst,
      81                 :                              const nsAFlatString& aLanguage);
      82                 : 
      83                 :     int compareValues(txObject* aVal1, txObject* aVal2);
      84                 :     nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
      85                 :                                  txObject *&aResult);
      86                 : private:
      87                 :     nsCOMPtr<nsICollation> mCollation;
      88                 :     nsresult init(const nsAFlatString& aLanguage);
      89                 :     nsresult createRawSortKey(const PRInt32 aStrength,
      90                 :                               const nsString& aString,
      91                 :                               PRUint8** aKey,
      92                 :                               PRUint32* aLength);
      93                 :     int mSorting;
      94                 : 
      95                 :     class StringValue : public txObject
      96                 :     {
      97                 :     public:
      98                 :         StringValue();
      99                 :         ~StringValue();
     100                 : 
     101                 :         PRUint8* mKey;
     102                 :         void* mCaseKey;
     103                 :         PRUint32 mLength, mCaseLength;
     104                 :     };
     105                 : };
     106                 : 
     107                 : /*
     108                 :  * Compare results as numbers (data-type="number")
     109                 :  */
     110                 : class txResultNumberComparator : public txXPathResultComparator
     111               0 : {
     112                 : public:
     113                 :     txResultNumberComparator(bool aAscending);
     114                 : 
     115                 :     int compareValues(txObject* aVal1, txObject* aVal2);
     116                 :     nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
     117                 :                                  txObject *&aResult);
     118                 : 
     119                 : private:
     120                 :     int mAscending;
     121                 : 
     122                 :     class NumberValue : public txObject
     123               0 :     {
     124                 :     public:
     125                 :         double mVal;
     126                 :     };
     127                 : };
     128                 : 
     129                 : #endif

Generated by: LCOV version 1.7