2 * MXWriter implementation
4 * Copyright 2011 Nikolay Sivov for CodeWeaversы
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 # include <libxml/parser.h>
35 #include "wine/debug.h"
37 #include "msxml_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
41 typedef struct _mxwriter
43 IMXWriter IMXWriter_iface
;
47 static inline mxwriter
*impl_from_IMXWriter(IMXWriter
*iface
)
49 return CONTAINING_RECORD(iface
, mxwriter
, IMXWriter_iface
);
52 static HRESULT WINAPI
mxwriter_QueryInterface(IMXWriter
*iface
, REFIID riid
, void **obj
)
54 mxwriter
*This
= impl_from_IMXWriter( iface
);
56 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), obj
);
58 if ( IsEqualGUID( riid
, &IID_IMXWriter
) ||
59 IsEqualGUID( riid
, &IID_IDispatch
) ||
60 IsEqualGUID( riid
, &IID_IUnknown
) )
62 *obj
= &This
->IMXWriter_iface
;
66 ERR("interface %s not implemented\n", debugstr_guid(riid
));
71 IMXWriter_AddRef(iface
);
75 static ULONG WINAPI
mxwriter_AddRef(IMXWriter
*iface
)
77 mxwriter
*This
= impl_from_IMXWriter( iface
);
78 LONG ref
= InterlockedIncrement(&This
->ref
);
80 TRACE("(%p)->(%d)\n", This
, ref
);
85 static ULONG WINAPI
mxwriter_Release(IMXWriter
*iface
)
87 mxwriter
*This
= impl_from_IMXWriter( iface
);
88 ULONG ref
= InterlockedDecrement(&This
->ref
);
90 TRACE("(%p)->(%d)\n", This
, ref
);
98 static HRESULT WINAPI
mxwriter_GetTypeInfoCount(IMXWriter
*iface
, UINT
* pctinfo
)
100 mxwriter
*This
= impl_from_IMXWriter( iface
);
102 TRACE("(%p)->(%p)\n", This
, pctinfo
);
109 static HRESULT WINAPI
mxwriter_GetTypeInfo(
111 UINT iTInfo
, LCID lcid
,
112 ITypeInfo
** ppTInfo
)
114 mxwriter
*This
= impl_from_IMXWriter( iface
);
116 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
118 return get_typeinfo(IMXWriter_tid
, ppTInfo
);
121 static HRESULT WINAPI
mxwriter_GetIDsOfNames(
123 REFIID riid
, LPOLESTR
* rgszNames
,
124 UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
126 mxwriter
*This
= impl_from_IMXWriter( iface
);
130 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
133 if(!rgszNames
|| cNames
== 0 || !rgDispId
)
136 hr
= get_typeinfo(IMXWriter_tid
, &typeinfo
);
139 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
140 ITypeInfo_Release(typeinfo
);
146 static HRESULT WINAPI
mxwriter_Invoke(
148 DISPID dispIdMember
, REFIID riid
, LCID lcid
,
149 WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarResult
,
150 EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
152 mxwriter
*This
= impl_from_IMXWriter( iface
);
156 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
157 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
159 hr
= get_typeinfo(IMXWriter_tid
, &typeinfo
);
162 hr
= ITypeInfo_Invoke(typeinfo
, &This
->IMXWriter_iface
, dispIdMember
, wFlags
,
163 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
164 ITypeInfo_Release(typeinfo
);
170 static HRESULT WINAPI
mxwriter_put_output(IMXWriter
*iface
, VARIANT dest
)
172 mxwriter
*This
= impl_from_IMXWriter( iface
);
173 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&dest
));
177 static HRESULT WINAPI
mxwriter_get_output(IMXWriter
*iface
, VARIANT
*dest
)
179 mxwriter
*This
= impl_from_IMXWriter( iface
);
180 FIXME("(%p)->(%p)\n", This
, dest
);
184 static HRESULT WINAPI
mxwriter_put_encoding(IMXWriter
*iface
, BSTR encoding
)
186 mxwriter
*This
= impl_from_IMXWriter( iface
);
187 FIXME("(%p)->(%s)\n", This
, debugstr_w(encoding
));
191 static HRESULT WINAPI
mxwriter_get_encoding(IMXWriter
*iface
, BSTR
*encoding
)
193 mxwriter
*This
= impl_from_IMXWriter( iface
);
194 FIXME("(%p)->(%p)\n", This
, encoding
);
198 static HRESULT WINAPI
mxwriter_put_byteOrderMark(IMXWriter
*iface
, VARIANT_BOOL writeBOM
)
200 mxwriter
*This
= impl_from_IMXWriter( iface
);
201 FIXME("(%p)->(%d)\n", This
, writeBOM
);
205 static HRESULT WINAPI
mxwriter_get_byteOrderMark(IMXWriter
*iface
, VARIANT_BOOL
*writeBOM
)
207 mxwriter
*This
= impl_from_IMXWriter( iface
);
208 FIXME("(%p)->(%p)\n", This
, writeBOM
);
212 static HRESULT WINAPI
mxwriter_put_indent(IMXWriter
*iface
, VARIANT_BOOL indent
)
214 mxwriter
*This
= impl_from_IMXWriter( iface
);
215 FIXME("(%p)->(%d)\n", This
, indent
);
219 static HRESULT WINAPI
mxwriter_get_indent(IMXWriter
*iface
, VARIANT_BOOL
*indent
)
221 mxwriter
*This
= impl_from_IMXWriter( iface
);
222 FIXME("(%p)->(%p)\n", This
, indent
);
226 static HRESULT WINAPI
mxwriter_put_standalone(IMXWriter
*iface
, VARIANT_BOOL value
)
228 mxwriter
*This
= impl_from_IMXWriter( iface
);
229 FIXME("(%p)->(%d)\n", This
, value
);
233 static HRESULT WINAPI
mxwriter_get_standalone(IMXWriter
*iface
, VARIANT_BOOL
*value
)
235 mxwriter
*This
= impl_from_IMXWriter( iface
);
236 FIXME("(%p)->(%p)\n", This
, value
);
240 static HRESULT WINAPI
mxwriter_put_omitXMLDeclaration(IMXWriter
*iface
, VARIANT_BOOL value
)
242 mxwriter
*This
= impl_from_IMXWriter( iface
);
243 FIXME("(%p)->(%d)\n", This
, value
);
247 static HRESULT WINAPI
mxwriter_get_omitXMLDeclaration(IMXWriter
*iface
, VARIANT_BOOL
*value
)
249 mxwriter
*This
= impl_from_IMXWriter( iface
);
250 FIXME("(%p)->(%p)\n", This
, value
);
254 static HRESULT WINAPI
mxwriter_put_version(IMXWriter
*iface
, BSTR version
)
256 mxwriter
*This
= impl_from_IMXWriter( iface
);
257 FIXME("(%p)->(%s)\n", This
, debugstr_w(version
));
261 static HRESULT WINAPI
mxwriter_get_version(IMXWriter
*iface
, BSTR
*version
)
263 mxwriter
*This
= impl_from_IMXWriter( iface
);
264 FIXME("(%p)->(%p)\n", This
, version
);
268 static HRESULT WINAPI
mxwriter_put_disableOutputEscaping(IMXWriter
*iface
, VARIANT_BOOL value
)
270 mxwriter
*This
= impl_from_IMXWriter( iface
);
271 FIXME("(%p)->(%d)\n", This
, value
);
275 static HRESULT WINAPI
mxwriter_get_disableOutputEscaping(IMXWriter
*iface
, VARIANT_BOOL
*value
)
277 mxwriter
*This
= impl_from_IMXWriter( iface
);
278 FIXME("(%p)->(%p)\n", This
, value
);
282 static HRESULT WINAPI
mxwriter_flush(IMXWriter
*iface
)
284 mxwriter
*This
= impl_from_IMXWriter( iface
);
285 FIXME("(%p)\n", This
);
289 static const struct IMXWriterVtbl mxwriter_vtbl
=
291 mxwriter_QueryInterface
,
294 mxwriter_GetTypeInfoCount
,
295 mxwriter_GetTypeInfo
,
296 mxwriter_GetIDsOfNames
,
300 mxwriter_put_encoding
,
301 mxwriter_get_encoding
,
302 mxwriter_put_byteOrderMark
,
303 mxwriter_get_byteOrderMark
,
306 mxwriter_put_standalone
,
307 mxwriter_get_standalone
,
308 mxwriter_put_omitXMLDeclaration
,
309 mxwriter_get_omitXMLDeclaration
,
310 mxwriter_put_version
,
311 mxwriter_get_version
,
312 mxwriter_put_disableOutputEscaping
,
313 mxwriter_get_disableOutputEscaping
,
317 HRESULT
MXWriter_create(IUnknown
*pUnkOuter
, void **ppObj
)
321 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
323 if (pUnkOuter
) FIXME("support aggregation, outer\n");
325 This
= heap_alloc( sizeof (*This
) );
327 return E_OUTOFMEMORY
;
329 This
->IMXWriter_iface
.lpVtbl
= &mxwriter_vtbl
;
332 *ppObj
= &This
->IMXWriter_iface
;
334 TRACE("returning iface %p\n", *ppObj
);