WXDLLEXPORT added to wxStringTokenizer (and also several "const"s here and

there...)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2752 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-06-10 21:16:58 +00:00
parent b23198ab9e
commit 85833f5c6c
4 changed files with 126 additions and 116 deletions

View File

@@ -20,21 +20,22 @@
#include "wx/string.h"
#include "wx/filefn.h"
class wxStringTokenizer : public wxObject {
class WXDLLEXPORT wxStringTokenizer : public wxObject
{
public:
wxStringTokenizer(const wxString& to_tokenize,
const wxString& delims = " \t\r\n",
bool ret_delim = FALSE);
wxStringTokenizer() { m_string = ""; m_delims = ""; m_retdelims = FALSE;}
~wxStringTokenizer();
wxStringTokenizer() { m_retdelims = FALSE;}
virtual ~wxStringTokenizer();
int CountTokens() count;
bool HasMoreTokens();
int CountTokens();
bool HasMoreToken();
inline bool HasMoreTokens() { return HasMoreToken(); };
wxString NextToken();
// A better name!
inline wxString GetNextToken() { return NextToken(); };
wxString GetString() { return m_string; }
wxString GetNextToken() { return NextToken(); };
wxString GetString() const { return m_string; }
void SetString(const wxString& to_tokenize,
const wxString& delims = " \t\r\n",
@@ -47,11 +48,10 @@ public:
protected:
off_t FindDelims(const wxString& str, const wxString& delims);
void EatLeadingDelims(); // AVS - added to fix leading whitespace /
// mult. delims bugs
protected:
void EatLeadingDelims();
wxString m_string, m_delims;
bool m_retdelims;
};
#endif
#endif // _WX_TOKENZRH

View File

@@ -20,17 +20,11 @@
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#endif
#include "wx/object.h"
#include "wx/string.h"
#include "wx/tokenzr.h"
wxStringTokenizer::wxStringTokenizer(const wxString& to_tokenize,
const wxString& delims,
bool ret_delims)
: wxObject()
{
m_string = to_tokenize;
m_delims = delims;
@@ -43,21 +37,21 @@ wxStringTokenizer::~wxStringTokenizer()
off_t wxStringTokenizer::FindDelims(const wxString& str, const wxString& delims)
{
int i, j;
register int s_len = str.Length(),
len = delims.Length();
for ( int i = 0; i < str.Length(); i++ )
{
char c = str[i];
for (i=0;i<s_len;i++) {
register char c = str[i];
for (j=0;j<len;j++)
for ( int j = 0; j < delims.Length() ; j++ )
{
if ( delims[j] == c )
return i;
}
}
return -1;
}
int wxStringTokenizer::CountTokens()
int wxStringTokenizer::CountTokens() const
{
wxString p_string = m_string;
bool found = TRUE;
@@ -66,60 +60,76 @@ int wxStringTokenizer::CountTokens()
if (p_string.Length() == 0)
return 0;
while (found) {
while (found)
{
pos = FindDelims(p_string, m_delims);
if (pos != -1) {
if (pos != -1)
{
count++;
p_string = p_string(0, pos);
} else
}
else
{
found = FALSE;
}
}
return count;
}
bool wxStringTokenizer::HasMoreToken()
{
return (m_string.Length() != 0);
return !m_string.IsEmpty();
}
// AVS - added to fix leading whitespace / mult. delims bugs
// needed to fix leading whitespace / mult. delims bugs
void wxStringTokenizer::EatLeadingDelims()
{
int pos;
while ((pos=FindDelims(m_string, m_delims))==0) { // while leading delims
m_string = m_string.Mid((size_t)1); // trim 'em from the left
// while leading delims trim 'em from the left
while ( ( pos = FindDelims(m_string, m_delims)) == 0 )
{
m_string = m_string.Mid((size_t)1);
}
}
wxString wxStringTokenizer::NextToken()
{
register off_t pos, pos2;
off_t pos, pos2;
wxString r_string;
if (m_string.IsNull())
if ( m_string.IsEmpty() )
return m_string;
if ( !m_retdelims )
EatLeadingDelims(); // AVS - added to fix leading whitespace /
// mult. delims bugs
EatLeadingDelims();
pos = FindDelims(m_string, m_delims);
if (pos == -1) {
if (pos == -1)
{
r_string = m_string;
m_string = wxEmptyString;
return r_string;
}
if (m_retdelims) {
if (!pos) {
if (m_retdelims)
{
if (!pos)
{
pos++;
pos2 = 1;
} else
}
else
{
pos2 = pos;
} else
}
}
else
{
pos2 = pos + 1;
}
r_string = m_string.Left((size_t)pos);
m_string = m_string.Mid((size_t)pos2);

View File

@@ -41,14 +41,14 @@ IMPLEMENT_ABSTRACT_CLASS(wxHTMLHelpControllerBase, wxHelpControllerBase)
and a file mapping numerical Section numbers to relative URLS.
*/
wxHTMLHelpControllerBase::wxHTMLHelpControllerBase(void)
wxHTMLHelpControllerBase::wxHTMLHelpControllerBase()
{
m_MapList = (wxList*) NULL;
m_NumOfEntries = 0;
}
void
wxHTMLHelpControllerBase::DeleteList(void)
wxHTMLHelpControllerBase::DeleteList()
{
if(m_MapList)
{
@@ -64,7 +64,7 @@ wxHTMLHelpControllerBase::DeleteList(void)
}
}
wxHTMLHelpControllerBase::~wxHTMLHelpControllerBase(void)
wxHTMLHelpControllerBase::~wxHTMLHelpControllerBase()
{
DeleteList();
}
@@ -176,7 +176,7 @@ wxHTMLHelpControllerBase::LoadFile(const wxString& ifile)
bool
wxHTMLHelpControllerBase::DisplayContents(void)
wxHTMLHelpControllerBase::DisplayContents()
{
if(! m_NumOfEntries)
return FALSE;
@@ -272,13 +272,13 @@ wxHTMLHelpControllerBase::KeywordSearch(const wxString& k)
bool
wxHTMLHelpControllerBase::Quit(void)
wxHTMLHelpControllerBase::Quit()
{
return TRUE;
}
void
wxHTMLHelpControllerBase::OnQuit(void)
wxHTMLHelpControllerBase::OnQuit()
{
}

View File

@@ -161,7 +161,7 @@ wxClientDC::~wxClientDC()
// So we store a list of windows for which we already have the DC and not
// just one single hDC. This seems to work, but I'm really not sure about
// the usefullness of the whole idea - IMHO it's much better to not call
// base class OnPaint() at all, or, if we realyl want to allow it, add a
// base class OnPaint() at all, or, if we really want to allow it, add a
// "wxPaintDC *" parameter to wxPaintEvent which should be used if it's
// !NULL instead of creating a new DC.