[Libreoffice] Use sal_Unicode or RTL_CONSTASCII_USTRINGPARAM for single unicode character?

Joost Eekhoorn joost.eekhoorn at gmail.com
Sun Nov 21 01:59:18 PST 2010


Hi,

CONTEXT:

For single characters I see often sal_Unicode( '/' ) used and sometimes
OUString( sal_Unicode( '/' ).
Examples (for adding one space):

   - aDefaultPageName += sal_Unicode( ' ' );
   - sAuthor += OUString( sal_Unicode( ' ' );

sal_Unicode is defined in ./sal/inc/rtl/ustring.hxx

In ./sal/inc/rtl/ustring.hxx I see that OUString uses sal_Unicode.
There is also the typedef rtl_uString:
typedef struct _rtl_uString
{
    oslInterlockedCount refCount; /* opaque */
    sal_Int32           length;
    sal_Unicode         buffer[1];
} rtl_uString;

QUESTION:

So if there is SAuthor += OUString::createFromAscii( " " );
which is the correct replacement:

   - sAuthor += OUString( RTL_CONSTASCII_USTRINGPARAM(sal_Unicode( " " );
   - sAuthor += OUString( sal_Unicode( ' ' );
   - sAuthor += sal_Unicode( ' ' );

Joost
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101121/e2ff33c3/attachment.htm>


More information about the LibreOffice mailing list