advapi32: Return a fake handle from EventRegister.
[wine/multimedia.git] / dlls / xmllite / writer.c
blobf60e0d965ab60b630f89e41a270b1595b88dffaa
1 /*
2 * IXmlWriter implementation
4 * Copyright 2011 Alistair Leslie-Hughes
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
20 #define COBJMACROS
22 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "objbase.h"
26 #include "xmllite.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(xmllite);
32 typedef struct _xmlwriter
34 IXmlWriter IXmlWriter_iface;
35 LONG ref;
36 } xmlwriter;
38 static inline xmlwriter *impl_from_IXmlWriter(IXmlWriter *iface)
40 return CONTAINING_RECORD(iface, xmlwriter, IXmlWriter_iface);
43 static HRESULT WINAPI xmlwriter_QueryInterface(IXmlWriter *iface, REFIID riid, void **ppvObject)
45 xmlwriter *This = impl_from_IXmlWriter(iface);
47 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
49 if (IsEqualGUID(riid, &IID_IUnknown) ||
50 IsEqualGUID(riid, &IID_IXmlWriter))
52 *ppvObject = iface;
55 IXmlWriter_AddRef(iface);
57 return S_OK;
60 static ULONG WINAPI xmlwriter_AddRef(IXmlWriter *iface)
62 xmlwriter *This = impl_from_IXmlWriter(iface);
63 TRACE("%p\n", This);
64 return InterlockedIncrement(&This->ref);
67 static ULONG WINAPI xmlwriter_Release(IXmlWriter *iface)
69 xmlwriter *This = impl_from_IXmlWriter(iface);
70 LONG ref;
72 TRACE("%p\n", This);
74 ref = InterlockedDecrement(&This->ref);
75 if (ref == 0)
77 HeapFree(GetProcessHeap(), 0, This);
80 return ref;
83 /*** IXmlWriter methods ***/
84 static HRESULT WINAPI xmlwriter_SetOutput(IXmlWriter *iface, IUnknown *pOutput)
86 xmlwriter *This = impl_from_IXmlWriter(iface);
88 FIXME("%p %p\n", This, pOutput);
90 return E_NOTIMPL;
93 static HRESULT WINAPI xmlwriter_GetProperty(IXmlWriter *iface, UINT nProperty, LONG_PTR *ppValue)
95 xmlwriter *This = impl_from_IXmlWriter(iface);
97 FIXME("%p %u %p\n", This, nProperty, ppValue);
99 return E_NOTIMPL;
102 static HRESULT WINAPI xmlwriter_SetProperty(IXmlWriter *iface, UINT nProperty, LONG_PTR pValue)
104 xmlwriter *This = impl_from_IXmlWriter(iface);
106 FIXME("%p %u %lu\n", This, nProperty, pValue);
108 return E_NOTIMPL;
111 static HRESULT WINAPI xmlwriter_WriteAttributes(IXmlWriter *iface, IXmlReader *pReader,
112 BOOL fWriteDefaultAttributes)
114 xmlwriter *This = impl_from_IXmlWriter(iface);
116 FIXME("%p %p %d\n", This, pReader, fWriteDefaultAttributes);
118 return E_NOTIMPL;
121 static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR pwszPrefix,
122 LPCWSTR pwszLocalName, LPCWSTR pwszNamespaceUri,
123 LPCWSTR pwszValue)
125 xmlwriter *This = impl_from_IXmlWriter(iface);
127 FIXME("%p %s %s %s %s\n", This, wine_dbgstr_w(pwszPrefix), wine_dbgstr_w(pwszLocalName),
128 wine_dbgstr_w(pwszNamespaceUri), wine_dbgstr_w(pwszValue));
130 return E_NOTIMPL;
133 static HRESULT WINAPI xmlwriter_WriteCData(IXmlWriter *iface, LPCWSTR pwszText)
135 xmlwriter *This = impl_from_IXmlWriter(iface);
137 FIXME("%p %s\n", This, wine_dbgstr_w(pwszText));
139 return E_NOTIMPL;
142 static HRESULT WINAPI xmlwriter_WriteCharEntity(IXmlWriter *iface, WCHAR wch)
144 return E_NOTIMPL;
147 static HRESULT WINAPI xmlwriter_WriteChars(IXmlWriter *iface, const WCHAR *pwch, UINT cwch)
149 xmlwriter *This = impl_from_IXmlWriter(iface);
151 FIXME("%p %s %d\n", This, wine_dbgstr_w(pwch), cwch);
153 return E_NOTIMPL;
156 static HRESULT WINAPI xmlwriter_WriteComment(IXmlWriter *iface, LPCWSTR pwszComment)
158 return E_NOTIMPL;
161 static HRESULT WINAPI xmlwriter_WriteDocType(IXmlWriter *iface, LPCWSTR pwszName, LPCWSTR pwszPublicId,
162 LPCWSTR pwszSystemId, LPCWSTR pwszSubset)
164 xmlwriter *This = impl_from_IXmlWriter(iface);
166 FIXME("%p %s %s %s %s\n", This, wine_dbgstr_w(pwszName), wine_dbgstr_w(pwszPublicId),
167 wine_dbgstr_w(pwszSystemId), wine_dbgstr_w(pwszSubset));
169 return E_NOTIMPL;
172 static HRESULT WINAPI xmlwriter_WriteElementString(IXmlWriter *iface, LPCWSTR pwszPrefix,
173 LPCWSTR pwszLocalName, LPCWSTR pwszNamespaceUri,
174 LPCWSTR pwszValue)
176 xmlwriter *This = impl_from_IXmlWriter(iface);
178 FIXME("%p %s %s %s %s\n", This, wine_dbgstr_w(pwszPrefix), wine_dbgstr_w(pwszLocalName),
179 wine_dbgstr_w(pwszNamespaceUri), wine_dbgstr_w(pwszValue));
181 return E_NOTIMPL;
184 static HRESULT WINAPI xmlwriter_WriteEndDocument(IXmlWriter *iface)
186 xmlwriter *This = impl_from_IXmlWriter(iface);
188 FIXME("%p\n", This);
190 return E_NOTIMPL;
193 static HRESULT WINAPI xmlwriter_WriteEndElement(IXmlWriter *iface)
195 xmlwriter *This = impl_from_IXmlWriter(iface);
197 FIXME("%p\n", This);
199 return E_NOTIMPL;
202 static HRESULT WINAPI xmlwriter_WriteEntityRef(IXmlWriter *iface, LPCWSTR pwszName)
204 xmlwriter *This = impl_from_IXmlWriter(iface);
206 FIXME("%p %s\n", This, wine_dbgstr_w(pwszName));
208 return E_NOTIMPL;
211 static HRESULT WINAPI xmlwriter_WriteFullEndElement(IXmlWriter *iface)
213 xmlwriter *This = impl_from_IXmlWriter(iface);
215 FIXME("%p\n", This);
217 return E_NOTIMPL;
220 static HRESULT WINAPI xmlwriter_WriteName(IXmlWriter *iface, LPCWSTR pwszName)
222 xmlwriter *This = impl_from_IXmlWriter(iface);
224 FIXME("%p %s\n", This, wine_dbgstr_w(pwszName));
226 return E_NOTIMPL;
229 static HRESULT WINAPI xmlwriter_WriteNmToken(IXmlWriter *iface, LPCWSTR pwszNmToken)
231 xmlwriter *This = impl_from_IXmlWriter(iface);
233 FIXME("%p %s\n", This, wine_dbgstr_w(pwszNmToken));
235 return E_NOTIMPL;
238 static HRESULT WINAPI xmlwriter_WriteNode(IXmlWriter *iface, IXmlReader *pReader,
239 BOOL fWriteDefaultAttributes)
241 xmlwriter *This = impl_from_IXmlWriter(iface);
243 FIXME("%p %p %d\n", This, pReader, fWriteDefaultAttributes);
245 return E_NOTIMPL;
248 static HRESULT WINAPI xmlwriter_WriteNodeShallow(IXmlWriter *iface, IXmlReader *pReader,
249 BOOL fWriteDefaultAttributes)
251 xmlwriter *This = impl_from_IXmlWriter(iface);
253 FIXME("%p %p %d\n", This, pReader, fWriteDefaultAttributes);
255 return E_NOTIMPL;
258 static HRESULT WINAPI xmlwriter_WriteProcessingInstruction(IXmlWriter *iface, LPCWSTR pwszName,
259 LPCWSTR pwszText)
261 xmlwriter *This = impl_from_IXmlWriter(iface);
263 FIXME("%p %s %s\n", This, wine_dbgstr_w(pwszName), wine_dbgstr_w(pwszText));
265 return E_NOTIMPL;
268 static HRESULT WINAPI xmlwriter_WriteQualifiedName(IXmlWriter *iface, LPCWSTR pwszLocalName,
269 LPCWSTR pwszNamespaceUri)
271 xmlwriter *This = impl_from_IXmlWriter(iface);
273 FIXME("%p %s %s\n", This, wine_dbgstr_w(pwszLocalName), wine_dbgstr_w(pwszNamespaceUri));
275 return E_NOTIMPL;
278 static HRESULT WINAPI xmlwriter_WriteRaw(IXmlWriter *iface, LPCWSTR pwszData)
280 xmlwriter *This = impl_from_IXmlWriter(iface);
282 FIXME("%p %s\n", This, wine_dbgstr_w(pwszData));
284 return E_NOTIMPL;
287 static HRESULT WINAPI xmlwriter_WriteRawChars(IXmlWriter *iface, const WCHAR *pwch, UINT cwch)
289 xmlwriter *This = impl_from_IXmlWriter(iface);
291 FIXME("%p %s %d\n", This, wine_dbgstr_w(pwch), cwch);
293 return E_NOTIMPL;
296 static HRESULT WINAPI xmlwriter_WriteStartDocument(IXmlWriter *iface, XmlStandalone standalone)
298 xmlwriter *This = impl_from_IXmlWriter(iface);
300 FIXME("%p\n", This);
302 return E_NOTIMPL;
305 static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pwszPrefix,
306 LPCWSTR pwszLocalName, LPCWSTR pwszNamespaceUri)
308 xmlwriter *This = impl_from_IXmlWriter(iface);
310 FIXME("%p %s %s %s\n", This, wine_dbgstr_w(pwszPrefix), wine_dbgstr_w(pwszLocalName),
311 wine_dbgstr_w(pwszNamespaceUri));
313 return E_NOTIMPL;
316 static HRESULT WINAPI xmlwriter_WriteString(IXmlWriter *iface, LPCWSTR pwszText)
318 xmlwriter *This = impl_from_IXmlWriter(iface);
320 FIXME("%p %s\n", This, wine_dbgstr_w(pwszText));
322 return E_NOTIMPL;
325 static HRESULT WINAPI xmlwriter_WriteSurrogateCharEntity(IXmlWriter *iface, WCHAR wchLow, WCHAR wchHigh)
327 xmlwriter *This = impl_from_IXmlWriter(iface);
329 FIXME("%p %d %d\n", This, wchLow, wchHigh);
331 return E_NOTIMPL;
334 static HRESULT WINAPI xmlwriter_WriteWhitespace(IXmlWriter *iface, LPCWSTR pwszWhitespace)
336 xmlwriter *This = impl_from_IXmlWriter(iface);
338 FIXME("%p %s\n", This, wine_dbgstr_w(pwszWhitespace));
340 return E_NOTIMPL;
343 static HRESULT WINAPI xmlwriter_Flush(IXmlWriter *iface)
345 xmlwriter *This = impl_from_IXmlWriter(iface);
347 FIXME("%p\n", This);
349 return E_NOTIMPL;
352 static const struct IXmlWriterVtbl xmlwriter_vtbl =
354 xmlwriter_QueryInterface,
355 xmlwriter_AddRef,
356 xmlwriter_Release,
357 xmlwriter_SetOutput,
358 xmlwriter_GetProperty,
359 xmlwriter_SetProperty,
360 xmlwriter_WriteAttributes,
361 xmlwriter_WriteAttributeString,
362 xmlwriter_WriteCData,
363 xmlwriter_WriteCharEntity,
364 xmlwriter_WriteChars,
365 xmlwriter_WriteComment,
366 xmlwriter_WriteDocType,
367 xmlwriter_WriteElementString,
368 xmlwriter_WriteEndDocument,
369 xmlwriter_WriteEndElement,
370 xmlwriter_WriteEntityRef,
371 xmlwriter_WriteFullEndElement,
372 xmlwriter_WriteName,
373 xmlwriter_WriteNmToken,
374 xmlwriter_WriteNode,
375 xmlwriter_WriteNodeShallow,
376 xmlwriter_WriteProcessingInstruction,
377 xmlwriter_WriteQualifiedName,
378 xmlwriter_WriteRaw,
379 xmlwriter_WriteRawChars,
380 xmlwriter_WriteStartDocument,
381 xmlwriter_WriteStartElement,
382 xmlwriter_WriteString,
383 xmlwriter_WriteSurrogateCharEntity,
384 xmlwriter_WriteWhitespace,
385 xmlwriter_Flush
388 HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc)
390 xmlwriter *writer;
392 TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), pObject, pMalloc);
394 if (pMalloc) FIXME("custom IMalloc not supported yet\n");
396 if (!IsEqualGUID(riid, &IID_IXmlWriter))
398 ERR("Unexpected IID requested -> (%s)\n", wine_dbgstr_guid(riid));
399 return E_FAIL;
402 writer = HeapAlloc(GetProcessHeap(), 0, sizeof (*writer));
403 if(!writer) return E_OUTOFMEMORY;
405 writer->IXmlWriter_iface.lpVtbl = &xmlwriter_vtbl;
406 writer->ref = 1;
408 *pObject = &writer->IXmlWriter_iface;
410 TRACE("returning iface %p\n", *pObject);
412 return S_OK;