2 * IXmlReader implementation
4 * Copyright 2010 Nikolay Sivov
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
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(xmllite);
34 typedef struct _xmlreader
36 const IXmlReaderVtbl *lpVtbl;
40 static inline xmlreader *impl_from_IXmlReader(IXmlReader *iface)
42 return (xmlreader *)((char*)iface - FIELD_OFFSET(xmlreader, lpVtbl));
45 static HRESULT WINAPI xmlreader_QueryInterface(IXmlReader *iface, REFIID riid, void** ppvObject)
47 xmlreader *This = impl_from_IXmlReader(iface);
49 TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
51 if (IsEqualGUID(riid, &IID_IUnknown) ||
52 IsEqualGUID(riid, &IID_IXmlReader))
58 FIXME("interface %s not implemented\n", debugstr_guid(riid));
62 IXmlReader_AddRef(iface);
67 static ULONG WINAPI xmlreader_AddRef(IXmlReader *iface)
69 xmlreader *This = impl_from_IXmlReader(iface);
71 return InterlockedIncrement(&This->ref);
74 static ULONG WINAPI xmlreader_Release(IXmlReader *iface)
76 xmlreader *This = impl_from_IXmlReader(iface);
81 ref = InterlockedDecrement(&This->ref);
84 HeapFree(GetProcessHeap(), 0, This);
90 static HRESULT WINAPI xmlreader_SetInput(IXmlReader* iface, IUnknown *input)
92 FIXME("(%p %p): stub\n", iface, input);
96 static HRESULT WINAPI xmlreader_GetProperty(IXmlReader* iface, UINT property, LONG_PTR *value)
98 FIXME("(%p %u %p): stub\n", iface, property, value);
102 static HRESULT WINAPI xmlreader_SetProperty(IXmlReader* iface, UINT property, LONG_PTR value)
104 FIXME("(%p %u %lu): stub\n", iface, property, value);
108 static HRESULT WINAPI xmlreader_Read(IXmlReader* iface, XmlNodeType *node_type)
110 FIXME("(%p %p): stub\n", iface, node_type);
114 static HRESULT WINAPI xmlreader_GetNodeType(IXmlReader* iface, XmlNodeType *node_type)
116 FIXME("(%p %p): stub\n", iface, node_type);
120 static HRESULT WINAPI xmlreader_MoveToFirstAttribute(IXmlReader* iface)
122 FIXME("(%p): stub\n", iface);
126 static HRESULT WINAPI xmlreader_MoveToNextAttribute(IXmlReader* iface)
128 FIXME("(%p): stub\n", iface);
132 static HRESULT WINAPI xmlreader_MoveToAttributeByName(IXmlReader* iface,
134 LPCWSTR namespaceUri)
136 FIXME("(%p %p %p): stub\n", iface, local_name, namespaceUri);
140 static HRESULT WINAPI xmlreader_MoveToElement(IXmlReader* iface)
142 FIXME("(%p): stub\n", iface);
146 static HRESULT WINAPI xmlreader_GetQualifiedName(IXmlReader* iface, LPCWSTR *qualifiedName,
147 UINT *qualifiedName_length)
149 FIXME("(%p %p %p): stub\n", iface, qualifiedName, qualifiedName_length);
153 static HRESULT WINAPI xmlreader_GetNamespaceUri(IXmlReader* iface,
154 LPCWSTR *namespaceUri,
155 UINT *namespaceUri_length)
157 FIXME("(%p %p %p): stub\n", iface, namespaceUri, namespaceUri_length);
161 static HRESULT WINAPI xmlreader_GetLocalName(IXmlReader* iface,
163 UINT *local_name_length)
165 FIXME("(%p %p %p): stub\n", iface, local_name, local_name_length);
169 static HRESULT WINAPI xmlreader_GetPrefix(IXmlReader* iface,
173 FIXME("(%p %p %p): stub\n", iface, prefix, prefix_length);
177 static HRESULT WINAPI xmlreader_GetValue(IXmlReader* iface,
181 FIXME("(%p %p %p): stub\n", iface, value, value_length);
185 static HRESULT WINAPI xmlreader_ReadValueChunk(IXmlReader* iface,
190 FIXME("(%p %p %u %p): stub\n", iface, buffer, chunk_size, read);
194 static HRESULT WINAPI xmlreader_GetBaseUri(IXmlReader* iface,
196 UINT *baseUri_length)
198 FIXME("(%p %p %p): stub\n", iface, baseUri, baseUri_length);
202 static BOOL WINAPI xmlreader_IsDefault(IXmlReader* iface)
204 FIXME("(%p): stub\n", iface);
208 static BOOL WINAPI xmlreader_IsEmptyElement(IXmlReader* iface)
210 FIXME("(%p): stub\n", iface);
214 static HRESULT WINAPI xmlreader_GetLineNumber(IXmlReader* iface, UINT *lineNumber)
216 FIXME("(%p %p): stub\n", iface, lineNumber);
220 static HRESULT WINAPI xmlreader_GetLinePosition(IXmlReader* iface, UINT *linePosition)
222 FIXME("(%p %p): stub\n", iface, linePosition);
226 static HRESULT WINAPI xmlreader_GetAttributeCount(IXmlReader* iface, UINT *attributeCount)
228 FIXME("(%p %p): stub\n", iface, attributeCount);
232 static HRESULT WINAPI xmlreader_GetDepth(IXmlReader* iface, UINT *depth)
234 FIXME("(%p %p): stub\n", iface, depth);
238 static BOOL WINAPI xmlreader_IsEOF(IXmlReader* iface)
240 FIXME("(%p): stub\n", iface);
244 static const struct IXmlReaderVtbl xmlreader_vtbl =
246 xmlreader_QueryInterface,
250 xmlreader_GetProperty,
251 xmlreader_SetProperty,
253 xmlreader_GetNodeType,
254 xmlreader_MoveToFirstAttribute,
255 xmlreader_MoveToNextAttribute,
256 xmlreader_MoveToAttributeByName,
257 xmlreader_MoveToElement,
258 xmlreader_GetQualifiedName,
259 xmlreader_GetNamespaceUri,
260 xmlreader_GetLocalName,
263 xmlreader_ReadValueChunk,
264 xmlreader_GetBaseUri,
266 xmlreader_IsEmptyElement,
267 xmlreader_GetLineNumber,
268 xmlreader_GetLinePosition,
269 xmlreader_GetAttributeCount,
274 HRESULT WINAPI CreateXmlReader(REFIID riid, void **pObject, IMalloc *pMalloc)
278 TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), pObject, pMalloc);
280 if (pMalloc) FIXME("custom IMalloc not supported yet\n");
282 if (!IsEqualGUID(riid, &IID_IXmlReader))
284 ERR("Unexpected IID requested -> (%s)\n", wine_dbgstr_guid(riid));
288 reader = HeapAlloc(GetProcessHeap(), 0, sizeof (*reader));
289 if(!reader) return E_OUTOFMEMORY;
291 reader->lpVtbl = &xmlreader_vtbl;
294 *pObject = &reader->lpVtbl;
296 TRACE("returning iface %p\n", *pObject);
301 HRESULT WINAPI CreateXmlReaderInputWithEncodingName(IUnknown *stream,
306 IXmlReaderInput **ppInput)
308 FIXME("%p %p %s %d %s %p\n", stream, pMalloc, wine_dbgstr_w(encoding),
309 hint, wine_dbgstr_w(base_uri), ppInput);