Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/xslt/xslt/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  txXPathResultComparator.h

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef TRANSFRMX_XPATHRESULTCOMPARATOR_H
#define TRANSFRMX_XPATHRESULTCOMPARATOR_H

#include "mozilla/UniquePtr.h"
#include "mozilla/intl/Collator.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "txCore.h"

class Expr;
class txIEvalContext;

/*
 * Result comparators
 */

class txXPathResultComparator {
 public:
  virtual ~txXPathResultComparator() = default;

  /*
   * Compares two XPath results. Returns -1 if val1 < val2,
   * 1 if val1 > val2 and 0 if val1 == val2.
   */

  virtual int compareValues(txObject* val1, txObject* val2) = 0;

  /*
   * Create a sortable value. This always needs to return a value, but can
   * indicate failure in the nsresult.
   */

  virtual std::pair<mozilla::UniquePtr<txObject>, nsresult> createSortableValue(
      Expr* aExpr, txIEvalContext* aContext) = 0;
};

/*
 * Compare results as strings (data-type="text")
 */

class txResultStringComparator : public txXPathResultComparator {
 public:
  txResultStringComparator(bool aAscending, bool aUpperFirst);
  nsresult init(const nsACString& aLanguage, bool aResistFingerPrinting);

  int compareValues(txObject* aVal1, txObject* aVal2) override;
  std::pair<mozilla::UniquePtr<txObject>, nsresult> createSortableValue(
      Expr* aExpr, txIEvalContext* aContext) override;

 private:
  mozilla::UniquePtr<const mozilla::intl::Collator> mCollator;
  int mSorting;

  class StringValue : public txObject {
   public:
    explicit StringValue(mozilla::UniquePtr<nsString> aString)
        : mString(std::move(aString)) {}

    mozilla::UniquePtr<nsString> mString;
  };
};

/*
 * Compare results as numbers (data-type="number")
 */

class txResultNumberComparator : public txXPathResultComparator {
 public:
  explicit txResultNumberComparator(bool aAscending);

  int compareValues(txObject* aVal1, txObject* aVal2) override;
  std::pair<mozilla::UniquePtr<txObject>, nsresult> createSortableValue(
      Expr* aExpr, txIEvalContext* aContext) override;

 private:
  int mAscending;

  class NumberValue : public txObject {
   public:
    explicit NumberValue(double aVal) : mVal(aVal) {}

    double mVal;
  };
};

#endif

Messung V0.5 in Prozent
C=94 H=100 G=96

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.