not part of build, code by peterv, r=me, fixing XPathProcessor, nsISynchLoader, cleanup

git-svn-id: svn://10.0.0.236/trunk@85178 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
axel%pike.org
2001-01-19 21:24:44 +00:00
parent 561a3dc878
commit fb545a174e
12 changed files with 219 additions and 131 deletions

View File

@@ -27,36 +27,23 @@
* Olivier Gerardin, ogerardin@vo.lu
* -- fixed numberValue()
*
* $Id: NodeSet.cpp,v 1.4 2001-01-12 20:06:35 axel%pike.org Exp $
* $Id: NodeSet.cpp,v 1.5 2001-01-19 21:24:41 axel%pike.org Exp $
*/
#include "NodeSet.h"
#include "XMLDOMUtils.h"
#ifndef MOZ_XSL
#include <iostream.h>
#else
#include "nsDOMCID.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIScriptGlobalObject.h"
#include "nsIServiceManager.h"
#endif
/**
* NodeSet <BR />
* This class was ported from XSL:P. <BR />
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @version $Revision: 1.4 $ $Date: 2001-01-12 20:06:35 $
* @version $Revision: 1.5 $ $Date: 2001-01-19 21:24:41 $
**/
#ifdef MOZ_XSL
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
NS_IMPL_ISUPPORTS2(NodeSet,
nsIDOMNodeList,
nsIScriptObjectOwner)
#endif
//-------------/
//- Constants -/
//-------------/
@@ -94,11 +81,6 @@ NodeSet::NodeSet(const NodeSet& source) {
* Helper method for Constructors
**/
void NodeSet::initialize(int size) {
#ifdef MOZ_XSL
NS_INIT_ISUPPORTS();
mScriptObject = nsnull;
#endif
elements = new Node*[size];
for ( int i = 0; i < size; i++ ) elements[i] = 0;
elementCount = 0;
@@ -211,19 +193,6 @@ Node* NodeSet::get(int index) {
return elements[index];
} //-- get
#ifdef MOZ_XSL
NS_IMETHODIMP NodeSet::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
if ((aIndex < 0) || aIndex >= (UInt32)elementCount) return NS_ERROR_INVALID_ARG;
Node* aNode = elements[aIndex];
if (!aNode) return NS_ERROR_INVALID_ARG;
*aReturn = aNode->getNSNode();
return NS_OK;
} //-- Item
#endif
/**
* Returns the index of the specified Node,
* or -1 if the Node is not contained in the NodeSet
@@ -283,15 +252,6 @@ int NodeSet::size() const{
return elementCount;
} //-- size
#ifdef MOZ_XSL
NS_IMETHODIMP NodeSet::GetLength(PRUint32* aLength)
{
*aLength = elementCount;
return NS_OK;
} //-- GetLength
#endif
/**
* Creates a String representation of this NodeSet
* @param str the destination string to append the String representation to.
@@ -392,42 +352,3 @@ void NodeSet::stringValue(String& str) {
XMLDOMUtils::getNodeValue(get(0), &str);
}
} //-- stringValue
#ifdef MOZ_XSL
/*
* nsIScriptObjectOwner
*/
NS_IMETHODIMP
NodeSet::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
{
nsresult rv = NS_OK;
nsIScriptGlobalObject* global = aContext->GetGlobalObject();
if (nsnull == mScriptObject) {
nsIDOMScriptObjectFactory *factory;
if (NS_SUCCEEDED(rv = nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
NS_GET_IID(nsIDOMScriptObjectFactory),
(nsISupports **)&factory))) {
rv = factory->NewScriptNodeList(aContext,
(nsISupports*)(nsIDOMNodeList*)this,
global,
(void**)&mScriptObject);
nsServiceManager::ReleaseService(kDOMScriptObjectFactoryCID, factory);
}
}
*aScriptObject = mScriptObject;
NS_RELEASE(global);
return rv;
}
NS_IMETHODIMP
NodeSet::SetScriptObject(void* aScriptObject)
{
mScriptObject = aScriptObject;
return NS_OK;
}
#endif