2005-11-02 07:37:50 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2005-11-02 07:37:50 +00:00
|
|
|
|
|
|
|
#ifndef __TX_XPATH_SET_CONTEXT
|
|
|
|
#define __TX_XPATH_SET_CONTEXT
|
|
|
|
|
|
|
|
#include "txIXPathContext.h"
|
2005-11-02 07:41:38 +00:00
|
|
|
#include "txNodeSet.h"
|
2005-11-02 07:40:48 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2005-11-02 07:38:37 +00:00
|
|
|
|
2005-11-02 07:37:50 +00:00
|
|
|
class txNodeSetContext : public txIEvalContext
|
|
|
|
{
|
|
|
|
public:
|
2005-11-02 07:41:38 +00:00
|
|
|
txNodeSetContext(txNodeSet* aContextNodeSet, txIMatchContext* aContext)
|
2005-11-02 07:37:50 +00:00
|
|
|
: mContextSet(aContextNodeSet), mPosition(0), mInner(aContext)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// Iteration over the given NodeSet
|
2011-11-10 19:26:13 +00:00
|
|
|
bool hasNext()
|
2005-11-02 07:37:50 +00:00
|
|
|
{
|
|
|
|
return mPosition < size();
|
|
|
|
}
|
|
|
|
void next()
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mPosition < size(), "Out of bounds.");
|
|
|
|
mPosition++;
|
|
|
|
}
|
2012-08-22 15:56:38 +00:00
|
|
|
void setPosition(uint32_t aPosition)
|
2005-11-02 07:41:23 +00:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aPosition > 0 &&
|
|
|
|
aPosition <= size(), "Out of bounds.");
|
|
|
|
mPosition = aPosition;
|
|
|
|
}
|
2005-11-02 07:37:50 +00:00
|
|
|
|
|
|
|
TX_DECL_EVAL_CONTEXT;
|
|
|
|
|
2005-11-02 07:40:09 +00:00
|
|
|
protected:
|
2005-11-02 07:41:38 +00:00
|
|
|
nsRefPtr<txNodeSet> mContextSet;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mPosition;
|
2005-11-02 07:37:50 +00:00
|
|
|
txIMatchContext* mInner;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __TX_XPATH_SET_CONTEXT
|