Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


On 08/27/2015 07:34 PM, Giuseppe Castagno wrote:
I wonder if in INetURLObject I can put a single method  like this:

bool INetURLObject::IsWebDAV()
{
     return ( hasScheme( "http" ) ||
           hasScheme( "https" ) ||
           hasScheme( "vnd.sun.start.webdav" ) ||
           hasScheme( "vnd.sun.start.webdavs" ) );
}

to have this test in a single place? Currently I repeat it four times.

Sure, or maybe something more descriptive like isAnyWebDavScheme (so casual readers don't erroneously assume it only checks for vnd.sun.star.webdav). Also, for schemes known in INetProtocol, feel free to use the hasScheme(INetProtocol) overload, which should be slightly faster (which is likely negligible) and less prone to typos.

Finally, looking at the code in INetURLObject I noticed this comment:
http://opengrok.libreoffice.org/xref/core/tools/source/fsys/urlobj.cxx#114

and this chunk of code:
http://opengrok.libreoffice.org/xref/core/tools/source/fsys/urlobj.cxx#335

should vnd.sun.star.webdavs be added as well?

No, all that is only about those schemes that INetURLObject has intimate knowledge of. Traditionally, for any URL scheme to be "usable" in LO it needed to be added to INetURLObject, with scheme-specific parsing support and all (and that is how the rather random collection of schemes in INetProtocol came about over time). But that is largely unnecessary today.

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.