LCOV - code coverage report
Current view: top level - dom/xslt/xslt - txXPathResultComparator.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 7 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef TRANSFRMX_XPATHRESULTCOMPARATOR_H
       7             : #define TRANSFRMX_XPATHRESULTCOMPARATOR_H
       8             : 
       9             : #include "mozilla/Attributes.h"
      10             : #include "txCore.h"
      11             : #include "nsCOMPtr.h"
      12             : #include "nsICollation.h"
      13             : #include "nsString.h"
      14             : 
      15             : class Expr;
      16             : class txIEvalContext;
      17             : 
      18             : /*
      19             :  * Result comparators
      20             :  */
      21           0 : class txXPathResultComparator
      22             : {
      23             : public:
      24           0 :     virtual ~txXPathResultComparator()
      25           0 :     {
      26           0 :     }
      27             : 
      28             :     /*
      29             :      * Compares two XPath results. Returns -1 if val1 < val2,
      30             :      * 1 if val1 > val2 and 0 if val1 == val2.
      31             :      */
      32             :     virtual int compareValues(txObject* val1, txObject* val2) = 0;
      33             : 
      34             :     /*
      35             :      * Create a sortable value.
      36             :      */
      37             :     virtual nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
      38             :                                          txObject *&aResult) = 0;
      39             : };
      40             : 
      41             : /*
      42             :  * Compare results as stings (data-type="text")
      43             :  */
      44           0 : class txResultStringComparator : public txXPathResultComparator
      45             : {
      46             : public:
      47             :     txResultStringComparator(bool aAscending, bool aUpperFirst,
      48             :                              const nsString& aLanguage);
      49             : 
      50             :     int compareValues(txObject* aVal1, txObject* aVal2) override;
      51             :     nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
      52             :                                  txObject *&aResult) override;
      53             : private:
      54             :     nsCOMPtr<nsICollation> mCollation;
      55             :     nsresult init(const nsString& aLanguage);
      56             :     nsresult createRawSortKey(const int32_t aStrength,
      57             :                               const nsString& aString,
      58             :                               uint8_t** aKey,
      59             :                               uint32_t* aLength);
      60             :     int mSorting;
      61             : 
      62             :     class StringValue : public txObject
      63             :     {
      64             :     public:
      65             :         StringValue();
      66             :         ~StringValue();
      67             : 
      68             :         uint8_t* mKey;
      69             :         void* mCaseKey;
      70             :         uint32_t mLength, mCaseLength;
      71             :     };
      72             : };
      73             : 
      74             : /*
      75             :  * Compare results as numbers (data-type="number")
      76             :  */
      77           0 : class txResultNumberComparator : public txXPathResultComparator
      78             : {
      79             : public:
      80             :     explicit txResultNumberComparator(bool aAscending);
      81             : 
      82             :     int compareValues(txObject* aVal1, txObject* aVal2) override;
      83             :     nsresult createSortableValue(Expr *aExpr, txIEvalContext *aContext,
      84             :                                  txObject *&aResult) override;
      85             : 
      86             : private:
      87             :     int mAscending;
      88             : 
      89           0 :     class NumberValue : public txObject
      90             :     {
      91             :     public:
      92             :         double mVal;
      93             :     };
      94             : };
      95             : 
      96             : #endif

Generated by: LCOV version 1.13