gecko-dev/dom/xslt/xpath/txExprResult.h

132 строки
3.0 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-05-21 15:12:37 +04:00
/* 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_EXPRRESULT_H
#define TRANSFRMX_EXPRRESULT_H
#include "nsString.h"
#include "nsAutoPtr.h"
#include "txCore.h"
#include "txResultRecycler.h"
/*
* ExprResult
*
* Classes Represented:
* BooleanResult, ExprResult, NumberResult, StringResult
*
* Note: for NodeSet, see NodeSet.h
*/
class txAExprResult
{
public:
friend class txResultRecycler;
// Update txLiteralExpr::getReturnType and sTypes in txEXSLTFunctions.cpp if
// this enum is changed.
2005-11-02 10:34:42 +03:00
enum ResultType {
NODESET = 0,
BOOLEAN,
NUMBER,
STRING,
RESULT_TREE_FRAGMENT
};
explicit txAExprResult(txResultRecycler* aRecycler) : mRecycler(aRecycler)
{
}
virtual ~txAExprResult()
{
}
void AddRef()
{
++mRefCnt;
NS_LOG_ADDREF(this, mRefCnt, "txAExprResult", sizeof(*this));
}
void Release(); // Implemented in txResultRecycler.cpp
/**
* Returns the type of ExprResult represented
* @return the type of ExprResult represented
**/
virtual short getResultType() = 0;
/**
* Creates a String representation of this ExprResult
* @param aResult the destination string to append the String
* representation to.
**/
virtual void stringValue(nsString& aResult) = 0;
/**
* Returns a pointer to the stringvalue if possible. Otherwise null is
* returned.
*/
virtual const nsString* stringValuePointer() = 0;
/**
* Converts this ExprResult to a Boolean (bool) value
* @return the Boolean value
**/
virtual bool booleanValue() = 0;
/**
* Converts this ExprResult to a Number (double) value
* @return the Number value
**/
virtual double numberValue() = 0;
private:
nsAutoRefCnt mRefCnt;
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<txResultRecycler> mRecycler;
};
#define TX_DECL_EXPRRESULT \
virtual short getResultType(); \
virtual void stringValue(nsString& aString); \
virtual const nsString* stringValuePointer(); \
virtual bool booleanValue(); \
virtual double numberValue(); \
class BooleanResult : public txAExprResult {
public:
explicit BooleanResult(bool aValue);
TX_DECL_EXPRRESULT
private:
bool value;
};
class NumberResult : public txAExprResult {
public:
NumberResult(double aValue, txResultRecycler* aRecycler);
TX_DECL_EXPRRESULT
double value;
};
class StringResult : public txAExprResult {
public:
explicit StringResult(txResultRecycler* aRecycler);
StringResult(const nsAString& aValue, txResultRecycler* aRecycler);
TX_DECL_EXPRRESULT
nsString mValue;
};
#endif