1. wxLongLong and wxDateTime compilation fixed for the compilers without native
"long long" type (and some code in timercmn.cpp too) 2. wxDate and wxTime reimplemented using wxDateTime (old versions tagged as OLD_DATE_AND_TIME) 3. wxString::To(U)Long and ToDouble added and documented 4. bug with combobox in toolbar (drop down list wasn't dismissed) fixed 5. several wxDateTime::Parse() functions implemented 6. added support for coloured buttons under MSW (not completely finished) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1028,6 +1028,49 @@ int wxString::Find(const wxChar *pszSub) const
|
||||
return (psz == NULL) ? wxNOT_FOUND : psz - (const wxChar*) m_pchData;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// conversion to numbers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxString::ToLong(long *val) const
|
||||
{
|
||||
wxCHECK_MSG( val, FALSE, _T("NULL pointer in wxString::ToLong") );
|
||||
|
||||
const wxChar *start = c_str();
|
||||
wxChar *end;
|
||||
*val = wxStrtol(start, &end, 10);
|
||||
|
||||
// return TRUE only if scan was stopped by the terminating NUL and if the
|
||||
// string was not empty to start with
|
||||
return !*end && (end != start);
|
||||
}
|
||||
|
||||
bool wxString::ToULong(unsigned long *val) const
|
||||
{
|
||||
wxCHECK_MSG( val, FALSE, _T("NULL pointer in wxString::ToULong") );
|
||||
|
||||
const wxChar *start = c_str();
|
||||
wxChar *end;
|
||||
*val = wxStrtoul(start, &end, 10);
|
||||
|
||||
// return TRUE only if scan was stopped by the terminating NUL and if the
|
||||
// string was not empty to start with
|
||||
return !*end && (end != start);
|
||||
}
|
||||
|
||||
bool wxString::ToDouble(double *val) const
|
||||
{
|
||||
wxCHECK_MSG( val, FALSE, _T("NULL pointer in wxString::ToDouble") );
|
||||
|
||||
const wxChar *start = c_str();
|
||||
wxChar *end;
|
||||
*val = wxStrtod(start, &end);
|
||||
|
||||
// return TRUE only if scan was stopped by the terminating NUL and if the
|
||||
// string was not empty to start with
|
||||
return !*end && (end != start);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// stream-like operators
|
||||
// ---------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user