1998-09-06 14:28:00 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tokenzr.h
|
|
|
|
// Purpose: String tokenizer
|
|
|
|
// Author: Guilhem Lavaux
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04/22/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Guilhem Lavaux
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_TOKENZRH
|
|
|
|
#define _WX_TOKENZRH
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
1998-09-08 14:21:16 -04:00
|
|
|
#include "wx/filefn.h"
|
1998-09-06 14:28:00 -04:00
|
|
|
|
1999-06-10 17:16:58 -04:00
|
|
|
class WXDLLEXPORT wxStringTokenizer : public wxObject
|
|
|
|
{
|
1998-09-06 14:28:00 -04:00
|
|
|
public:
|
1999-06-10 17:16:58 -04:00
|
|
|
wxStringTokenizer(const wxString& to_tokenize,
|
|
|
|
const wxString& delims = " \t\r\n",
|
|
|
|
bool ret_delim = FALSE);
|
|
|
|
wxStringTokenizer() { m_retdelims = FALSE;}
|
|
|
|
virtual ~wxStringTokenizer();
|
|
|
|
|
1999-06-10 19:00:03 -04:00
|
|
|
int CountTokens() const;
|
1999-06-10 17:16:58 -04:00
|
|
|
bool HasMoreTokens();
|
|
|
|
|
|
|
|
wxString NextToken();
|
|
|
|
wxString GetNextToken() { return NextToken(); };
|
|
|
|
|
|
|
|
wxString GetString() const { return m_string; }
|
|
|
|
|
|
|
|
void SetString(const wxString& to_tokenize,
|
|
|
|
const wxString& delims = " \t\r\n",
|
|
|
|
bool ret_delim = FALSE)
|
|
|
|
{
|
|
|
|
m_string = to_tokenize;
|
|
|
|
m_delims = delims;
|
|
|
|
m_retdelims = ret_delim;
|
|
|
|
}
|
1999-02-16 15:17:02 -05:00
|
|
|
|
1998-09-06 14:28:00 -04:00
|
|
|
protected:
|
1999-06-10 19:00:03 -04:00
|
|
|
off_t FindDelims(const wxString& str, const wxString& delims) const;
|
1999-06-10 17:16:58 -04:00
|
|
|
void EatLeadingDelims();
|
|
|
|
|
|
|
|
wxString m_string, m_delims;
|
|
|
|
bool m_retdelims;
|
1998-09-06 14:28:00 -04:00
|
|
|
};
|
|
|
|
|
1999-06-10 17:16:58 -04:00
|
|
|
#endif // _WX_TOKENZRH
|