// Name: search.cpp
// Purpose: search engine
// Author: Vaclav Slavik
+// RCS-ID: $Id$
// Copyright: (c) 1999 Vaclav Slavik
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#pragma implementation
#endif
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
-#include <wx/defs.h>
+#include "wx/defs.h"
#if wxUSE_HTML
#ifdef __BORDLANDC__
#include <wx/wx.h>
#endif
-#include "search.h"
+#include "wx/html/helpdata.h"
void wxSearchEngine::LookFor(const wxString& keyword)
{
- if (m_Keyword) free(m_Keyword);
- m_Keyword = (char*) malloc(keyword.Length() + 1);
- strcpy(m_Keyword, keyword.c_str());
- for (int i = strlen(m_Keyword) - 1; i >= 0; i--)
- if ((m_Keyword[i] >= 'A') && (m_Keyword[i] <= 'Z'))
- m_Keyword[i] += 'a' - 'A';
+ if (m_Keyword) delete[] m_Keyword;
+ m_Keyword = new wxChar[keyword.Length() + 1];
+ wxStrcpy(m_Keyword, keyword.c_str());
+ for (int i = wxStrlen(m_Keyword) - 1; i >= 0; i--)
+ if ((m_Keyword[i] >= wxT('A')) && (m_Keyword[i] <= wxT('Z')))
+ m_Keyword[i] += wxT('a') - wxT('A');
}
int i, j;
int lng = stream ->GetSize();
- int wrd = strlen(m_Keyword);
+ int wrd = wxStrlen(m_Keyword);
bool found = FALSE;
- char *buf = (char*) malloc(lng + 1);
+ char *buf = new char[lng + 1];
stream -> Read(buf, lng);
buf[lng] = 0;
if (j == wrd) {found = TRUE; break;}
}
- free(buf);
+ delete[] buf;
return found;
}