Use C locale representation for floating point numbers in wxAny.

Always use the decimal point, regardless of the current locale.

This completes the changes of r74019.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74054 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2013-05-26 13:14:35 +00:00
parent 2e1894d608
commit 850a256b83
3 changed files with 9 additions and 1 deletions

View File

@ -236,6 +236,9 @@ Changes in behaviour not resulting in compilation errors, please read this!
GetEventObject() in all ports but the frame the menu was attached to in wxMSW.
Now all ports return the menu that was opened or closed as the event object.
- wxAny now uses C locale format for the floating point numbers and not the
current locale one, i.e. decimal point is always used.
Changes in behaviour which may result in compilation errors
-----------------------------------------------------------

View File

@ -48,6 +48,11 @@
object in heap for large objects (i.e. ones with size more than
WX_ANY_VALUE_BUFFER_SIZE, which at the time of writing is 16 bytes).
@note When performing conversions between strings and floating point
numbers, the representation of numbers in C locale is always used.
I.e. @code wxAny("1.23").GetAs<double>() @endcode will always work,
even if the current locale uses comma as decimal separator.
@library{wxbase}
@category{data}

View File

@ -453,7 +453,7 @@ bool wxAnyValueTypeImplDouble::ConvertValue(const wxAnyValueBuffer& src,
}
else if ( wxANY_VALUE_TYPE_CHECK_TYPE(dstType, wxString) )
{
wxString s = wxString::Format(wxS("%.14g"), value);
wxString s = wxString::FromCDouble(value, 14);
wxAnyValueTypeImpl<wxString>::SetValue(s, dst);
}
else