Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


On Fri, May 16, 2014 at 10:30:27AM -0700, julien2412 [via Document Foundation Mail Archive] wrote:

I noticed this:
s_aTypeNameMap[GetXMLToken( XML_FLOAT)] = ::cppu::UnoType<double>::get();
present at 2 locations:
See
http://opengrok.libreoffice.org/search?q=%22GetXMLToken%28+XML_FLOAT%29%22&project=core&defs=&refs=&path=&hist=

Why shouldn't be this:
s_aTypeNameMap[GetXMLToken( XML_FLOAT)] = ::cppu::UnoType<float>::get();
?

Also in xmloff/source/forms/propertyimport.cxx (which is not found by
the above search).

In that file I also see:

    token::XMLTokenEnum OPropertyExport::implGetPropertyXMLType(const ::com::sun::star::uno::Type& 
_rType)
    {
        // handle the type description
        switch (_rType.getTypeClass())
        {
            case TypeClass_DOUBLE:
            case TypeClass_BYTE:
            case TypeClass_SHORT:
            case TypeClass_LONG:
            case TypeClass_HYPER:
            case TypeClass_ENUM:
                return token::XML_FLOAT;


So there, clearly, all numeric types (including the UNO double)
consistently map to XML_FLOAT, so taking the extra precision from the
C++ type "float" to "double" makes absolute sense. What is called
"float" in XML seems to be the general notion of number, not
specifically the IEE754 single precision 32-bit floating point.


Looking into an .odb file's reports, I don't see "double" used at
all. Again, "float" seems to be used in the general sense of
"number". This is confirmed by
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1417680_253892949
which shows that the ODF format uses the XML token "float" to mean
"number", and does not have a difference between the notion of
"integer" and "floating point", much less between different precision
levels of floating point data types.

So again, it makes sense to use the C++ type "double" for that (extra
precision, matches the type used by our numeric formatters, ...).

-- 
Lionel




--
View this message in context: 
http://nabble.documentfoundation.org/Question-unoType-for-getXmlToken-dbaccess-reportdesign-module-tp4109071p4109116.html
Sent from the Dev mailing list archive at Nabble.com.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.