StylePoolImpl::createIterator function does not take 0 arguments

Tor Lillqvist tml at iki.fi
Fri Mar 30 07:54:20 UTC 2018


> OUString RectanglePointToOUString(const css::drawing::RectanglePoint& rp){
>     if(rp == css::drawing::RectanglePoint::LEFT_TOP)
>         return OUString::createFromAscii("LEFT_TOP");
> ...
>     SAL_WARN("sd","Unknown RectanglePoint Value");
>     return OUString::createFromAscii("");
> }
>
>
The existing practice is to use a switch statement, not a sequence of if
statements. Also, as css::drawing::RectanglePoint is a new-style so-called
scoped enum (enum class, not plain enum), you should introduce a stream
output operator<< directly, no need for a ToString function just for
SAL_INFO etc usage. If you have an operator<< for it, you can use values of
that css::drawing::RectanglePoint type directly in SAL_INFO etc.

See for instance include/sfx2/event.hxx, this:

template< typename charT, typename traits >

inline std::basic_ostream<charT, traits> & operator <<(

    std::basic_ostream<charT, traits> & stream, const SvMacroItemId& id )

{

    switch(id)

    {
...

That is my code, and my style, and it is I who (as far as I have noticed)
have been adding such debug output operators when I have had the need.
Nobody has opposed, so that is the existing style you should follow. If
somebody now opposes, they are free to introduce another style, *if* they
change there existing ones to be of that style, too. Just my opinion, of
course.

Note that instead of a SAL_WARN as you have, I output the undefined value
as a number. That is more useful.

--tml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20180330/983b79d4/attachment.html>


More information about the LibreOffice mailing list