1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHtmlHelpData
4 // Notes: Based on htmlhelp.cpp, implementing a monolithic
5 // HTML Help controller class, by Vaclav Slavik
6 // Author: Harm van der Heijden and Vaclav Slavik
8 // Copyright: (c) Harm van der Heijden and Vaclav Slavik
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "helpdata.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
25 #if wxUSE_HTML && wxUSE_STREAMS
34 #include "wx/html/helpdata.h"
35 #include "wx/tokenzr.h"
36 #include "wx/wfstream.h"
37 #include "wx/busyinfo.h"
38 #include "wx/encconv.h"
39 #include "wx/fontmap.h"
41 #include "wx/html/htmlpars.h"
42 #include "wx/html/htmldefs.h"
43 #include "wx/html/htmlfilt.h"
44 #include "wx/filename.h"
46 #include "wx/arrimpl.cpp"
47 WX_DEFINE_OBJARRAY(wxHtmlBookRecArray
)
49 //-----------------------------------------------------------------------------
50 // static helper functions
51 //-----------------------------------------------------------------------------
53 // Reads one line, stores it into buf and returns pointer to new line or NULL.
54 static const wxChar
* ReadLine(const wxChar
*line
, wxChar
*buf
, size_t bufsize
)
56 wxChar
*writeptr
= buf
;
57 wxChar
*endptr
= buf
+ bufsize
- 1;
58 const wxChar
*readptr
= line
;
60 while (*readptr
!= 0 && *readptr
!= _T('\r') && *readptr
!= _T('\n') &&
62 *(writeptr
++) = *(readptr
++);
64 while (*readptr
== _T('\r') || *readptr
== _T('\n'))
74 extern "C" int LINKAGEMODE
75 wxHtmlHelpIndexCompareFunc(const void *a
, const void *b
)
77 return ((wxHtmlContentsItem
*)a
)->m_Name
.CmpNoCase(((wxHtmlContentsItem
*)b
)->m_Name
);
82 static T
* ReallocArray(T
*arr
, size_t oldsize
, size_t newsize
)
84 T
*newarr
= new T
[newsize
];
85 for (size_t i
= 0; i
< oldsize
; i
++)
91 //-----------------------------------------------------------------------------
93 //-----------------------------------------------------------------------------
95 class HP_Parser
: public wxHtmlParser
100 GetEntitiesParser()->SetEncoding(wxFONTENCODING_ISO8859_1
);
103 wxObject
* GetProduct() { return NULL
; }
106 virtual void AddText(const wxChar
* WXUNUSED(txt
)) {}
108 DECLARE_NO_COPY_CLASS(HP_Parser
)
112 //-----------------------------------------------------------------------------
114 //-----------------------------------------------------------------------------
116 class HP_TagHandler
: public wxHtmlTagHandler
119 wxString m_Name
, m_Page
;
123 wxHtmlContentsItem
*m_Items
;
125 wxHtmlBookRecord
*m_Book
;
128 HP_TagHandler(wxHtmlBookRecord
*b
) : wxHtmlTagHandler()
129 { m_Book
= b
; m_Items
= NULL
; m_ItemsCnt
= 0; m_Name
= m_Page
= wxEmptyString
;
130 m_Level
= 0; m_ID
= -1; }
131 wxString
GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); }
132 bool HandleTag(const wxHtmlTag
& tag
);
133 void WriteOut(wxHtmlContentsItem
*& array
, int& size
);
134 void ReadIn(wxHtmlContentsItem
* array
, int size
);
136 DECLARE_NO_COPY_CLASS(HP_TagHandler
)
140 bool HP_TagHandler::HandleTag(const wxHtmlTag
& tag
)
142 if (tag
.GetName() == wxT("UL"))
149 else if (tag
.GetName() == wxT("OBJECT"))
151 m_Name
= m_Page
= wxEmptyString
;
155 if (!m_Page
.IsEmpty())
156 /* Valid HHW's file may contain only two object tags:
158 <OBJECT type="text/site properties">
159 <param name="ImageType" value="Folder">
164 <OBJECT type="text/sitemap">
165 <param name="Name" value="main page">
166 <param name="Local" value="another.htm">
169 We're interested in the latter. !m_Page.IsEmpty() is valid
170 condition because text/site properties does not contain Local param
173 if (tag
.GetParam(wxT("TYPE")) == wxT("text/sitemap"))
175 if (m_ItemsCnt
% wxHTML_REALLOC_STEP
== 0)
176 m_Items
= ReallocArray(m_Items
, m_ItemsCnt
,
177 m_ItemsCnt
+ wxHTML_REALLOC_STEP
);
179 m_Items
[m_ItemsCnt
].m_Level
= m_Level
;
180 m_Items
[m_ItemsCnt
].m_ID
= m_ID
;
181 m_Items
[m_ItemsCnt
].m_Page
= m_Page
;
182 m_Items
[m_ItemsCnt
].m_Name
= m_Name
;
183 m_Items
[m_ItemsCnt
].m_Book
= m_Book
;
191 if (m_Name
== wxEmptyString
&& tag
.GetParam(wxT("NAME")) == wxT("Name"))
192 m_Name
= tag
.GetParam(wxT("VALUE"));
193 if (tag
.GetParam(wxT("NAME")) == wxT("Local"))
194 m_Page
= tag
.GetParam(wxT("VALUE"));
195 if (tag
.GetParam(wxT("NAME")) == wxT("ID"))
196 tag
.GetParamAsInt(wxT("VALUE"), &m_ID
);
203 void HP_TagHandler::WriteOut(wxHtmlContentsItem
*& array
, int& size
)
211 void HP_TagHandler::ReadIn(wxHtmlContentsItem
* array
, int size
)
220 //-----------------------------------------------------------------------------
222 //-----------------------------------------------------------------------------
224 wxString
wxHtmlBookRecord::GetFullPath(const wxString
&page
) const
226 if (wxIsAbsolutePath(page
))
229 return m_BasePath
+ page
;
234 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpData
, wxObject
)
236 wxHtmlHelpData::wxHtmlHelpData()
238 m_TempPath
= wxEmptyString
;
246 wxHtmlHelpData::~wxHtmlHelpData()
248 m_BookRecords
.Empty();
253 bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord
*book
, wxFileSystem
& fsys
,
254 const wxString
& indexfile
,
255 const wxString
& contentsfile
)
258 wxHtmlFilterHTML filter
;
263 HP_TagHandler
*handler
= new HP_TagHandler(book
);
264 parser
.AddTagHandler(handler
);
266 f
= ( contentsfile
.IsEmpty() ? (wxFSFile
*) NULL
: fsys
.OpenFile(contentsfile
) );
270 buf
= filter
.ReadFile(*f
);
272 handler
->ReadIn(m_Contents
, m_ContentsCnt
);
274 handler
->WriteOut(m_Contents
, m_ContentsCnt
);
278 wxLogError(_("Cannot open contents file: %s"), contentsfile
.c_str());
281 f
= ( indexfile
.IsEmpty() ? (wxFSFile
*) NULL
: fsys
.OpenFile(indexfile
) );
285 buf
= filter
.ReadFile(*f
);
287 handler
->ReadIn(m_Index
, m_IndexCnt
);
289 handler
->WriteOut(m_Index
, m_IndexCnt
);
291 else if (!indexfile
.IsEmpty())
293 wxLogError(_("Cannot open index file: %s"), indexfile
.c_str());
298 inline static void CacheWriteInt32(wxOutputStream
*f
, wxInt32 value
)
300 wxInt32 x
= wxINT32_SWAP_ON_BE(value
);
301 f
->Write(&x
, sizeof(x
));
304 inline static wxInt32
CacheReadInt32(wxInputStream
*f
)
307 f
->Read(&x
, sizeof(x
));
308 return wxINT32_SWAP_ON_BE(x
);
311 inline static void CacheWriteString(wxOutputStream
*f
, const wxString
& str
)
313 const wxWX2MBbuf mbstr
= str
.mb_str(wxConvUTF8
);
314 size_t len
= strlen((const char*)mbstr
)+1;
315 CacheWriteInt32(f
, len
);
316 f
->Write((const char*)mbstr
, len
);
319 inline static wxString
CacheReadString(wxInputStream
*f
)
321 size_t len
= (size_t)CacheReadInt32(f
);
322 wxCharBuffer
str(len
-1);
323 f
->Read(str
.data(), len
);
324 return wxString(str
, wxConvUTF8
);
327 #define CURRENT_CACHED_BOOK_VERSION 4
329 // Additional flags to detect incompatibilities of the runtime environment:
330 #define CACHED_BOOK_FORMAT_FLAGS \
334 bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord
*book
, wxInputStream
*f
)
339 /* load header - version info : */
340 version
= CacheReadInt32(f
);
342 if (version
!= CURRENT_CACHED_BOOK_VERSION
)
344 // NB: We can just silently return FALSE here and don't worry about
345 // it anymore, because AddBookParam will load the MS project in
346 // absence of (properly versioned) .cached file and automatically
347 // create new .cached file immediately afterward.
351 if (CacheReadInt32(f
) != CACHED_BOOK_FORMAT_FLAGS
)
354 /* load contents : */
356 m_ContentsCnt
+= CacheReadInt32(f
);
357 m_Contents
= ReallocArray(m_Contents
, st
,
358 (m_ContentsCnt
/ wxHTML_REALLOC_STEP
+ 1) *
359 wxHTML_REALLOC_STEP
);
360 for (i
= st
; i
< m_ContentsCnt
; i
++)
362 m_Contents
[i
].m_Level
= CacheReadInt32(f
);
363 m_Contents
[i
].m_ID
= CacheReadInt32(f
);
364 m_Contents
[i
].m_Name
= CacheReadString(f
);
365 m_Contents
[i
].m_Page
= CacheReadString(f
);
366 m_Contents
[i
].m_Book
= book
;
371 m_IndexCnt
+= CacheReadInt32(f
);
372 m_Index
= ReallocArray(m_Index
, st
,
373 (m_IndexCnt
/ wxHTML_REALLOC_STEP
+ 1) *
374 wxHTML_REALLOC_STEP
);
375 for (i
= st
; i
< m_IndexCnt
; i
++)
377 m_Index
[i
].m_Name
= CacheReadString(f
);
378 m_Index
[i
].m_Page
= CacheReadString(f
);
379 m_Index
[i
].m_Book
= book
;
385 bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord
*book
, wxOutputStream
*f
)
390 /* save header - version info : */
391 CacheWriteInt32(f
, CURRENT_CACHED_BOOK_VERSION
);
392 CacheWriteInt32(f
, CACHED_BOOK_FORMAT_FLAGS
);
394 /* save contents : */
395 for (cnt
= 0, i
= 0; i
< m_ContentsCnt
; i
++)
396 if (m_Contents
[i
].m_Book
== book
&& m_Contents
[i
].m_Level
> 0)
398 CacheWriteInt32(f
, cnt
);
400 for (i
= 0; i
< m_ContentsCnt
; i
++)
402 if (m_Contents
[i
].m_Book
!= book
|| m_Contents
[i
].m_Level
== 0)
404 CacheWriteInt32(f
, m_Contents
[i
].m_Level
);
405 CacheWriteInt32(f
, m_Contents
[i
].m_ID
);
406 CacheWriteString(f
, m_Contents
[i
].m_Name
);
407 CacheWriteString(f
, m_Contents
[i
].m_Page
);
411 for (cnt
= 0, i
= 0; i
< m_IndexCnt
; i
++)
412 if (m_Index
[i
].m_Book
== book
&& m_Index
[i
].m_Level
> 0)
414 CacheWriteInt32(f
, cnt
);
416 for (i
= 0; i
< m_IndexCnt
; i
++)
418 if (m_Index
[i
].m_Book
!= book
|| m_Index
[i
].m_Level
== 0)
420 CacheWriteString(f
, m_Index
[i
].m_Name
);
421 CacheWriteString(f
, m_Index
[i
].m_Page
);
427 void wxHtmlHelpData::SetTempDir(const wxString
& path
)
429 if (path
== wxEmptyString
) m_TempPath
= path
;
432 if (wxIsAbsolutePath(path
)) m_TempPath
= path
;
433 else m_TempPath
= wxGetCwd() + _T("/") + path
;
435 if (m_TempPath
[m_TempPath
.Length() - 1] != _T('/'))
436 m_TempPath
<< _T('/');
442 static wxString
SafeFileName(const wxString
& s
)
445 res
.Replace(wxT("#"), wxT("_"));
446 res
.Replace(wxT(":"), wxT("_"));
447 res
.Replace(wxT("\\"), wxT("_"));
448 res
.Replace(wxT("/"), wxT("_"));
452 bool wxHtmlHelpData::AddBookParam(const wxFSFile
& bookfile
,
453 wxFontEncoding encoding
,
454 const wxString
& title
, const wxString
& contfile
,
455 const wxString
& indexfile
, const wxString
& deftopic
,
456 const wxString
& path
)
460 wxHtmlBookRecord
*bookr
;
462 int IndexOld
= m_IndexCnt
,
463 ContentsOld
= m_ContentsCnt
;
466 fsys
.ChangePathTo(path
, TRUE
);
468 size_t booksCnt
= m_BookRecords
.GetCount();
469 for (size_t i
= 0; i
< booksCnt
; i
++)
471 if ( m_BookRecords
[i
].GetBookFile() == bookfile
.GetLocation() )
472 return TRUE
; // book is (was) loaded
475 bookr
= new wxHtmlBookRecord(bookfile
.GetLocation(), fsys
.GetPath(), title
, deftopic
);
477 if (m_ContentsCnt
% wxHTML_REALLOC_STEP
== 0)
478 m_Contents
= ReallocArray(m_Contents
, m_ContentsCnt
,
479 m_ContentsCnt
+ wxHTML_REALLOC_STEP
);
480 m_Contents
[m_ContentsCnt
].m_Level
= 0;
481 m_Contents
[m_ContentsCnt
].m_ID
= 0;
482 m_Contents
[m_ContentsCnt
].m_Page
= deftopic
;
483 m_Contents
[m_ContentsCnt
].m_Name
= title
;
484 m_Contents
[m_ContentsCnt
].m_Book
= bookr
;
486 // store the contents index for later
487 int cont_start
= m_ContentsCnt
++;
489 // Try to find cached binary versions:
490 // 1. save file as book, but with .hhp.cached extension
491 // 2. same as 1. but in temp path
492 // 3. otherwise or if cache load failed, load it from MS.
494 fi
= fsys
.OpenFile(bookfile
.GetLocation() + wxT(".cached"));
498 fi
->GetModificationTime() < bookfile
.GetModificationTime() ||
499 #endif // wxUSE_DATETIME
500 !LoadCachedBook(bookr
, fi
->GetStream()))
502 if (fi
!= NULL
) delete fi
;
503 fi
= fsys
.OpenFile(m_TempPath
+ wxFileNameFromPath(bookfile
.GetLocation()) + wxT(".cached"));
504 if (m_TempPath
== wxEmptyString
|| fi
== NULL
||
506 fi
->GetModificationTime() < bookfile
.GetModificationTime() ||
507 #endif // wxUSE_DATETIME
508 !LoadCachedBook(bookr
, fi
->GetStream()))
510 LoadMSProject(bookr
, fsys
, indexfile
, contfile
);
511 if (m_TempPath
!= wxEmptyString
)
513 wxFileOutputStream
*outs
= new wxFileOutputStream(m_TempPath
+
514 SafeFileName(wxFileNameFromPath(bookfile
.GetLocation())) + wxT(".cached"));
515 SaveCachedBook(bookr
, outs
);
521 if (fi
!= NULL
) delete fi
;
523 // Now store the contents range
524 bookr
->SetContentsRange(cont_start
, m_ContentsCnt
);
527 // MS HTML Help files [written by MS HTML Help Workshop] are broken
528 // in that the data are iso-8859-1 (including HTML entities), but must
529 // be interpreted as being in language's windows charset. Correct the
530 // differences here and also convert to wxConvLocal in ANSI build
531 if (encoding
!= wxFONTENCODING_SYSTEM
)
534 #define CORRECT_STR(str, conv) \
535 str = wxString((str).mb_str(wxConvISO8859_1), conv)
537 #define CORRECT_STR(str, conv) \
538 str = wxString((str).wc_str(conv), wxConvLocal)
540 wxCSConv
conv(encoding
);
542 for (i
= IndexOld
; i
< m_IndexCnt
; i
++)
544 CORRECT_STR(m_Index
[i
].m_Name
, conv
);
546 for (i
= ContentsOld
; i
< m_ContentsCnt
; i
++)
548 CORRECT_STR(m_Contents
[i
].m_Name
, conv
);
553 wxUnusedVar(IndexOld
);
554 wxUnusedVar(ContentsOld
);
555 wxASSERT_MSG(encoding
== wxFONTENCODING_SYSTEM
, wxT("Help files need charset conversion, but wxUSE_WCHAR_T is 0"));
556 #endif // wxUSE_WCHAR_T/!wxUSE_WCHAR_T
558 m_BookRecords
.Add(bookr
);
560 qsort(m_Index
, m_IndexCnt
, sizeof(wxHtmlContentsItem
), wxHtmlHelpIndexCompareFunc
);
566 bool wxHtmlHelpData::AddBook(const wxString
& book
)
568 wxString
extension(book
.Right(4).Lower());
569 if (extension
== wxT(".zip") ||
571 extension
== wxT(".chm") /*compressed html help book*/ ||
573 extension
== wxT(".htb") /*html book*/)
580 if (extension
== wxT(".chm"))
581 s
= fsys
.FindFirst(book
+ wxT("#chm:*.hhp"), wxFILE
);
584 s
= fsys
.FindFirst(book
+ wxT("#zip:*.hhp"), wxFILE
);
588 if (AddBook(s
)) rt
= TRUE
;
598 wxString title
= _("noname"),
600 start
= wxEmptyString
,
601 contents
= wxEmptyString
,
602 index
= wxEmptyString
,
603 charset
= wxEmptyString
;
605 fi
= fsys
.OpenFile(book
);
608 wxLogError(_("Cannot open HTML help book: %s"), book
.c_str());
611 fsys
.ChangePathTo(book
);
613 const wxChar
*lineptr
;
616 wxHtmlFilterPlainText filter
;
617 tmp
= filter
.ReadFile(*fi
);
618 lineptr
= tmp
.c_str();
622 lineptr
= ReadLine(lineptr
, linebuf
, 300);
624 for (wxChar
*ch
= linebuf
; *ch
!= wxT('\0') && *ch
!= wxT('='); ch
++)
627 if (wxStrstr(linebuf
, _T("title=")) == linebuf
)
628 title
= linebuf
+ wxStrlen(_T("title="));
629 if (wxStrstr(linebuf
, _T("default topic=")) == linebuf
)
630 start
= linebuf
+ wxStrlen(_T("default topic="));
631 if (wxStrstr(linebuf
, _T("index file=")) == linebuf
)
632 index
= linebuf
+ wxStrlen(_T("index file="));
633 if (wxStrstr(linebuf
, _T("contents file=")) == linebuf
)
634 contents
= linebuf
+ wxStrlen(_T("contents file="));
635 if (wxStrstr(linebuf
, _T("charset=")) == linebuf
)
636 charset
= linebuf
+ wxStrlen(_T("charset="));
637 } while (lineptr
!= NULL
);
640 if (charset
== wxEmptyString
) enc
= wxFONTENCODING_SYSTEM
;
641 else enc
= wxFontMapper::Get()->CharsetToEncoding(charset
);
643 bool rtval
= AddBookParam(*fi
, enc
,
644 title
, contents
, index
, start
, fsys
.GetPath());
649 wxString
wxHtmlHelpData::FindPageByName(const wxString
& x
)
655 wxString
url(wxEmptyString
);
657 /* 1. try to open given file: */
659 cnt
= m_BookRecords
.GetCount();
660 for (i
= 0; i
< cnt
; i
++)
662 f
= fsys
.OpenFile(m_BookRecords
[i
].GetFullPath(x
));
665 url
= m_BookRecords
[i
].GetFullPath(x
);
672 /* 2. try to find a book: */
674 for (i
= 0; i
< cnt
; i
++)
676 if (m_BookRecords
[i
].GetTitle() == x
)
678 url
= m_BookRecords
[i
].GetFullPath(m_BookRecords
[i
].GetStart());
683 /* 3. try to find in contents: */
686 for (i
= 0; i
< cnt
; i
++)
688 if (m_Contents
[i
].m_Name
== x
)
690 url
= m_Contents
[i
].GetFullPath();
696 /* 4. try to find in index: */
699 for (i
= 0; i
< cnt
; i
++)
701 if (m_Index
[i
].m_Name
== x
)
703 url
= m_Index
[i
].GetFullPath();
711 wxString
wxHtmlHelpData::FindPageById(int id
)
714 wxString
url(wxEmptyString
);
716 for (i
= 0; i
< m_ContentsCnt
; i
++)
718 if (m_Contents
[i
].m_ID
== id
)
720 url
= m_Contents
[i
].GetFullPath();
728 //----------------------------------------------------------------------------------
729 // wxHtmlSearchStatus functions
730 //----------------------------------------------------------------------------------
732 wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData
* data
, const wxString
& keyword
,
733 bool case_sensitive
, bool whole_words_only
,
734 const wxString
& book
)
738 wxHtmlBookRecord
* bookr
= NULL
;
739 if (book
!= wxEmptyString
)
741 // we have to search in a specific book. Find it first
742 int i
, cnt
= data
->m_BookRecords
.GetCount();
743 for (i
= 0; i
< cnt
; i
++)
744 if (data
->m_BookRecords
[i
].GetTitle() == book
)
746 bookr
= &(data
->m_BookRecords
[i
]);
747 m_CurIndex
= bookr
->GetContentsStart();
748 m_MaxIndex
= bookr
->GetContentsEnd();
751 // check; we won't crash if the book doesn't exist, but it's Bad Anyway.
756 // no book specified; search all books
758 m_MaxIndex
= m_Data
->m_ContentsCnt
;
760 m_Engine
.LookFor(keyword
, case_sensitive
, whole_words_only
);
761 m_Active
= (m_CurIndex
< m_MaxIndex
);
764 bool wxHtmlSearchStatus::Search()
767 int i
= m_CurIndex
; // shortcut
773 // sanity check. Illegal use, but we'll try to prevent a crash anyway
778 m_Name
= wxEmptyString
;
779 m_ContentsItem
= NULL
;
780 thepage
= m_Data
->m_Contents
[i
].m_Page
;
782 m_Active
= (++m_CurIndex
< m_MaxIndex
);
783 // check if it is same page with different anchor:
784 if (!m_LastPage
.empty())
786 const wxChar
*p1
, *p2
;
787 for (p1
= thepage
.c_str(), p2
= m_LastPage
.c_str();
788 *p1
!= 0 && *p1
!= _T('#') && *p1
== *p2
; p1
++, p2
++) {}
790 m_LastPage
= thepage
;
792 if (*p1
== 0 || *p1
== _T('#'))
795 else m_LastPage
= thepage
;
798 file
= fsys
.OpenFile(m_Data
->m_Contents
[i
].m_Book
->GetFullPath(thepage
));
801 if (m_Engine
.Scan(*file
))
803 m_Name
= m_Data
->m_Contents
[i
].m_Name
;
804 m_ContentsItem
= m_Data
->m_Contents
+ i
;
819 //--------------------------------------------------------------------------------
820 // wxHtmlSearchEngine
821 //--------------------------------------------------------------------------------
823 void wxHtmlSearchEngine::LookFor(const wxString
& keyword
, bool case_sensitive
, bool whole_words_only
)
825 m_CaseSensitive
= case_sensitive
;
826 m_WholeWords
= whole_words_only
;
830 m_Keyword
.LowerCase();
834 static inline bool WHITESPACE(wxChar c
)
836 return c
== _T(' ') || c
== _T('\n') || c
== _T('\r') || c
== _T('\t');
839 bool wxHtmlSearchEngine::Scan(const wxFSFile
& file
)
841 wxASSERT_MSG(!m_Keyword
.empty(), wxT("wxHtmlSearchEngine::LookFor must be called before scanning!"));
844 int wrd
= m_Keyword
.Length();
846 wxHtmlFilterHTML filter
;
847 wxString tmp
= filter
.ReadFile(file
);
848 int lng
= tmp
.length();
849 const wxChar
*buf
= tmp
.c_str();
851 if (!m_CaseSensitive
)
854 const wxChar
*kwd
= m_Keyword
.c_str();
858 for (i
= 0; i
< lng
- wrd
; i
++)
860 if (WHITESPACE(buf
[i
])) continue;
862 while ((j
< wrd
) && (buf
[i
+ j
] == kwd
[j
])) j
++;
863 if (j
== wrd
&& WHITESPACE(buf
[i
+ j
])) { found
= true; break; }
869 for (i
= 0; i
< lng
- wrd
; i
++)
872 while ((j
< wrd
) && (buf
[i
+ j
] == kwd
[j
])) j
++;
873 if (j
== wrd
) { found
= true; break; }