fdo#38838 - Removal/Replacement of the String/UniString with OUString once and for all.

Michael Stahl mstahl at redhat.com
Tue Jan 15 05:16:42 PST 2013


On 15/01/13 13:58, Jean-Noël Rouvignac wrote:

>   * What are the guidelines to replace String? When to use OString and
>     when to use OUString?

in almost all cases, convert to OUString.

there also used to be a ByteString that corresponded to OString but that
has already been removed.

>   * What is XubString?
>     https://wiki.documentfoundation.org/Development/String_Classes does
>     not mention it.

it is the same as String.

tools/inc/tools/solar.h:

#define UniString       String
#define XubString       String
#define xub_StrLen      sal_uInt16

>   * What about the associated type xub_StrLen ?

good question... there is code that loops over the sal_Unicode UTF-16
code units in the string (Note: those are not "characters").  since
String has a maximum capacity of 2^16, and the xub_StrLen is a "short",
and OUString of 2^31 the indexes in such loops most likely need to be
adapted to sal_Int32.

there is also a method OUString::iterateCodePoints that gives the actual
characters, which could be useful in some places.

> If somebody has got the answers, could he update
> https://wiki.documentfoundation.org/Development/String_Classes?

i'll try to do that...

> Finally I noticed there is no doxygen generated for XubString, UniString
> or String under http://api.libreoffice.org/docs.

that is not surprising, since those classes are (fortunately) not part
of the API, they are just LO implementation details (so we can remove them).




More information about the LibreOffice mailing list