2 * Word splitter Implementation
4 * Copyright 2006 Mike McCormack
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
33 #include "wine/unicode.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
38 typedef struct tag_wordbreaker_impl
40 const IWordBreakerVtbl *lpVtbl;
44 static HRESULT WINAPI wb_QueryInterface( IWordBreaker *iface,
45 REFIID riid, LPVOID *ppvObj)
47 wordbreaker_impl *This = (wordbreaker_impl *)iface;
49 TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
53 if (IsEqualIID(riid, &IID_IUnknown) ||
54 IsEqualIID(riid, &IID_IWordBreaker))
60 TRACE("-- E_NOINTERFACE\n");
64 static ULONG WINAPI wb_AddRef( IWordBreaker *iface )
66 wordbreaker_impl *This = (wordbreaker_impl *)iface;
67 return InterlockedIncrement(&This->ref);
70 static ULONG WINAPI wb_Release(IWordBreaker *iface)
72 wordbreaker_impl *This = (wordbreaker_impl *)iface;
75 refcount = InterlockedDecrement(&This->ref);
77 HeapFree(GetProcessHeap(), 0, This);
82 static HRESULT WINAPI wb_Init( IWordBreaker *iface,
83 BOOL fQuery, ULONG ulMaxTokenSize, BOOL *pfLicense )
85 TRACE("%d %lu\n", fQuery, ulMaxTokenSize);
90 static HRESULT WINAPI wb_BreakText( IWordBreaker *iface,
91 TEXT_SOURCE *pTextSource, IWordSink *pWordSink, IPhraseSink *pPhraseSink)
96 FIXME("%p %p %p\n", pTextSource, pWordSink, pPhraseSink);
98 p = pTextSource->awcBuffer;
102 /* skip spaces and punctuation */
103 while(ispunctW(*p) || isspaceW(*p))
106 /* find the end of the word */
108 while(*q && !ispunctW(*q) && !isspaceW(*q))
115 IWordSink_PutWord( pWordSink, len, p, len, p - pTextSource->awcBuffer );
122 static HRESULT WINAPI wb_ComposePhrase( IWordBreaker *iface,
123 const WCHAR *pwcNoun, ULONG cwcNoun,
124 const WCHAR *pwcModifier, ULONG cwcModifier,
125 ULONG ulAttachmentType, WCHAR *pwcPhrase, ULONG *pcwcPhrase)
127 FIXME("%p %lu %p %lu %lu %p %p\n", pwcNoun, cwcNoun,
128 pwcModifier, cwcModifier, ulAttachmentType, pwcPhrase, pcwcPhrase);
132 static HRESULT WINAPI wb_GetLicenseToUse( IWordBreaker *iface, const WCHAR **ppwcsLicense )
134 FIXME("%p\n", ppwcsLicense);
135 *ppwcsLicense = NULL;
139 static const IWordBreakerVtbl wordbreaker_vtbl =
150 HRESULT WINAPI wb_en_us_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOID *ppvObject)
152 wordbreaker_impl *This;
155 FIXME("%p %s %p\n", pUnkOuter, debugstr_guid(riid), ppvObject);
157 This = HeapAlloc(GetProcessHeap(), 0, sizeof *This);
159 return E_OUTOFMEMORY;
162 This->lpVtbl = &wordbreaker_vtbl;
164 wb = (IWordBreaker*) This;
166 return IWordBreaker_QueryInterface(wb, riid, ppvObject);