Unicorn XML Toolkit
Version 1.00.00

Namespace EcmaScriptXml
Class CStreamInstance

class CStreamInstance: public CBaseObject {
public:
    CStreamInstance(
        CXmlObject *pXmlObject,
        const XObject &pPrototype,
        const Sax::XXmlStream &pStream=NULL);
    ~CStreamInstance();
public:
    CString Class();
public:
    XValue GetProperty(
        CContext &context,
        int nSelector);
    void PutProperty(
        CContext &context,
        int nSelector,
        const XValue &pValue);
public:
    Sax::XXmlStream GetStream();
    Sax::XXmlStream WrapStream();
public:
    void SetStream(const Sax::XXmlStream &pStream);
    };

The ECMAScript object representing an XML Stream instance.

Declaration of this class is made public in order to allow development of custom ECMAScript extensions, which provide objects, derived from XML streams, (that is, objects, containing XML Stream prototype in their prototype chains and thus implementing properties of XML streams). Instances of such extension objects must be implemented using classes derived from CStreamInstance . For example, refer to the source code for the class EcmaScriptDomPrivate::CReaderInstance , implementing DOM readers. This code can be found in the toolkit source distribution, files src\esxdom\domprv.h and src\esxdom\objrdr.cpp .

Each ECMAScript stream instance may be associated with an object of Sax::CXmlStream class; in this case function properties of the XML extension object are initially bound to event processing functions of the associated Sax::CXmlStream instance.

If the associated Sax::CXmlStream instance is not specified, then event processing function properties of the ECMAScript stream instance are initialized to void (doing nothing) functions.

Some XML stream object classes allow event processing function properties being overriden by ECMAScript programs in order to implement custom event processing.

Since:
1.00.00
Version:
1.00.00
Author:
Alexey Gokhberg
See Also:
CXmlObject, EcmaScript::CValue, EcmaScript::CObject, EcmaScript::CContext, Sax::CXmlStream
Constructor/Destructor Summary
CStreamInstance (CXmlObject *pXmlObject, const XObject &pPrototype, const Sax::XXmlStream &pStream=NULL);
����������Constructs the XML stream instance.
~CStreamInstance ();
����������Destroys the XML stream instance.

Function Summary
CString Class ();
����������Returns the value of the internal [[Class]] property of this object.
XValue GetProperty (CContext &context, int nSelector);
����������Returns value of the property corresponding to the specified selector.
void PutProperty (CContext &context, int nSelector, const XValue &pValue);
����������Assigns value to the property with the specified selector.
Sax::XXmlStream GetStream ();
����������Returns an instance of Sax::CXmlStream associated with this object.
Sax::XXmlStream WrapStream ();
����������Returns an instance of Sax::CXmlStream , which wraps event processing ECMAScript function properties associated with this object.
void SetStream (const Sax::XXmlStream &pStream);
����������Sets the Sax::CXmlStream instance associated with this object.

Constructor/Destructor Detail

CStreamInstance

CStreamInstance(
    CXmlObject *pXmlObject,
    const XObject &pPrototype,
    const Sax::XXmlStream &pStream=NULL);

Constructs the XML stream instance.

Parameters:
pXmlObject - the XML root object
pPrototype - the object's prototype (value of the internal [[Prototype]] property for this object)
pStream - the instance of Sax::CXmlStream for this object; NULL if not specified

~CStreamInstance

~CStreamInstance();

Destroys the XML stream instance.

Function Detail

Class

CString Class();

Returns the value of the internal [[Class]] property of this object.

This function returns "XML.Stream" . It may be (and usually is) overriden by derived classes.

Returns:
the value of the internal [[Class]] property of this object

GetProperty

XValue GetProperty(
    CContext &context,
    int nSelector);

Returns value of the property corresponding to the specified selector.

Parameters:
context - the execution context
nSelector - the selector
Returns:
value of the property corresponding to the specified selector

PutProperty

void PutProperty(
    CContext &context,
    int nSelector,
    const XValue &pValue);

Assigns value to the property with the specified selector.

Parameters:
context - the execution context
nSelector - the selector
pValue - value to assign

GetStream

Sax::XXmlStream GetStream();

Returns an instance of Sax::CXmlStream associated with this object.

Returns:
the Sax::CXmlStream instance associated with this object, or NULL if none was specified

WrapStream

Sax::XXmlStream WrapStream();

Returns an instance of Sax::CXmlStream , which wraps event processing ECMAScript function properties associated with this object.

Returns:
the Sax::CXmlStream instance, which wraps event processing ECMAScript function properties associated with this object

SetStream

void SetStream(const Sax::XXmlStream &pStream);

Sets the Sax::CXmlStream instance associated with this object.

This method can be used when the Sax::CXmlStream object is not known at the construction time.

Parameters:
pStream - the Sax::CXmlStream object

Unicorn XML Toolkit
Version 1.00.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.