Nikolay Sivov : msxml3: Add stub support of ISAXDeclHandler for MXWriter.

Alexandre Julliard julliard at winehq.org
Thu Mar 8 14:26:22 CST 2012


Module: wine
Branch: master
Commit: 02545de4de260c5ab2239094a0e98514c412818a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=02545de4de260c5ab2239094a0e98514c412818a

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Mar  8 11:57:48 2012 +0300

msxml3: Add stub support of ISAXDeclHandler for MXWriter.

---

 dlls/msxml3/mxwriter.c        |   83 ++++++++++++++++++++++++++++++++++++++++-
 dlls/msxml3/tests/saxreader.c |   16 ++++++++
 2 files changed, 98 insertions(+), 1 deletions(-)

diff --git a/dlls/msxml3/mxwriter.c b/dlls/msxml3/mxwriter.c
index 72db31d..2519a75 100644
--- a/dlls/msxml3/mxwriter.c
+++ b/dlls/msxml3/mxwriter.c
@@ -1,7 +1,7 @@
 /*
  *    MXWriter implementation
  *
- * Copyright 2011 Nikolay Sivov for CodeWeavers
+ * Copyright 2011-2012 Nikolay Sivov for CodeWeavers
  * Copyright 2011 Thomas Mullaly
  *
  * This library is free software; you can redistribute it and/or
@@ -94,6 +94,7 @@ typedef struct
     IMXWriter IMXWriter_iface;
     ISAXContentHandler ISAXContentHandler_iface;
     ISAXLexicalHandler ISAXLexicalHandler_iface;
+    ISAXDeclHandler    ISAXDeclHandler_iface;
 
     LONG ref;
     MSXML_VERSION class_version;
@@ -482,6 +483,11 @@ static inline mxwriter *impl_from_ISAXLexicalHandler(ISAXLexicalHandler *iface)
     return CONTAINING_RECORD(iface, mxwriter, ISAXLexicalHandler_iface);
 }
 
+static inline mxwriter *impl_from_ISAXDeclHandler(ISAXDeclHandler *iface)
+{
+    return CONTAINING_RECORD(iface, mxwriter, ISAXDeclHandler_iface);
+}
+
 static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, void **obj)
 {
     mxwriter *This = impl_from_IMXWriter( iface );
@@ -504,6 +510,10 @@ static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, voi
     {
         *obj = &This->ISAXLexicalHandler_iface;
     }
+    else if ( IsEqualGUID( riid, &IID_ISAXDeclHandler ) )
+    {
+        *obj = &This->ISAXDeclHandler_iface;
+    }
     else if (dispex_query_interface(&This->dispex, riid, obj))
     {
         return *obj ? S_OK : E_NOINTERFACE;
@@ -1279,6 +1289,76 @@ static const struct ISAXLexicalHandlerVtbl SAXLexicalHandlerVtbl =
     SAXLexicalHandler_comment
 };
 
+/*** ISAXDeclHandler ***/
+static HRESULT WINAPI SAXDeclHandler_QueryInterface(ISAXDeclHandler *iface,
+    REFIID riid, void **obj)
+{
+    mxwriter *This = impl_from_ISAXDeclHandler( iface );
+    return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj);
+}
+
+static ULONG WINAPI SAXDeclHandler_AddRef(ISAXDeclHandler *iface)
+{
+    mxwriter *This = impl_from_ISAXDeclHandler( iface );
+    return IMXWriter_AddRef(&This->IMXWriter_iface);
+}
+
+static ULONG WINAPI SAXDeclHandler_Release(ISAXDeclHandler *iface)
+{
+    mxwriter *This = impl_from_ISAXDeclHandler( iface );
+    return IMXWriter_Release(&This->IMXWriter_iface);
+}
+
+static HRESULT WINAPI SAXDeclHandler_elementDecl(ISAXDeclHandler *iface,
+    const WCHAR *name, int n_name, const WCHAR *model, int n_model)
+{
+    mxwriter *This = impl_from_ISAXDeclHandler( iface );
+    FIXME("(%p)->(%s:%d %s:%d): stub\n", This, debugstr_wn(name, n_name), n_name,
+        debugstr_wn(model, n_model), n_model);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SAXDeclHandler_attributeDecl(ISAXDeclHandler *iface,
+    const WCHAR *element, int n_element, const WCHAR *attr, int n_attr,
+    const WCHAR *type, int n_type, const WCHAR *Default, int n_default,
+    const WCHAR *value, int n_value)
+{
+    mxwriter *This = impl_from_ISAXDeclHandler( iface );
+    FIXME("(%p)->(%s:%d %s:%d %s:%d %s:%d %s:%d): stub\n", This, debugstr_wn(element, n_element), n_element,
+        debugstr_wn(attr, n_attr), n_attr, debugstr_wn(type, n_type), n_type, debugstr_wn(Default, n_default), n_default,
+        debugstr_wn(value, n_value), n_value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SAXDeclHandler_internalEntityDecl(ISAXDeclHandler *iface,
+    const WCHAR *name, int n_name, const WCHAR *value, int n_value)
+{
+    mxwriter *This = impl_from_ISAXDeclHandler( iface );
+    FIXME("(%p)->(%s:%d %s:%d): stub\n", This, debugstr_wn(name, n_name), n_name,
+        debugstr_wn(value, n_value), n_value);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI SAXDeclHandler_externalEntityDecl(ISAXDeclHandler *iface,
+    const WCHAR *name, int n_name, const WCHAR *publicId, int n_publicId,
+    const WCHAR *systemId, int n_systemId)
+{
+    mxwriter *This = impl_from_ISAXDeclHandler( iface );
+    FIXME("(%p)->(%s:%d %s:%d %s:%d): stub\n", This, debugstr_wn(name, n_name), n_name,
+        debugstr_wn(publicId, n_publicId), n_publicId, debugstr_wn(systemId, n_systemId), n_systemId);
+    return E_NOTIMPL;
+}
+
+static const ISAXDeclHandlerVtbl SAXDeclHandlerVtbl = {
+    SAXDeclHandler_QueryInterface,
+    SAXDeclHandler_AddRef,
+    SAXDeclHandler_Release,
+    SAXDeclHandler_elementDecl,
+    SAXDeclHandler_attributeDecl,
+    SAXDeclHandler_internalEntityDecl,
+    SAXDeclHandler_externalEntityDecl
+};
+
 static const tid_t mxwriter_iface_tids[] = {
     IMXWriter_tid,
     0
@@ -1308,6 +1388,7 @@ HRESULT MXWriter_create(MSXML_VERSION version, IUnknown *outer, void **ppObj)
     This->IMXWriter_iface.lpVtbl = &MXWriterVtbl;
     This->ISAXContentHandler_iface.lpVtbl = &SAXContentHandlerVtbl;
     This->ISAXLexicalHandler_iface.lpVtbl = &SAXLexicalHandlerVtbl;
+    This->ISAXDeclHandler_iface.lpVtbl = &SAXDeclHandlerVtbl;
     This->ref = 1;
     This->class_version = version;
 
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index 56f6aa0..368dfeb 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -1685,6 +1685,7 @@ static void test_mxwriter_handlers(void)
 {
     ISAXContentHandler *handler;
     IMXWriter *writer, *writer2;
+    ISAXDeclHandler *decl;
     ISAXLexicalHandler *lh;
     HRESULT hr;
 
@@ -1720,6 +1721,21 @@ static void test_mxwriter_handlers(void)
     EXPECT_REF(writer, 3);
     EXPECT_REF(writer2, 3);
     IMXWriter_Release(writer2);
+    ISAXLexicalHandler_Release(lh);
+
+    /* ISAXDeclHandler */
+    hr = IMXWriter_QueryInterface(writer, &IID_ISAXDeclHandler, (void**)&decl);
+    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    EXPECT_REF(writer, 2);
+    EXPECT_REF(lh, 2);
+
+    hr = ISAXDeclHandler_QueryInterface(decl, &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);
+    ISAXDeclHandler_Release(decl);
 
     IMXWriter_Release(writer);
 }




More information about the wine-cvs mailing list