msxml3: Add ISAXContentHandler stub for MXXMLWriter.
This commit is contained in:
parent
a12d2d7233
commit
387966c48a
|
@ -41,6 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
||||||
typedef struct _mxwriter
|
typedef struct _mxwriter
|
||||||
{
|
{
|
||||||
IMXWriter IMXWriter_iface;
|
IMXWriter IMXWriter_iface;
|
||||||
|
ISAXContentHandler ISAXContentHandler_iface;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
} mxwriter;
|
} mxwriter;
|
||||||
|
|
||||||
|
@ -49,6 +51,11 @@ static inline mxwriter *impl_from_IMXWriter(IMXWriter *iface)
|
||||||
return CONTAINING_RECORD(iface, mxwriter, IMXWriter_iface);
|
return CONTAINING_RECORD(iface, mxwriter, IMXWriter_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline mxwriter *impl_from_ISAXContentHandler(ISAXContentHandler *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, mxwriter, ISAXContentHandler_iface);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, void **obj)
|
static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, void **obj)
|
||||||
{
|
{
|
||||||
mxwriter *This = impl_from_IMXWriter( iface );
|
mxwriter *This = impl_from_IMXWriter( iface );
|
||||||
|
@ -61,6 +68,10 @@ static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, voi
|
||||||
{
|
{
|
||||||
*obj = &This->IMXWriter_iface;
|
*obj = &This->IMXWriter_iface;
|
||||||
}
|
}
|
||||||
|
else if ( IsEqualGUID( riid, &IID_ISAXContentHandler ) )
|
||||||
|
{
|
||||||
|
*obj = &This->ISAXContentHandler_iface;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERR("interface %s not implemented\n", debugstr_guid(riid));
|
ERR("interface %s not implemented\n", debugstr_guid(riid));
|
||||||
|
@ -314,6 +325,164 @@ static const struct IMXWriterVtbl mxwriter_vtbl =
|
||||||
mxwriter_flush
|
mxwriter_flush
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*** ISAXContentHandler ***/
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_QueryInterface(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
REFIID riid,
|
||||||
|
void **obj)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI mxwriter_saxcontent_AddRef(ISAXContentHandler *iface)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
return IMXWriter_AddRef(&This->IMXWriter_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI mxwriter_saxcontent_Release(ISAXContentHandler *iface)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
return IMXWriter_Release(&This->IMXWriter_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_putDocumentLocator(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
ISAXLocator *locator)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%p)\n", This, locator);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_startDocument(ISAXContentHandler *iface)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)\n", This);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_endDocument(ISAXContentHandler *iface)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)\n", This);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_startPrefixMapping(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
const WCHAR *prefix,
|
||||||
|
int nprefix,
|
||||||
|
const WCHAR *uri,
|
||||||
|
int nuri)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%s %s)\n", This, debugstr_wn(prefix, nprefix), debugstr_wn(uri, nuri));
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_endPrefixMapping(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
const WCHAR *prefix,
|
||||||
|
int nprefix)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%s)\n", This, debugstr_wn(prefix, nprefix));
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_startElement(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
const WCHAR *namespaceUri,
|
||||||
|
int nnamespaceUri,
|
||||||
|
const WCHAR *local_name,
|
||||||
|
int nlocal_name,
|
||||||
|
const WCHAR *QName,
|
||||||
|
int nQName,
|
||||||
|
ISAXAttributes *attr)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%s %s %s %p)\n", This, debugstr_wn(namespaceUri, nnamespaceUri),
|
||||||
|
debugstr_wn(local_name, nlocal_name), debugstr_wn(QName, nQName), attr);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_endElement(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
const WCHAR *namespaceUri,
|
||||||
|
int nnamespaceUri,
|
||||||
|
const WCHAR * local_name,
|
||||||
|
int nlocal_name,
|
||||||
|
const WCHAR *QName,
|
||||||
|
int nQName)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%s %s %s)\n", This, debugstr_wn(namespaceUri, nnamespaceUri),
|
||||||
|
debugstr_wn(local_name, nlocal_name), debugstr_wn(QName, nQName));
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_characters(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
const WCHAR *chars,
|
||||||
|
int nchars)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%s)\n", This, debugstr_wn(chars, nchars));
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_ignorableWhitespace(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
const WCHAR *chars,
|
||||||
|
int nchars)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%s)\n", This, debugstr_wn(chars, nchars));
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_processingInstruction(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
const WCHAR *target,
|
||||||
|
int ntarget,
|
||||||
|
const WCHAR *data,
|
||||||
|
int ndata)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%s %s)\n", This, debugstr_wn(target, ntarget), debugstr_wn(data, ndata));
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI mxwriter_saxcontent_skippedEntity(
|
||||||
|
ISAXContentHandler *iface,
|
||||||
|
const WCHAR *name,
|
||||||
|
int nname)
|
||||||
|
{
|
||||||
|
mxwriter *This = impl_from_ISAXContentHandler( iface );
|
||||||
|
FIXME("(%p)->(%s)\n", This, debugstr_wn(name, nname));
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct ISAXContentHandlerVtbl mxwriter_saxcontent_vtbl =
|
||||||
|
{
|
||||||
|
mxwriter_saxcontent_QueryInterface,
|
||||||
|
mxwriter_saxcontent_AddRef,
|
||||||
|
mxwriter_saxcontent_Release,
|
||||||
|
mxwriter_saxcontent_putDocumentLocator,
|
||||||
|
mxwriter_saxcontent_startDocument,
|
||||||
|
mxwriter_saxcontent_endDocument,
|
||||||
|
mxwriter_saxcontent_startPrefixMapping,
|
||||||
|
mxwriter_saxcontent_endPrefixMapping,
|
||||||
|
mxwriter_saxcontent_startElement,
|
||||||
|
mxwriter_saxcontent_endElement,
|
||||||
|
mxwriter_saxcontent_characters,
|
||||||
|
mxwriter_saxcontent_ignorableWhitespace,
|
||||||
|
mxwriter_saxcontent_processingInstruction,
|
||||||
|
mxwriter_saxcontent_skippedEntity
|
||||||
|
};
|
||||||
|
|
||||||
HRESULT MXWriter_create(IUnknown *pUnkOuter, void **ppObj)
|
HRESULT MXWriter_create(IUnknown *pUnkOuter, void **ppObj)
|
||||||
{
|
{
|
||||||
mxwriter *This;
|
mxwriter *This;
|
||||||
|
@ -327,6 +496,7 @@ HRESULT MXWriter_create(IUnknown *pUnkOuter, void **ppObj)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
This->IMXWriter_iface.lpVtbl = &mxwriter_vtbl;
|
This->IMXWriter_iface.lpVtbl = &mxwriter_vtbl;
|
||||||
|
This->ISAXContentHandler_iface.lpVtbl = &mxwriter_saxcontent_vtbl;
|
||||||
This->ref = 1;
|
This->ref = 1;
|
||||||
|
|
||||||
*ppObj = &This->IMXWriter_iface;
|
*ppObj = &This->IMXWriter_iface;
|
||||||
|
|
|
@ -29,6 +29,14 @@
|
||||||
|
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
|
||||||
|
static void _expect_ref(IUnknown* obj, ULONG ref, int line)
|
||||||
|
{
|
||||||
|
ULONG rc = IUnknown_AddRef(obj);
|
||||||
|
IUnknown_Release(obj);
|
||||||
|
ok_(__FILE__,line)(rc-1 == ref, "expected refcount %d, got %d\n", ref, rc-1);
|
||||||
|
}
|
||||||
|
|
||||||
typedef enum _CH {
|
typedef enum _CH {
|
||||||
CH_ENDTEST,
|
CH_ENDTEST,
|
||||||
CH_PUTDOCUMENTLOCATOR,
|
CH_PUTDOCUMENTLOCATOR,
|
||||||
|
@ -653,6 +661,39 @@ static void test_encoding(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_mxwriter_contenthandler(void)
|
||||||
|
{
|
||||||
|
ISAXContentHandler *handler;
|
||||||
|
IMXWriter *writer, *writer2;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_IMXWriter, (void**)&writer);
|
||||||
|
if (hr != S_OK)
|
||||||
|
{
|
||||||
|
win_skip("MXXMLWriter not supported\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
|
||||||
|
EXPECT_REF(writer, 1);
|
||||||
|
|
||||||
|
hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&handler);
|
||||||
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
EXPECT_REF(writer, 2);
|
||||||
|
EXPECT_REF(handler, 2);
|
||||||
|
|
||||||
|
hr = ISAXContentHandler_QueryInterface(handler, &IID_IMXWriter, (void**)&writer2);
|
||||||
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
ok(writer2 == writer, "got %p, expected %p\n", writer2, writer);
|
||||||
|
EXPECT_REF(writer, 3);
|
||||||
|
EXPECT_REF(writer2, 3);
|
||||||
|
IMXWriter_Release(writer2);
|
||||||
|
|
||||||
|
ISAXContentHandler_Release(handler);
|
||||||
|
IMXWriter_Release(writer);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(saxreader)
|
START_TEST(saxreader)
|
||||||
{
|
{
|
||||||
ISAXXMLReader *reader;
|
ISAXXMLReader *reader;
|
||||||
|
@ -674,6 +715,7 @@ START_TEST(saxreader)
|
||||||
|
|
||||||
test_saxreader();
|
test_saxreader();
|
||||||
test_encoding();
|
test_encoding();
|
||||||
|
test_mxwriter_contenthandler();
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue