wxString search with Index function

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
armink
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Aug 31, 2004 10:25 am
Location: Bavaria / Germany

wxString search with Index function

Post by armink » Tue Feb 08, 2005 2:31 pm

The doc says there's a func wxString::Index(...) defined as

size_t Index(const char* sz, bool caseSensitive = TRUE, bool fromEnd = FALSE) const

However compiler complains about

Code: Select all

...
mywxstring.Index("searchstring",false,false);
---
saying no matching function.

Whats wrong ?

Is there another non-case-sensitive search function for wxString if not with the function above ?[/code]

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Re: wxString search with Index function

Post by ABX » Tue Feb 08, 2005 2:34 pm

armink wrote:const char* sz
When docs says char*, it usually means wxChar* which is nothing important for ANSI build but serious difference in Unicode build. Are you working with Unicode build?

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2

armink
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Aug 31, 2004 10:25 am
Location: Bavaria / Germany

Post by armink » Tue Feb 08, 2005 2:41 pm

My setup.h says :

/*
* Compile wxString with some Unicode (wide character) support?
*/
#define wxUSE_WCHAR_T 1

/*
* Compile wxWindows in Unicode mode (Win32 only for now)?
*/
#define wxUSE_UNICODE 0

/*
* Use MS Layer for Unicode on Win9X (Win32 only)?
*/
#define wxUSE_UNICODE_MSLU 0

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Post by ABX » Tue Feb 08, 2005 2:51 pm

armink wrote:My setup.h says
What's your wxWidgets version and used toolkit?

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2

armink
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Aug 31, 2004 10:25 am
Location: Bavaria / Germany

Post by armink » Tue Feb 08, 2005 2:59 pm

version 2.4.2
OS: XP
Toolkit: what do you mean ?

armink
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Aug 31, 2004 10:25 am
Location: Bavaria / Germany

Post by armink » Tue Feb 08, 2005 3:04 pm

ps: working with cygwin and gcc

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Post by ABX » Tue Feb 08, 2005 3:14 pm

armink wrote:ps: working with cygwin and gcc
Yes, that's what I meant as toolkit. Unfortunatelly I have no idea what could be causing your problem :-(

ABX
CVS Head, 2.8.X
wxMSW, wxWinCE, wxPalmOS, wxOS2, wxMGL, bakefile
gcc 3.2.3, bcc 5.51, dmc 8.48, ow 1.6, vc 7.1, evc 3/4, pods 1.2

armink
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Aug 31, 2004 10:25 am
Location: Bavaria / Germany

Post by armink » Tue Feb 08, 2005 3:20 pm

Thanks nevertheless.

May be the function implementation was forgotten ?

The debugger presents only 2 of the 3 function modes as candidates:

error ...\wx\include\wx\string.h:786
candidates are: size_t wxString::Index(const wxChar*) const

787 ..\wx\include\wx\string.h size_t wxString::Index(char) const

:shock:

PS:
in string.h the following is written in line 786 ff:

Code: Select all

  // use Find (more general variants not yet supported)
  size_t Index(const wxChar* psz) const { return Find(psz); }
  size_t Index(wxChar ch)         const { return Find(ch);  }
  
... and not more ... for wxString.

The 3rd function mode is wrong documented / doesnt exist ... :!:

Linkku
Knows some wx things
Knows some wx things
Posts: 33
Joined: Sun Jan 02, 2005 5:16 pm

Post by Linkku » Tue Feb 08, 2005 6:40 pm

error ...\wx\include\wx\string.h:786
candidates are: size_t wxString::Index(const wxChar*) const
char *mychars = "searchstring";
mywxstring.Index((wxChar*)mychars,false,false);
--- http://linkku.has.it ---

- Debian Etch, KDevelop3, Anjuta2, wxWidgets CVS, GCC 3.3
- Windows XP, wxDevCpp, wxWidgets 2.6.1

Post Reply