On Sun, 2010-12-12 at 20:59 +0900, Takeshi Abe wrote:
Hi,
While trying Easy Hack 3.8 [1], I found obsolete use of String in
desktop/source/app/cmdlineargs.cxx .
This is good stuff, I didn't push this yet though. There's one little
easily-fixed snag I think, e.g.
- else if ( aArgStr.CompareToAscii( "-psn", 4 ) == COMPARE_EQUAL )
+ else if
( aArg.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("-psn")))
CompareToAscii is case sensitive, while equalsIgnoreAsciiCaseAsciiL is
case insensitive, so that would change the logic slightly. On the other
hand we don't seem to care about the case for the other command line
options so maybe that's a good thing.
However there's another catch.
OUString::equalsIgnoreAsciiCaseAsciiL takes the length as an
optimization, both entire strings have to match, so it's like strcmp.
While the old-school String::CompareToAscii only compare the String
against the argument up to the passed-in-length, like strncmp
So, that one should be (I think, I get a little confused when I mix my
strings, double check me) matchAsciiL to be exactly the same as before.
C.
p.s. I think we should have a wiki page to list the old String methods
and the new OUString equivalents side-by-side with snags listed. (Some
of the String methods are sort of OUStringBuffer equivalents, and some
are hard to do with OUStrings, and might have workarounds in
comphelper). Maybe you, or someone else, could start a page in the wiki
and just start with the methods used in this example
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.