Automatic using ::rtl::OUString etc.
Stephan Bergmann
sbergman at redhat.com
Tue Sep 18 01:38:27 PDT 2012
On 07/16/2012 04:03 PM, Lubos Lunak wrote:
> On Thursday 12 of April 2012, Lubos Lunak wrote:
>> would somebody see a problem with this?
>>
>> sal/inc/rtl/ustring.hxx :
>> +#ifdef RTL_AUTOMATIC_USING
>> +using ::rtl::OUString;
>> +using ::rtl::OStringToOUString;
>> +using ::rtl::OUStringToOString;
>> +#endif
>>
>> I seriously doubt there will ever be any O(U)String anywhere in LO build
>> that will not be the rtl one, so the need to explicitly qualify it with the
>> rtl namespace (or go with using, which is what many files do) seem to be
>> just an unnecessary hassle. So I'd like to do this change for those few
>> commonly used rtl types which are in practice namespaced by the name itself
>> (i.e. not the problematic rtl::Reference), and then build all of LO
>> with -DRTL_AUTOMATIC_USING.
>
> FYI, this is now in. The stable modules (sal/, salhelper/, cppu/,
> cppuhelper/) build without it and there's additionally a check including all
> their .hxx's to verify them. The rest of LO can now use OUString&friends
> without the explicit rtl.
It turns out that one drawback of this is with header files that are
careful to only declare the incomplete type via
namespace rtl { class OUString; }
(instead of including rtl/ustring.hxx) if that is all they need. They
would either need to continue using "rtl::OUString" (instead of just
"OUString"), or need to duplicate the using declaration (which could be
considered breaking of encapsulation), or include rtl/ustring.hxx instead.
Stephan
More information about the LibreOffice
mailing list