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

2010-11-22 Thread Michael Meeks
Hi Joost,

On Sun, 2010-11-21 at 10:59 +0100, Joost Eekhoorn wrote:
 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( ' ' );

I suppose the last of these can at least be made more efficient later
if this is found to be a problem - by adding a new overloaded operator
for this case. It is also shorter and easier to read IMHO.

But efficiency-wise, they are equivalent.

HTH,

Michael.

-- 
 michael.me...@novell.com  , Pseudo Engineer, itinerant idiot


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2010-11-21 Thread Joost Eekhoorn
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
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice