LCOV - code coverage report
Current view: top level - tools/inc/tools - urlobj.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 43 56 76.8 %
Date: 2012-08-25 Functions: 24 29 82.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 10 40.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : #ifndef _URLOBJ_HXX
      20                 :            : #define _URLOBJ_HXX
      21                 :            : 
      22                 :            : #include "tools/toolsdllapi.h"
      23                 :            : #include "com/sun/star/uno/Reference.hxx"
      24                 :            : #include "rtl/string.h"
      25                 :            : #include "rtl/ustrbuf.hxx"
      26                 :            : #include "rtl/textenc.h"
      27                 :            : #include "sal/types.h"
      28                 :            : 
      29                 :            : namespace com { namespace sun { namespace star { namespace util {
      30                 :            :     class XStringWidth;
      31                 :            : } } } }
      32                 :            : 
      33                 :            : // Special tokens:
      34                 :            : #define INET_PATH_TOKEN '/'
      35                 :            : #define INET_MARK_TOKEN '#'
      36                 :            : #define INET_HEX_ESCAPE '%'
      37                 :            : 
      38                 :            : // Common URL prefixes for various schemes:
      39                 :            : #define INET_FTP_SCHEME "ftp://"
      40                 :            : #define INET_HTTP_SCHEME "http://"
      41                 :            : #define INET_HTTPS_SCHEME "https://"
      42                 :            : #define INET_FILE_SCHEME "file://"
      43                 :            : #define INET_MAILTO_SCHEME "mailto:"
      44                 :            : #define INET_NEWS_SCHEME "news:"
      45                 :            : #define INET_HID_SCHEME "hid:"
      46                 :            : 
      47                 :            : #define URL_PREFIX_PRIV_SOFFICE "private:"
      48                 :            : enum
      49                 :            : {
      50                 :            :     URL_PREFIX_PRIV_SOFFICE_LEN
      51                 :            :         = RTL_CONSTASCII_LENGTH(URL_PREFIX_PRIV_SOFFICE)
      52                 :            : };
      53                 :            : 
      54                 :            : #define URL_PREFIX_PRIV_OBSOLETE URL_PREFIX_PRIV_SOFFICE
      55                 :            : enum
      56                 :            : {
      57                 :            :     URL_PREFIX_PRIV_OBSOLETE_LEN
      58                 :            :         = RTL_CONSTASCII_LENGTH(URL_PREFIX_PRIV_OBSOLETE)
      59                 :            : };
      60                 :            : 
      61                 :            : #define URL_PREFIX_PRIV_EXTERN "staroffice:"
      62                 :            : enum
      63                 :            : {
      64                 :            :     URL_PREFIX_PRIV_EXTERN_LEN = RTL_CONSTASCII_LENGTH(URL_PREFIX_PRIV_EXTERN)
      65                 :            : };
      66                 :            : 
      67                 :            : // Schemes:
      68                 :            : enum INetProtocol
      69                 :            : {
      70                 :            :     INET_PROT_NOT_VALID = 0,
      71                 :            :     INET_PROT_FTP = 1,
      72                 :            :     INET_PROT_HTTP = 2,
      73                 :            :     INET_PROT_FILE = 3,
      74                 :            :     INET_PROT_MAILTO = 4,
      75                 :            :     INET_PROT_VND_SUN_STAR_WEBDAV = 5,
      76                 :            :     INET_PROT_NEWS = 6,
      77                 :            :     INET_PROT_PRIV_SOFFICE = 7,
      78                 :            :     INET_PROT_PRIVATE = INET_PROT_PRIV_SOFFICE, // obsolete
      79                 :            :     INET_PROT_VND_SUN_STAR_HELP = 8,
      80                 :            :     INET_PROT_HTTPS = 9,
      81                 :            :     INET_PROT_SLOT = 10,
      82                 :            :     INET_PROT_MACRO = 11,
      83                 :            :     INET_PROT_JAVASCRIPT = 12,
      84                 :            :     INET_PROT_IMAP = 13,
      85                 :            :     INET_PROT_POP3 = 14,
      86                 :            :     INET_PROT_DATA = 15,
      87                 :            :     INET_PROT_CID = 16,
      88                 :            :     INET_PROT_OUT = 17,
      89                 :            :     INET_PROT_VND_SUN_STAR_HIER = 18,
      90                 :            :     INET_PROT_VIM = 19,
      91                 :            :     INET_PROT_UNO = 20,
      92                 :            :     INET_PROT_COMPONENT = 21,
      93                 :            :     INET_PROT_VND_SUN_STAR_PKG = 22,
      94                 :            :     INET_PROT_LDAP = 23,
      95                 :            :     INET_PROT_DB = 24,
      96                 :            :     INET_PROT_VND_SUN_STAR_CMD = 25,
      97                 :            :     INET_PROT_VND_SUN_STAR_ODMA = 26,
      98                 :            :     INET_PROT_TELNET = 27,
      99                 :            :     INET_PROT_VND_SUN_STAR_EXPAND = 28,
     100                 :            :     INET_PROT_VND_SUN_STAR_TDOC = 29,
     101                 :            :     INET_PROT_GENERIC = 30,
     102                 :            :     INET_PROT_SMB = 31,
     103                 :            :     INET_PROT_HID = 32,
     104                 :            :     INET_PROT_SFTP = 33,
     105                 :            :     INET_PROT_CMIS_ATOM = 34,
     106                 :            :     INET_PROT_END = 35
     107                 :            : };
     108                 :            : 
     109                 :       9556 : class TOOLS_DLLPUBLIC INetURLObject
     110                 :            : {
     111                 :            : public:
     112                 :            :     // Get- and Set-Methods:
     113                 :            : 
     114                 :            :     /** The way input strings that represent (parts of) URIs are interpreted
     115                 :            :         in set-methods.
     116                 :            : 
     117                 :            :         @descr  Most set-methods accept either a rtl::OString or a rtl::OUString
     118                 :            :         as input.  Using a rtl::OString, octets in the range 0x80--0xFF are
     119                 :            :         replaced by single escape sequences.  Using a rtl::OUString , UTF-32
     120                 :            :         characters in the range 0x80--0x10FFFF are replaced by sequences of
     121                 :            :         escape sequences, representing the UTF-8 coded characters.
     122                 :            : 
     123                 :            :         @descr  Along with an EncodeMechanism parameter, the set-methods all
     124                 :            :         take an rtl_TextEncoding parameter, which is ignored unless the
     125                 :            :         EncodeMechanism is WAS_ENCODED.
     126                 :            :      */
     127                 :            :     enum EncodeMechanism
     128                 :            :     {
     129                 :            :         /** All escape sequences that are already present are ignored, and are
     130                 :            :             interpreted as literal sequences of three characters.
     131                 :            :          */
     132                 :            :         ENCODE_ALL,
     133                 :            : 
     134                 :            :         /** Sequences of escape sequences, that represent characters from the
     135                 :            :             specified character set and that can be converted to UTF-32
     136                 :            :             characters, are first decoded.  If they have to be encoded, they
     137                 :            :             are converted to UTF-8 characters and are than translated into
     138                 :            :             (sequences of) escape sequences.  Other escape sequences are
     139                 :            :             copied verbatim (but using upper case hex digits).
     140                 :            :          */
     141                 :            :         WAS_ENCODED,
     142                 :            : 
     143                 :            :         /** All escape sequences that are already present are copied verbatim
     144                 :            :             (but using upper case hex digits).
     145                 :            :          */
     146                 :            :         NOT_CANONIC
     147                 :            :     };
     148                 :            : 
     149                 :            :     /** The way strings that represent (parts of) URIs are returned from get-
     150                 :            :         methods.
     151                 :            : 
     152                 :            :         @descr  Along with a DecodeMechanism parameter, the get-methods all
     153                 :            :         take an rtl_TextEncoding parameter, which is ignored unless the
     154                 :            :         DecodeMechanism is DECODE_WITH_CHARSET or DECODE_UNAMBIGUOUS.
     155                 :            :      */
     156                 :            :     enum DecodeMechanism
     157                 :            :     {
     158                 :            :         /** The (part of the) URI is returned unchanged.  Since URIs are
     159                 :            :             written using a subset of US-ASCII, the returned string is
     160                 :            :             guaranteed to contain only US-ASCII characters.
     161                 :            :          */
     162                 :            :         NO_DECODE,
     163                 :            : 
     164                 :            :         /** All sequences of escape sequences that represent UTF-8 coded
     165                 :            :             UTF-32 characters with a numerical value greater than 0x7F, are
     166                 :            :             replaced by the respective UTF-16 characters.  All other escape
     167                 :            :             sequences are not decoded.
     168                 :            :          */
     169                 :            :         DECODE_TO_IURI,
     170                 :            : 
     171                 :            :         /** All (sequences of) escape sequences that represent characters from
     172                 :            :             the specified character set, and that can be converted to UTF-32,
     173                 :            :             are replaced by the respective UTF-16 characters.  All other
     174                 :            :             escape sequences are not decoded.
     175                 :            :          */
     176                 :            :         DECODE_WITH_CHARSET,
     177                 :            : 
     178                 :            :         /** All (sequences of) escape sequences that represent characters from
     179                 :            :             the specified character set, that can be converted to UTF-32, and
     180                 :            :             that (in the case of ASCII characters) can safely be decoded
     181                 :            :             without altering the meaning of the (part of the) URI, are
     182                 :            :             replaced by the respective UTF-16 characters.  All other escape
     183                 :            :             sequences are not decoded.
     184                 :            :          */
     185                 :            :         DECODE_UNAMBIGUOUS
     186                 :            :     };
     187                 :            : 
     188                 :            :     // General Structure:
     189                 :            : 
     190                 :        174 :     inline INetURLObject():
     191                 :        174 :         m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP) {}
     192                 :            : 
     193                 :    1108291 :     inline bool HasError() const { return m_eScheme == INET_PROT_NOT_VALID; }
     194                 :            : 
     195                 :       4662 :     inline rtl::OUString GetMainURL(DecodeMechanism eMechanism,
     196                 :            :                                 rtl_TextEncoding eCharset
     197                 :            :                                     = RTL_TEXTENCODING_UTF8) const
     198                 :       4662 :     { return decode(m_aAbsURIRef, getEscapePrefix(), eMechanism, eCharset); }
     199                 :            : 
     200                 :            :     rtl::OUString GetURLNoPass(DecodeMechanism eMechanism = DECODE_TO_IURI,
     201                 :            :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     202                 :            :         const;
     203                 :            : 
     204                 :            :     rtl::OUString GetURLNoMark(DecodeMechanism eMechanism = DECODE_TO_IURI,
     205                 :            :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     206                 :            :         const;
     207                 :            : 
     208                 :            :     rtl::OUString
     209                 :            :     getAbbreviated(com::sun::star::uno::Reference<
     210                 :            :                            com::sun::star::util::XStringWidth > const &
     211                 :            :                        rStringWidth,
     212                 :            :                    sal_Int32 nWidth,
     213                 :            :                    DecodeMechanism eMechanism = DECODE_TO_IURI,
     214                 :            :                    rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     215                 :            :         const;
     216                 :            : 
     217                 :            :     bool operator ==(INetURLObject const & rObject) const;
     218                 :            : 
     219                 :            :     inline bool operator !=(INetURLObject const & rObject) const
     220                 :            :     { return !(*this == rObject); }
     221                 :            : 
     222                 :            :     bool operator <(INetURLObject const & rObject) const;
     223                 :            : 
     224                 :            :     inline bool operator >(INetURLObject const & rObject) const
     225                 :            :     { return rObject < *this; }
     226                 :            : 
     227                 :            :     // Strict Parsing:
     228                 :            : 
     229                 :            :     inline INetURLObject(const rtl::OString& rTheAbsURIRef,
     230                 :            :                          EncodeMechanism eMechanism = WAS_ENCODED,
     231                 :            :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     232                 :            : 
     233                 :            :     inline INetURLObject(rtl::OUString const & rTheAbsURIRef,
     234                 :            :                          EncodeMechanism eMechanism = WAS_ENCODED,
     235                 :            :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     236                 :            : 
     237                 :            :     inline bool SetURL(const rtl::OString& rTheAbsURIRef,
     238                 :            :                        EncodeMechanism eMechanism = WAS_ENCODED,
     239                 :            :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     240                 :            : 
     241                 :            :     inline bool SetURL(rtl::OUString const & rTheAbsURIRef,
     242                 :            :                        EncodeMechanism eMechanism = WAS_ENCODED,
     243                 :            :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     244                 :            : 
     245                 :            :     bool ConcatData(INetProtocol eTheScheme, rtl::OUString const & rTheUser,
     246                 :            :                     rtl::OUString const & rThePassword,
     247                 :            :                     rtl::OUString const & rTheHost, sal_uInt32 nThePort,
     248                 :            :                     rtl::OUString const & rThePath,
     249                 :            :                     EncodeMechanism eMechanism = WAS_ENCODED,
     250                 :            :                     rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     251                 :            : 
     252                 :            :     // Smart Parsing:
     253                 :            : 
     254                 :            :     /** The supported notations for file system paths.
     255                 :            :      */
     256                 :            :     enum FSysStyle
     257                 :            :     {
     258                 :            :         /** VOS notation (e.g., "//server/dir/file").
     259                 :            :          */
     260                 :            :         FSYS_VOS = 0x1,
     261                 :            : 
     262                 :            :         /** Unix notation (e.g., "/dir/file").
     263                 :            :          */
     264                 :            :         FSYS_UNX = 0x2,
     265                 :            : 
     266                 :            :         /** DOS notation (e.g., "a:\dir\file" and "\\server\dir\file").
     267                 :            :          */
     268                 :            :         FSYS_DOS = 0x4,
     269                 :            : 
     270                 :            :         /** Mac notation (e.g., "dir:file").
     271                 :            :          */
     272                 :            :         FSYS_MAC = 0x8,
     273                 :            : 
     274                 :            :         /** Detect the used notation.
     275                 :            : 
     276                 :            :             @descr  For the following descriptions, please note that
     277                 :            :             whereas FSYS_DEFAULT includes all style bits, combinations of only
     278                 :            :             a few style bits are also possible, and are also described.
     279                 :            : 
     280                 :            :             @descr  When used to translate a file system path to a file URL,
     281                 :            :             the subset of the following productions for which the appropriate
     282                 :            :             style bit is set are checked in order (using the conventions of
     283                 :            :             RFC 2234, RFC 2396, and RFC 2732; UCS4 stands for any UCS4
     284                 :            :             character):
     285                 :            : 
     286                 :            :              Production T1 (VOS local; FSYS_VOS only):
     287                 :            :                 "//." ["/" *UCS4]
     288                 :            :               becomes
     289                 :            :                 "file:///" *UCS4
     290                 :            : 
     291                 :            :              Production T2 (VOS host; FSYS_VOS only):
     292                 :            :                 "//" [host] ["/" *UCS4]
     293                 :            :               becomes
     294                 :            :                 "file://" host "/" *UCS4
     295                 :            : 
     296                 :            :              Production T3 (UNC; FSYS_DOS only):
     297                 :            :                 "\\" [host] ["\" *UCS4]
     298                 :            :               becomes
     299                 :            :                 "file://" host "/" *UCS4
     300                 :            :               replacing "\" by "/" within <*UCS4>
     301                 :            : 
     302                 :            :              Production T4 (Unix-like DOS; FSYS_DOS only):
     303                 :            :                 ALPHA ":" ["/" *UCS4]
     304                 :            :               becomes
     305                 :            :                 "file:///" ALPHA ":/" *UCS4
     306                 :            :               replacing "\" by "/" within <*UCS4>
     307                 :            : 
     308                 :            :              Production T5 (DOS; FSYS_DOS only):
     309                 :            :                 ALPHA ":" ["\" *UCS4]
     310                 :            :               becomes
     311                 :            :                 "file:///" ALPHA ":/" *UCS4
     312                 :            :               replacing "\" by "/" within <*UCS4>
     313                 :            : 
     314                 :            :              Production T6 (any):
     315                 :            :                 *UCS4
     316                 :            :               becomes
     317                 :            :                 "file:///" *UCS4
     318                 :            :               replacing the delimiter by "/" within <*UCS4>.  The delimiter is
     319                 :            :               that character from the set { "/", "\", ":" } which appears most
     320                 :            :               often in <*UCS4> (if FSYS_UNX is not among the style bits, "/"
     321                 :            :               is removed from the set; if FSYS_DOS is not among the style
     322                 :            :               bits, "\" is removed from the set; if FSYS_MAC is not among the
     323                 :            :               style bits, ":" is removed from the set).  If two or more
     324                 :            :               characters appear the same number of times, the character
     325                 :            :               mentioned first in that set is chosen.  If the first character
     326                 :            :               of <*UCS4> is the delimiter, that character is not copied.
     327                 :            : 
     328                 :            :             @descr  When used to translate a file URL to a file system path,
     329                 :            :             the following productions are checked in order (using the
     330                 :            :             conventions of RFC 2234, RFC 2396, and RFC 2732):
     331                 :            : 
     332                 :            :              Production F1 (VOS; FSYS_VOS):
     333                 :            :                 "file://" host "/" fpath ["#" fragment]
     334                 :            :               becomes
     335                 :            :                 "//" host "/" fpath
     336                 :            : 
     337                 :            :              Production F2 (DOS; FSYS_DOS):
     338                 :            :                 "file:///" ALPHA ":" ["/" fpath] ["#" fragment]
     339                 :            :               becomes
     340                 :            :                 ALPHA ":" ["\" fpath]
     341                 :            :               replacing "/" by "\" in <fpath>
     342                 :            : 
     343                 :            :              Production F3 (Unix; FSYS_UNX):
     344                 :            :                 "file:///" fpath ["#" fragment]
     345                 :            :               becomes
     346                 :            :                 "/" fpath
     347                 :            :          */
     348                 :            :         FSYS_DETECT = FSYS_VOS | FSYS_UNX | FSYS_DOS
     349                 :            :     };
     350                 :            : 
     351                 :            :     inline INetURLObject(rtl::OUString const & rTheAbsURIRef,
     352                 :            :                          INetProtocol eTheSmartScheme,
     353                 :            :                          EncodeMechanism eMechanism = WAS_ENCODED,
     354                 :            :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     355                 :            :                          FSysStyle eStyle = FSYS_DETECT);
     356                 :            : 
     357                 :            :     inline void SetSmartProtocol(INetProtocol eTheSmartScheme)
     358                 :            :     { m_eSmartScheme = eTheSmartScheme; }
     359                 :            : 
     360                 :            :     inline bool
     361                 :            :     SetSmartURL(const rtl::OString& rTheAbsURIRef,
     362                 :            :                 EncodeMechanism eMechanism = WAS_ENCODED,
     363                 :            :                 rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     364                 :            :                 FSysStyle eStyle = FSYS_DETECT);
     365                 :            : 
     366                 :            :     inline bool
     367                 :            :     SetSmartURL(rtl::OUString const & rTheAbsURIRef,
     368                 :            :                 EncodeMechanism eMechanism = WAS_ENCODED,
     369                 :            :                 rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     370                 :            :                 FSysStyle eStyle = FSYS_DETECT);
     371                 :            : 
     372                 :            :     inline INetURLObject
     373                 :            :     smartRel2Abs(const rtl::OString& rTheRelURIRef,
     374                 :            :                  bool & rWasAbsolute,
     375                 :            :                  bool bIgnoreFragment = false,
     376                 :            :                  EncodeMechanism eMechanism = WAS_ENCODED,
     377                 :            :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     378                 :            :                  bool bRelativeNonURIs = false,
     379                 :            :                  FSysStyle eStyle = FSYS_DETECT) const;
     380                 :            : 
     381                 :            :     inline INetURLObject
     382                 :            :     smartRel2Abs(rtl::OUString const & rTheRelURIRef,
     383                 :            :                  bool & rWasAbsolute,
     384                 :            :                  bool bIgnoreFragment = false,
     385                 :            :                  EncodeMechanism eMechanism = WAS_ENCODED,
     386                 :            :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     387                 :            :                  bool bRelativeNonURIs = false,
     388                 :            :                  FSysStyle eStyle = FSYS_DETECT) const;
     389                 :            : 
     390                 :            :     // Relative URLs:
     391                 :            : 
     392                 :            :     inline bool
     393                 :            :     GetNewAbsURL(const rtl::OString& rTheRelURIRef,
     394                 :            :                  INetURLObject * pTheAbsURIRef,
     395                 :            :                  EncodeMechanism eMechanism = WAS_ENCODED,
     396                 :            :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     397                 :            :                  FSysStyle eStyle = FSYS_DETECT, bool bIgnoreFragment = false)
     398                 :            :         const;
     399                 :            : 
     400                 :            :     inline bool
     401                 :            :     GetNewAbsURL(rtl::OUString const & rTheRelURIRef,
     402                 :            :                  INetURLObject * pTheAbsURIRef,
     403                 :            :                  EncodeMechanism eMechanism = WAS_ENCODED,
     404                 :            :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     405                 :            :                  FSysStyle eStyle = FSYS_DETECT, bool bIgnoreFragment = false)
     406                 :            :         const;
     407                 :            : 
     408                 :            :     /** @descr  If rTheRelURIRef cannot be converted to an absolute URL
     409                 :            :         (because of syntactic reasons), either rTheRelURIRef or an empty
     410                 :            :         string is returned:  If all of the parameters eEncodeMechanism,
     411                 :            :         eDecodeMechanism and eCharset have their respective default values,
     412                 :            :         then rTheRelURIRef is returned unmodified; otherwise, an empty string
     413                 :            :         is returned.
     414                 :            :      */
     415                 :            :     static rtl::OUString
     416                 :            :     GetAbsURL(rtl::OUString const & rTheBaseURIRef,
     417                 :            :               rtl::OUString const & rTheRelURIRef,
     418                 :            :               bool bIgnoreFragment = false,
     419                 :            :               EncodeMechanism eEncodeMechanism = WAS_ENCODED,
     420                 :            :               DecodeMechanism eDecodeMechanism = DECODE_TO_IURI,
     421                 :            :               rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     422                 :            :               FSysStyle eStyle = FSYS_DETECT);
     423                 :            : 
     424                 :            :     static inline rtl::OUString
     425                 :            :     GetRelURL(const rtl::OString& rTheBaseURIRef,
     426                 :            :               const rtl::OString& rTheAbsURIRef,
     427                 :            :               EncodeMechanism eEncodeMechanism = WAS_ENCODED,
     428                 :            :               DecodeMechanism eDecodeMechanism = DECODE_TO_IURI,
     429                 :            :               rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     430                 :            :               FSysStyle eStyle = FSYS_DETECT);
     431                 :            : 
     432                 :            :     static inline rtl::OUString
     433                 :            :     GetRelURL(rtl::OUString const & rTheBaseURIRef,
     434                 :            :               rtl::OUString const & rTheAbsURIRef,
     435                 :            :               EncodeMechanism eEncodeMechanism = WAS_ENCODED,
     436                 :            :               DecodeMechanism eDecodeMechanism = DECODE_TO_IURI,
     437                 :            :               rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
     438                 :            :               FSysStyle eStyle = FSYS_DETECT);
     439                 :            : 
     440                 :            :     // External URLs:
     441                 :            : 
     442                 :            :     rtl::OUString getExternalURL(DecodeMechanism eMechanism = DECODE_TO_IURI,
     443                 :            :                              rtl_TextEncoding eCharset
     444                 :            :                                  = RTL_TEXTENCODING_UTF8) const;
     445                 :            : 
     446                 :            :     static inline bool translateToExternal(const rtl::OString& rTheIntURIRef,
     447                 :            :                                            rtl::OUString & rTheExtURIRef,
     448                 :            :                                            DecodeMechanism eDecodeMechanism
     449                 :            :                                                = DECODE_TO_IURI,
     450                 :            :                                            rtl_TextEncoding eCharset
     451                 :            :                                                = RTL_TEXTENCODING_UTF8);
     452                 :            : 
     453                 :            :     static inline bool translateToExternal(rtl::OUString const & rTheIntURIRef,
     454                 :            :                                            rtl::OUString & rTheExtURIRef,
     455                 :            :                                            DecodeMechanism eDecodeMechanism
     456                 :            :                                                = DECODE_TO_IURI,
     457                 :            :                                            rtl_TextEncoding eCharset
     458                 :            :                                                = RTL_TEXTENCODING_UTF8);
     459                 :            : 
     460                 :            :     static inline bool translateToInternal(const rtl::OString& rTheExtURIRef,
     461                 :            :                                            rtl::OUString & rTheIntURIRef,
     462                 :            :                                            DecodeMechanism eDecodeMechanism
     463                 :            :                                                = DECODE_TO_IURI,
     464                 :            :                                            rtl_TextEncoding eCharset
     465                 :            :                                                = RTL_TEXTENCODING_UTF8);
     466                 :            : 
     467                 :            :     static inline bool translateToInternal(rtl::OUString const & rTheExtURIRef,
     468                 :            :                                            rtl::OUString & rTheIntURIRef,
     469                 :            :                                            DecodeMechanism eDecodeMechanism
     470                 :            :                                                = DECODE_TO_IURI,
     471                 :            :                                            rtl_TextEncoding eCharset
     472                 :            :                                                = RTL_TEXTENCODING_UTF8);
     473                 :            : 
     474                 :            :     // Scheme:
     475                 :            : 
     476                 :            :     struct SchemeInfo;
     477                 :            : 
     478                 :            :     inline INetProtocol GetProtocol() const { return m_eScheme; }
     479                 :            : 
     480                 :            :     /** Return the URL 'prefix' for a given scheme.
     481                 :            : 
     482                 :            :         @param eTheScheme  One of the supported URL schemes.
     483                 :            : 
     484                 :            :         @return  The 'prefix' of URLs of the given scheme.
     485                 :            :      */
     486                 :            :     static rtl::OUString GetScheme(INetProtocol eTheScheme);
     487                 :            : 
     488                 :            :     static inline INetProtocol CompareProtocolScheme(const rtl::OString&
     489                 :            :                                                          rTheAbsURIRef)
     490                 :            :     { return CompareProtocolScheme(extend(rTheAbsURIRef)); }
     491                 :            : 
     492                 :            :     static INetProtocol CompareProtocolScheme(rtl::OUString const &
     493                 :            :                                                   rTheAbsURIRef);
     494                 :            : 
     495                 :            :     // User Info:
     496                 :            : 
     497                 :            :     inline bool HasUserData() const { return m_aUser.isPresent(); }
     498                 :            : 
     499                 :            :     inline bool IsEmptyUser() const
     500                 :            :     { return m_aUser.isPresent() && m_aUser.isEmpty(); }
     501                 :            : 
     502                 :       3778 :     inline rtl::OUString GetUser(DecodeMechanism eMechanism = DECODE_TO_IURI,
     503                 :            :                              rtl_TextEncoding eCharset
     504                 :            :                                  = RTL_TEXTENCODING_UTF8) const
     505                 :       3778 :     { return decode(m_aUser, getEscapePrefix(), eMechanism, eCharset); }
     506                 :            : 
     507                 :       3778 :     inline rtl::OUString GetPass(DecodeMechanism eMechanism = DECODE_TO_IURI,
     508                 :            :                              rtl_TextEncoding eCharset
     509                 :            :                                  = RTL_TEXTENCODING_UTF8) const
     510                 :       3778 :     { return decode(m_aAuth, getEscapePrefix(), eMechanism, eCharset); }
     511                 :            : 
     512                 :            :     inline bool SetUser(const rtl::OString& rTheUser,
     513                 :            :                         EncodeMechanism eMechanism = WAS_ENCODED,
     514                 :            :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     515                 :            :     { return setUser(extend(rTheUser), true, eMechanism, eCharset); }
     516                 :            : 
     517                 :            :     inline bool SetUser(rtl::OUString const & rTheUser,
     518                 :            :                         EncodeMechanism eMechanism = WAS_ENCODED,
     519                 :            :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     520                 :            :     { return setUser(rTheUser, false, eMechanism, eCharset); }
     521                 :            : 
     522                 :            :     inline bool SetPass(const rtl::OString& rThePassword,
     523                 :            :                         EncodeMechanism eMechanism = WAS_ENCODED,
     524                 :            :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     525                 :            : 
     526                 :            :     inline bool SetPass(rtl::OUString const & rThePassword,
     527                 :            :                         EncodeMechanism eMechanism = WAS_ENCODED,
     528                 :            :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     529                 :            : 
     530                 :            :     inline bool SetUserAndPass(const rtl::OString& rTheUser,
     531                 :            :                                const rtl::OString& rThePassword,
     532                 :            :                                EncodeMechanism eMechanism = WAS_ENCODED,
     533                 :            :                                rtl_TextEncoding eCharset
     534                 :            :                                    = RTL_TEXTENCODING_UTF8);
     535                 :            : 
     536                 :            :     inline bool SetUserAndPass(rtl::OUString const & rTheUser,
     537                 :            :                                rtl::OUString const & rThePassword,
     538                 :            :                                EncodeMechanism eMechanism = WAS_ENCODED,
     539                 :            :                                rtl_TextEncoding eCharset
     540                 :            :                                    = RTL_TEXTENCODING_UTF8);
     541                 :            : 
     542                 :            :     // Host and Port:
     543                 :            : 
     544                 :            :     inline bool HasPort() const { return m_aPort.isPresent(); }
     545                 :            : 
     546                 :       3778 :     inline rtl::OUString GetHost(DecodeMechanism eMechanism = DECODE_TO_IURI,
     547                 :            :                              rtl_TextEncoding eCharset
     548                 :            :                                  = RTL_TEXTENCODING_UTF8) const
     549                 :       3778 :     { return decode(m_aHost, getEscapePrefix(), eMechanism, eCharset); }
     550                 :            : 
     551                 :            :     rtl::OUString GetHostPort(DecodeMechanism eMechanism = DECODE_TO_IURI,
     552                 :            :                           rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     553                 :            : 
     554                 :            :     sal_uInt32 GetPort() const;
     555                 :            : 
     556                 :            :     inline bool SetHost(const rtl::OString& rTheHost,
     557                 :            :                         EncodeMechanism eMechanism = WAS_ENCODED,
     558                 :            :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     559                 :            :     { return setHost(extend(rTheHost), true, eMechanism, eCharset); }
     560                 :            : 
     561                 :            :     inline bool SetHost(rtl::OUString const & rTheHost,
     562                 :            :                         EncodeMechanism eMechanism = WAS_ENCODED,
     563                 :            :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     564                 :            :     { return setHost(rTheHost, false, eMechanism, eCharset); }
     565                 :            : 
     566                 :            :     bool SetPort(sal_uInt32 nThePort);
     567                 :            : 
     568                 :            :     // Path:
     569                 :            : 
     570                 :            :     inline bool HasURLPath() const { return !m_aPath.isEmpty(); }
     571                 :            : 
     572                 :       3778 :     inline rtl::OUString GetURLPath(DecodeMechanism eMechanism = DECODE_TO_IURI,
     573                 :            :                                 rtl_TextEncoding eCharset
     574                 :            :                                     = RTL_TEXTENCODING_UTF8) const
     575                 :       3778 :     { return decode(m_aPath, getEscapePrefix(), eMechanism, eCharset); }
     576                 :            : 
     577                 :            :     inline bool SetURLPath(const rtl::OString& rThePath,
     578                 :            :                            EncodeMechanism eMechanism = WAS_ENCODED,
     579                 :            :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     580                 :            :     { return setPath(extend(rThePath), true, eMechanism, eCharset); }
     581                 :            : 
     582                 :            :     inline bool SetURLPath(rtl::OUString const & rThePath,
     583                 :            :                            EncodeMechanism eMechanism = WAS_ENCODED,
     584                 :            :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     585                 :            :     { return setPath(rThePath, false, eMechanism, eCharset); }
     586                 :            : 
     587                 :            :     // Hierarchical Path:
     588                 :            : 
     589                 :            :     /** A constant to address the last segment in various methods dealing with
     590                 :            :         hierarchical paths.
     591                 :            : 
     592                 :            :         @descr  It is often more efficient to address the last segment using
     593                 :            :         this constant, than to determine its ordinal value using
     594                 :            :         getSegmentCount().
     595                 :            :      */
     596                 :            :     enum { LAST_SEGMENT = -1 };
     597                 :            : 
     598                 :            :     /** The number of segments in the hierarchical path.
     599                 :            : 
     600                 :            :         @descr  Using RFC 2396 and RFC 2234, a hierarchical path is of the
     601                 :            :         form
     602                 :            : 
     603                 :            :           hierarchical-path = 1*("/" segment)
     604                 :            : 
     605                 :            :           segment = name *(";" param)
     606                 :            : 
     607                 :            :           name = [base ["." extension]]
     608                 :            : 
     609                 :            :           base = 1*pchar
     610                 :            : 
     611                 :            :           extension = *<any pchar except ".">
     612                 :            : 
     613                 :            :           param = *pchar
     614                 :            : 
     615                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     616                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     617                 :            : 
     618                 :            :         @return  The number of segments in the hierarchical path.  If the path
     619                 :            :         is not hierarchical, 0 is returned.
     620                 :            :      */
     621                 :            :     sal_Int32 getSegmentCount(bool bIgnoreFinalSlash = true) const;
     622                 :            : 
     623                 :            :     /** Remove a segment from the hierarchical path.
     624                 :            : 
     625                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     626                 :            :         if addressing the last segment.
     627                 :            : 
     628                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     629                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     630                 :            : 
     631                 :            :         @return  True if the segment has successfully been removed (and the
     632                 :            :         resulting URI is still valid).  If the path is not hierarchical, or
     633                 :            :         the specified segment does not exist, false is returned.  If false is
     634                 :            :         returned, the object is not modified.
     635                 :            :      */
     636                 :            :     bool removeSegment(sal_Int32 nIndex = LAST_SEGMENT,
     637                 :            :                        bool bIgnoreFinalSlash = true);
     638                 :            : 
     639                 :            :     /** Insert a new segment into the hierarchical path.
     640                 :            : 
     641                 :            :         @param rTheName  The name part of the new segment.  The new segment
     642                 :            :         will contain no parameters.
     643                 :            : 
     644                 :            :         @param bAppendFinalSlash  If the new segment is appended at the end of
     645                 :            :         the hierarchical path, this parameter specifies whether to add a final
     646                 :            :         slash after it or not.
     647                 :            : 
     648                 :            :         @param nIndex  The non-negative index of the segment before which
     649                 :            :         to insert the new segment.  LAST_SEGMENT or an nIndex that equals
     650                 :            :         getSegmentCount() inserts the new segment at the end of the
     651                 :            :         hierarchical path.
     652                 :            : 
     653                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     654                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     655                 :            : 
     656                 :            :         @param eMechanism  See the general discussion for set-methods.
     657                 :            : 
     658                 :            :         @param eCharset  See the general discussion for set-methods.
     659                 :            : 
     660                 :            :         @return  True if the segment has successfully been inserted (and the
     661                 :            :         resulting URI is still valid).  If the path is not hierarchical, or
     662                 :            :         the specified place to insert the new segment does not exist, false is
     663                 :            :         returned.  If false is returned, the object is not modified.
     664                 :            :      */
     665                 :            :     inline bool insertName(rtl::OUString const & rTheName,
     666                 :            :                            bool bAppendFinalSlash = false,
     667                 :            :                            sal_Int32 nIndex = LAST_SEGMENT,
     668                 :            :                            bool bIgnoreFinalSlash = true,
     669                 :            :                            EncodeMechanism eMechanism = WAS_ENCODED,
     670                 :            :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     671                 :            : 
     672                 :            :     /** Get the name of a segment of the hierarchical path.
     673                 :            : 
     674                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     675                 :            :         if addressing the last segment.
     676                 :            : 
     677                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     678                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     679                 :            : 
     680                 :            :         @param eMechanism  See the general discussion for get-methods.
     681                 :            : 
     682                 :            :         @param eCharset  See the general discussion for get-methods.
     683                 :            : 
     684                 :            :         @return  The name part of the specified segment.  If the path is not
     685                 :            :         hierarchical, or the specified segment does not exits, an empty string
     686                 :            :         is returned.
     687                 :            :      */
     688                 :            :     rtl::OUString getName(sal_Int32 nIndex = LAST_SEGMENT,
     689                 :            :                       bool bIgnoreFinalSlash = true,
     690                 :            :                       DecodeMechanism eMechanism = DECODE_TO_IURI,
     691                 :            :                       rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     692                 :            :         const;
     693                 :            : 
     694                 :            :     /** Set the name of a segment (preserving any parameters and any query or
     695                 :            :         fragment part).
     696                 :            : 
     697                 :            :         @param rTheName  The new name.
     698                 :            : 
     699                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     700                 :            :         if addressing the last segment.
     701                 :            : 
     702                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     703                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     704                 :            : 
     705                 :            :         @param eMechanism  See the general discussion for set-methods.
     706                 :            : 
     707                 :            :         @param eCharset  See the general discussion for set-methods.
     708                 :            : 
     709                 :            :         @return  True if the name has successfully been modified (and the
     710                 :            :         resulting URI is still valid).  If the path is not hierarchical, or
     711                 :            :         the specified segment does not exist, false is returned.  If false is
     712                 :            :         returned, the object is not modified.
     713                 :            :      */
     714                 :            :     bool setName(rtl::OUString const & rTheName,
     715                 :            :                  sal_Int32 nIndex = LAST_SEGMENT,
     716                 :            :                  bool bIgnoreFinalSlash = true,
     717                 :            :                  EncodeMechanism eMechanism = WAS_ENCODED,
     718                 :            :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     719                 :            : 
     720                 :            :     /** Get the base of the name of a segment.
     721                 :            : 
     722                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     723                 :            :         if addressing the last segment.
     724                 :            : 
     725                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     726                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     727                 :            : 
     728                 :            :         @param eMechanism  See the general discussion for get-methods.
     729                 :            : 
     730                 :            :         @param eCharset  See the general discussion for get-methods.
     731                 :            : 
     732                 :            :         @return  The base part of the specified segment.  If the path is
     733                 :            :         not hierarchical, or the specified segment does not exits, an empty
     734                 :            :         string is returned.
     735                 :            :      */
     736                 :            :     rtl::OUString getBase(sal_Int32 nIndex = LAST_SEGMENT,
     737                 :            :                       bool bIgnoreFinalSlash = true,
     738                 :            :                       DecodeMechanism eMechanism = DECODE_TO_IURI,
     739                 :            :                       rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     740                 :            :         const;
     741                 :            : 
     742                 :            :     /** Set the base of the name of a segment (preserving the extension).
     743                 :            : 
     744                 :            :         @param rTheBase  The new base.
     745                 :            : 
     746                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     747                 :            :         if addressing the last segment.
     748                 :            : 
     749                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     750                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     751                 :            : 
     752                 :            :         @param eMechanism  See the general discussion for set-methods.
     753                 :            : 
     754                 :            :         @param eCharset  See the general discussion for set-methods.
     755                 :            : 
     756                 :            :         @return  True if the base has successfully been modified (and the
     757                 :            :         resulting URI is still valid).  If the path is not hierarchical, or
     758                 :            :         the specified segment does not exist, false is returned.  If false is
     759                 :            :         returned, the object is not modified.
     760                 :            :      */
     761                 :            :     bool setBase(rtl::OUString const & rTheBase,
     762                 :            :                  sal_Int32 nIndex = LAST_SEGMENT,
     763                 :            :                  bool bIgnoreFinalSlash = true,
     764                 :            :                  EncodeMechanism eMechanism = WAS_ENCODED,
     765                 :            :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     766                 :            : 
     767                 :            :     /** Determine whether the name of a segment has an extension.
     768                 :            : 
     769                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     770                 :            :         if addressing the last segment.
     771                 :            : 
     772                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     773                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     774                 :            : 
     775                 :            :         @return  True if the name of the specified segment has an extension.
     776                 :            :         If the path is not hierarchical, or the specified segment does not
     777                 :            :         exist, false is returned.
     778                 :            :      */
     779                 :            :     bool hasExtension(sal_Int32 nIndex = LAST_SEGMENT,
     780                 :            :                       bool bIgnoreFinalSlash = true) const;
     781                 :            : 
     782                 :            :     /** Get the extension of the name of a segment.
     783                 :            : 
     784                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     785                 :            :         if addressing the last segment.
     786                 :            : 
     787                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     788                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     789                 :            : 
     790                 :            :         @param eMechanism  See the general discussion for get-methods.
     791                 :            : 
     792                 :            :         @param eCharset  See the general discussion for get-methods.
     793                 :            : 
     794                 :            :         @return  The extension part of the specified segment.  If the path is
     795                 :            :         not hierarchical, or the specified segment does not exits, an empty
     796                 :            :         string is returned.
     797                 :            :      */
     798                 :            :     rtl::OUString getExtension(sal_Int32 nIndex = LAST_SEGMENT,
     799                 :            :                            bool bIgnoreFinalSlash = true,
     800                 :            :                            DecodeMechanism eMechanism = DECODE_TO_IURI,
     801                 :            :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     802                 :            :         const;
     803                 :            : 
     804                 :            :     /** Set the extension of the name of a segment (replacing an already
     805                 :            :         existing extension).
     806                 :            : 
     807                 :            :         @param rTheExtension  The new extension.
     808                 :            : 
     809                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     810                 :            :         if addressing the last segment.
     811                 :            : 
     812                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     813                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     814                 :            : 
     815                 :            :         @param eMechanism  See the general discussion for set-methods.
     816                 :            : 
     817                 :            :         @param eCharset  See the general discussion for set-methods.
     818                 :            : 
     819                 :            :         @return  True if the extension has successfully been modified (and the
     820                 :            :         resulting URI is still valid).  If the path is not hierarchical, or
     821                 :            :         the specified segment does not exist, false is returned.  If false is
     822                 :            :         returned, the object is not modified.
     823                 :            :      */
     824                 :            :     bool setExtension(rtl::OUString const & rTheExtension,
     825                 :            :                       sal_Int32 nIndex = LAST_SEGMENT,
     826                 :            :                       bool bIgnoreFinalSlash = true,
     827                 :            :                       EncodeMechanism eMechanism = WAS_ENCODED,
     828                 :            :                       rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     829                 :            : 
     830                 :            :     /** Remove the extension of the name of a segment.
     831                 :            : 
     832                 :            :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     833                 :            :         if addressing the last segment.
     834                 :            : 
     835                 :            :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     836                 :            :         hierarchical path does not denote an empty segment, but is ignored.
     837                 :            : 
     838                 :            :         @return  True if the extension has successfully been removed (and the
     839                 :            :         resulting URI is still valid), or if the name did not have an
     840                 :            :         extension.  If the path is not hierarchical, or the specified segment
     841                 :            :         does not exist, false is returned.  If false is returned, the object
     842                 :            :         is not modified.
     843                 :            :      */
     844                 :            :     bool removeExtension(sal_Int32 nIndex = LAST_SEGMENT,
     845                 :            :                          bool bIgnoreFinalSlash = true);
     846                 :            : 
     847                 :            :     /** Determine whether the hierarchical path ends in a final slash.
     848                 :            : 
     849                 :            :         @return  True if the hierarchical path ends in a final slash.  If the
     850                 :            :         path is not hierarchical, false is returned.
     851                 :            :      */
     852                 :            :     bool hasFinalSlash() const;
     853                 :            : 
     854                 :            :     /** Make the hierarchical path end in a final slash (if it does not
     855                 :            :         already do so).
     856                 :            : 
     857                 :            :         @return  True if a final slash has successfully been appended (and the
     858                 :            :         resulting URI is still valid), or if the hierarchical path already
     859                 :            :         ended in a final slash.  If the path is not hierarchical, false is
     860                 :            :         returned.  If false is returned, the object is not modified.
     861                 :            :      */
     862                 :            :     bool setFinalSlash();
     863                 :            : 
     864                 :            :     /** Remove a final slash from the hierarchical path.
     865                 :            : 
     866                 :            :         @return  True if a final slash has successfully been removed (and the
     867                 :            :         resulting URI is still valid), or if the hierarchical path already did
     868                 :            :         not end in a final slash.  If the path is not hierarchical, false is
     869                 :            :         returned.  If false is returned, the object is not modified.
     870                 :            :      */
     871                 :            :     bool removeFinalSlash();
     872                 :            : 
     873                 :            :     // Query:
     874                 :            : 
     875                 :       3778 :     inline bool HasParam() const { return m_aQuery.isPresent(); }
     876                 :            : 
     877                 :       3778 :     inline rtl::OUString GetParam(DecodeMechanism eMechanism = DECODE_TO_IURI,
     878                 :            :                               rtl_TextEncoding eCharset
     879                 :            :                                   = RTL_TEXTENCODING_UTF8) const
     880                 :       3778 :     { return decode(m_aQuery, getEscapePrefix(), eMechanism, eCharset); }
     881                 :            : 
     882                 :            :     inline bool SetParam(const rtl::OString& rTheQuery,
     883                 :            :                          EncodeMechanism eMechanism = WAS_ENCODED,
     884                 :            :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     885                 :            : 
     886                 :            :     inline bool SetParam(rtl::OUString const & rTheQuery,
     887                 :            :                          EncodeMechanism eMechanism = WAS_ENCODED,
     888                 :            :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     889                 :            : 
     890                 :            :     // Fragment:
     891                 :            : 
     892                 :            :     inline bool HasMark() const { return m_aFragment.isPresent(); }
     893                 :            : 
     894                 :            :     inline rtl::OUString GetMark(DecodeMechanism eMechanism = DECODE_TO_IURI,
     895                 :            :                              rtl_TextEncoding eCharset
     896                 :            :                                  = RTL_TEXTENCODING_UTF8) const
     897                 :            :     { return decode(m_aFragment, getEscapePrefix(), eMechanism, eCharset); }
     898                 :            : 
     899                 :            :     inline bool SetMark(const rtl::OString& rTheFragment,
     900                 :            :                         EncodeMechanism eMechanism = WAS_ENCODED,
     901                 :            :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     902                 :            : 
     903                 :            :     inline bool SetMark(rtl::OUString const & rTheFragment,
     904                 :            :                         EncodeMechanism eMechanism = WAS_ENCODED,
     905                 :            :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     906                 :            : 
     907                 :            :     // File URLs:
     908                 :            : 
     909                 :            :     /** Create an INetURLObject from a file system path.
     910                 :            : 
     911                 :            :         @param rFSysPath  A file system path.  An URL is not allowed here!
     912                 :            : 
     913                 :            :         @param eStyle  The notation of rFSysPath.
     914                 :            :      */
     915                 :            :     inline INetURLObject(rtl::OUString const & rFSysPath, FSysStyle eStyle);
     916                 :            : 
     917                 :            :     /** Set this INetURLObject to a file URL constructed from a file system
     918                 :            :         path.
     919                 :            : 
     920                 :            :         @param rFSysPath  A file system path.  An URL is not allowed here!
     921                 :            : 
     922                 :            :         @param eStyle  The notation of rFSysPath.
     923                 :            : 
     924                 :            :         @return  True if this INetURLObject has successfully been changed.  If
     925                 :            :         false is returned, this INetURLObject has not been modified.
     926                 :            :      */
     927                 :            :     bool setFSysPath(rtl::OUString const & rFSysPath, FSysStyle eStyle);
     928                 :            : 
     929                 :            :     /** Return the file system path represented by a file URL (ignoring any
     930                 :            :         fragment part).
     931                 :            : 
     932                 :            :         @param eStyle  The notation of the returned file system path.
     933                 :            : 
     934                 :            :         @param pDelimiter  Upon successful return, this parameter can return
     935                 :            :         the character that is the 'main' delimiter within the returned file
     936                 :            :         system path (e.g., "/" for Unix, "\" for DOS, ":" for Mac).  This is
     937                 :            :         especially useful for routines that later try to shorten the returned
     938                 :            :         file system path at a 'good' position, e.g. to fit it into some
     939                 :            :         limited display space.
     940                 :            : 
     941                 :            :         @return  The file system path represented by this file URL.  If this
     942                 :            :         file URL does not represent a file system path according to the
     943                 :            :         specified notation, or if this is not a file URL at all, an empty
     944                 :            :         string is returned.
     945                 :            :      */
     946                 :            :     rtl::OUString getFSysPath(FSysStyle eStyle, sal_Unicode * pDelimiter = 0)
     947                 :            :         const;
     948                 :            : 
     949                 :            :     // POP3 and URLs:
     950                 :            : 
     951                 :            :     rtl::OUString GetMsgId(DecodeMechanism eMechanism = DECODE_TO_IURI,
     952                 :            :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     953                 :            :         const;
     954                 :            : 
     955                 :            :     // Coding:
     956                 :            : 
     957                 :            :     enum Part
     958                 :            :     {
     959                 :            :         PART_OBSOLETE_NORMAL = 0x001, // Obsolete, do not use!
     960                 :            :         PART_OBSOLETE_FILE = 0x002, // Obsolete, do not use!
     961                 :            :         PART_OBSOLETE_PARAM = 0x004, // Obsolete, do not use!
     962                 :            :         PART_USER_PASSWORD = 0x008,
     963                 :            :         PART_IMAP_ACHAR = 0x010,
     964                 :            :         PART_VIM = 0x020,
     965                 :            :         PART_HOST_EXTRA = 0x040,
     966                 :            :         PART_FPATH = 0x080,
     967                 :            :         PART_AUTHORITY = 0x100,
     968                 :            :         PART_PATH_SEGMENTS_EXTRA = 0x200,
     969                 :            :         PART_REL_SEGMENT_EXTRA = 0x400,
     970                 :            :         PART_URIC = 0x800,
     971                 :            :         PART_HTTP_PATH = 0x1000,
     972                 :            :         PART_FILE_SEGMENT_EXTRA = 0x2000, // Obsolete, do not use!
     973                 :            :         PART_MESSAGE_ID = 0x4000,
     974                 :            :         PART_MESSAGE_ID_PATH = 0x8000,
     975                 :            :         PART_MAILTO = 0x10000,
     976                 :            :         PART_PATH_BEFORE_QUERY = 0x20000,
     977                 :            :         PART_PCHAR = 0x40000,
     978                 :            :         PART_FRAGMENT = 0x80000, // Obsolete, do not use!
     979                 :            :         PART_VISIBLE = 0x100000,
     980                 :            :         PART_VISIBLE_NONSPECIAL = 0x200000,
     981                 :            :         PART_CREATEFRAGMENT = 0x400000,
     982                 :            :         PART_UNO_PARAM_VALUE = 0x800000,
     983                 :            :         PART_UNAMBIGUOUS = 0x1000000,
     984                 :            :         PART_URIC_NO_SLASH = 0x2000000,
     985                 :            :         PART_HTTP_QUERY = 0x4000000, //TODO! unused?
     986                 :            :         PART_NEWS_ARTICLE_LOCALPART = 0x8000000,
     987                 :            :         max_part = 0x80000000
     988                 :            :             // Do not use!  Only there to allow compatible changes in the
     989                 :            :             // future.
     990                 :            :     };
     991                 :            : 
     992                 :            :     enum EscapeType
     993                 :            :     {
     994                 :            :         ESCAPE_NO,
     995                 :            :         ESCAPE_OCTET,
     996                 :            :         ESCAPE_UTF32
     997                 :            :     };
     998                 :            : 
     999                 :            :     /** Encode some text as part of a URI.
    1000                 :            : 
    1001                 :            :         @param rText  Some text (for its interpretation, see the general
    1002                 :            :         discussion for set-methods).
    1003                 :            : 
    1004                 :            :         @param ePart  The part says which characters are 'forbidden' and must
    1005                 :            :         be encoded (replaced by escape sequences).  Characters outside the US-
    1006                 :            :         ASCII range are always 'forbidden.'
    1007                 :            : 
    1008                 :            :         @param cEscapePrefix  The first character in an escape sequence
    1009                 :            :         (normally '%').
    1010                 :            : 
    1011                 :            :         @param eMechanism  See the general discussion for set-methods.
    1012                 :            : 
    1013                 :            :         @param eCharset  See the general discussion for set-methods.
    1014                 :            : 
    1015                 :            :         @return  The encoded representation of the text ('forbidden'
    1016                 :            :         characters replaced by escape sequences).
    1017                 :            :      */
    1018                 :            :     static inline rtl::OUString encode(const rtl::OString& rText, Part ePart,
    1019                 :            :                                    sal_Char cEscapePrefix,
    1020                 :            :                                    EncodeMechanism eMechanism,
    1021                 :            :                                    rtl_TextEncoding eCharset
    1022                 :            :                                        = RTL_TEXTENCODING_UTF8);
    1023                 :            : 
    1024                 :            :     /** Encode some text as part of a URI.
    1025                 :            : 
    1026                 :            :         @param rText  Some text (for its interpretation, see the general
    1027                 :            :         discussion for set-methods).
    1028                 :            : 
    1029                 :            :         @param ePart  The part says which characters are 'forbidden' and must
    1030                 :            :         be encoded (replaced by escape sequences).  Characters outside the US-
    1031                 :            :         ASCII range are always 'forbidden.'
    1032                 :            : 
    1033                 :            :         @param cEscapePrefix  The first character in an escape sequence
    1034                 :            :         (normally '%').
    1035                 :            : 
    1036                 :            :         @param eMechanism  See the general discussion for set-methods.
    1037                 :            : 
    1038                 :            :         @param eCharset  See the general discussion for set-methods.
    1039                 :            : 
    1040                 :            :         @return  The text, encoded according to the given mechanism and
    1041                 :            :         charset ('forbidden' characters replaced by escape sequences).
    1042                 :            :      */
    1043                 :            :     static inline rtl::OUString encode(rtl::OUString const & rText, Part ePart,
    1044                 :            :                                    sal_Char cEscapePrefix,
    1045                 :            :                                    EncodeMechanism eMechanism,
    1046                 :            :                                    rtl_TextEncoding eCharset
    1047                 :            :                                        = RTL_TEXTENCODING_UTF8);
    1048                 :            : 
    1049                 :            :     /** Decode some text.
    1050                 :            : 
    1051                 :            :         @param rText  Some (encoded) text.
    1052                 :            : 
    1053                 :            :         @param cEscapePrefix  The first character in an escape sequence
    1054                 :            :         (normally '%').
    1055                 :            : 
    1056                 :            :         @param eMechanism  See the general discussion for get-methods.
    1057                 :            : 
    1058                 :            :         @param eCharset  See the general discussion for get-methods.
    1059                 :            : 
    1060                 :            :         @return  The text, decoded according to the given mechanism and
    1061                 :            :         charset (escape sequences replaced by 'raw' characters).
    1062                 :            :      */
    1063                 :            :     static inline rtl::OUString decode(rtl::OUString const & rText,
    1064                 :            :                                    sal_Char cEscapePrefix,
    1065                 :            :                                    DecodeMechanism eMechanism,
    1066                 :            :                                    rtl_TextEncoding eCharset
    1067                 :            :                                        = RTL_TEXTENCODING_UTF8);
    1068                 :            : 
    1069                 :            :     static inline rtl::OUString decode(rtl::OUStringBuffer const & rText,
    1070                 :            :                                    sal_Char cEscapePrefix,
    1071                 :            :                                    DecodeMechanism eMechanism,
    1072                 :            :                                    rtl_TextEncoding eCharset
    1073                 :            :                                        = RTL_TEXTENCODING_UTF8);
    1074                 :            : 
    1075                 :            :     static void appendUCS4Escape(rtl::OUStringBuffer & rTheText,
    1076                 :            :                                  sal_Char cEscapePrefix,
    1077                 :            :                                  sal_uInt32 nUCS4);
    1078                 :            : 
    1079                 :            :     static void appendUCS4(rtl::OUStringBuffer & rTheText, sal_uInt32 nUCS4,
    1080                 :            :                            EscapeType eEscapeType, bool bOctets, Part ePart,
    1081                 :            :                            sal_Char cEscapePrefix, rtl_TextEncoding eCharset,
    1082                 :            :                            bool bKeepVisibleEscapes);
    1083                 :            : 
    1084                 :            :     static sal_uInt32 getUTF32(sal_Unicode const *& rBegin,
    1085                 :            :                                sal_Unicode const * pEnd, bool bOctets,
    1086                 :            :                                sal_Char cEscapePrefix,
    1087                 :            :                                EncodeMechanism eMechanism,
    1088                 :            :                                rtl_TextEncoding eCharset,
    1089                 :            :                                EscapeType & rEscapeType);
    1090                 :            : 
    1091                 :            :     // Specialized helpers:
    1092                 :            : 
    1093                 :            :     static sal_uInt32 scanDomain(sal_Unicode const *& rBegin,
    1094                 :            :                                  sal_Unicode const * pEnd,
    1095                 :            :                                  bool bEager = true);
    1096                 :            : 
    1097                 :            :     // OBSOLETE Hierarchical Path:
    1098                 :            : 
    1099                 :            :     rtl::OUString GetPartBeforeLastName(DecodeMechanism eMechanism
    1100                 :            :                                         = DECODE_TO_IURI,
    1101                 :            :                                     rtl_TextEncoding eCharset
    1102                 :            :                                         = RTL_TEXTENCODING_UTF8) const;
    1103                 :            : 
    1104                 :            :     /** Get the last segment in the path.
    1105                 :            : 
    1106                 :            :         @param eMechanism  See the general discussion for get-methods.
    1107                 :            : 
    1108                 :            :         @param eCharset  See the general discussion for get-methods.
    1109                 :            : 
    1110                 :            :         @return  For a hierarchical URL, the last segment (everything after
    1111                 :            :         the last unencoded '/').  Not that this last segment may be empty.  If
    1112                 :            :         the URL is not hierarchical, an empty string is returned.
    1113                 :            :      */
    1114                 :            :     rtl::OUString GetLastName(DecodeMechanism eMechanism = DECODE_TO_IURI,
    1115                 :            :                           rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
    1116                 :            :         const;
    1117                 :            : 
    1118                 :            :     /** Get the 'extension' of the last segment in the path.
    1119                 :            : 
    1120                 :            :         @param eMechanism  See the general discussion for get-methods.
    1121                 :            : 
    1122                 :            :         @param eCharset  See the general discussion for get-methods.
    1123                 :            : 
    1124                 :            :         @return  For a hierarchical URL, everything after the first unencoded
    1125                 :            :         '.' in the last segment of the path.  Note that this 'extension' may
    1126                 :            :         be empty.  If the URL is not hierarchical, or if the last segment does
    1127                 :            :         not contain an unencoded '.', an empty string is returned.
    1128                 :            :      */
    1129                 :            :     rtl::OUString GetFileExtension(DecodeMechanism eMechanism = DECODE_TO_IURI,
    1130                 :            :                                rtl_TextEncoding eCharset
    1131                 :            :                                    = RTL_TEXTENCODING_UTF8) const;
    1132                 :            : 
    1133                 :            :     inline bool Append(const rtl::OString& rTheSegment,
    1134                 :            :                        EncodeMechanism eMechanism = WAS_ENCODED,
    1135                 :            :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
    1136                 :            :     { return appendSegment(extend(rTheSegment), true, eMechanism, eCharset); }
    1137                 :            : 
    1138                 :            :     inline bool Append(rtl::OUString const & rTheSegment,
    1139                 :            :                        EncodeMechanism eMechanism = WAS_ENCODED,
    1140                 :            :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
    1141                 :            :     { return appendSegment(rTheSegment, false, eMechanism, eCharset); }
    1142                 :            : 
    1143                 :            :     bool CutLastName();
    1144                 :            : 
    1145                 :            :     // OBSOLETE File URLs:
    1146                 :            : 
    1147                 :            :     rtl::OUString PathToFileName() const;
    1148                 :            : 
    1149                 :            :     rtl::OUString GetFull() const;
    1150                 :            : 
    1151                 :            :     rtl::OUString GetPath() const;
    1152                 :            : 
    1153                 :            :     void SetBase(rtl::OUString const & rTheBase);
    1154                 :            : 
    1155                 :            :     rtl::OUString GetBase() const;
    1156                 :            : 
    1157                 :            :     void SetName(rtl::OUString const & rTheName,
    1158                 :            :                  EncodeMechanism eMechanism = WAS_ENCODED,
    1159                 :            :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
    1160                 :            : 
    1161                 :            :     inline rtl::OUString GetName(DecodeMechanism eMechanism = DECODE_TO_IURI,
    1162                 :            :                              rtl_TextEncoding eCharset
    1163                 :            :                                  = RTL_TEXTENCODING_UTF8) const
    1164                 :            :     { return GetLastName(eMechanism, eCharset); }
    1165                 :            : 
    1166                 :            :     void SetExtension(rtl::OUString const & rTheExtension,
    1167                 :            :                       EncodeMechanism eMechanism = WAS_ENCODED,
    1168                 :            :                       rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
    1169                 :            : 
    1170                 :            :     inline rtl::OUString GetExtension(
    1171                 :            :                                   DecodeMechanism eMechanism = DECODE_TO_IURI,
    1172                 :            :                                   rtl_TextEncoding eCharset
    1173                 :            :                                       = RTL_TEXTENCODING_UTF8) const
    1174                 :            :     { return GetFileExtension(eMechanism, eCharset); }
    1175                 :            : 
    1176                 :            :     rtl::OUString CutExtension(DecodeMechanism eMechanism = DECODE_TO_IURI,
    1177                 :            :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
    1178                 :            : 
    1179                 :            :     bool IsCaseSensitive() const;
    1180                 :            : 
    1181                 :            : 
    1182                 :            : private:
    1183                 :            :     // General Structure:
    1184                 :            : 
    1185                 :            :     class SubString
    1186                 :            :     {
    1187                 :            :         sal_Int32 m_nBegin;
    1188                 :            :         sal_Int32 m_nLength;
    1189                 :            : 
    1190                 :            :     public:
    1191                 :    1364147 :         explicit inline SubString(sal_Int32 nTheBegin = -1,
    1192                 :            :                                   sal_Int32 nTheLength = 0):
    1193                 :    1364147 :             m_nBegin(nTheBegin), m_nLength(nTheLength) {}
    1194                 :            : 
    1195                 :    2327178 :         inline bool isPresent() const { return m_nBegin != -1; }
    1196                 :            : 
    1197                 :     111419 :         inline bool isEmpty() const { return m_nLength == 0; }
    1198                 :            : 
    1199                 :     125642 :         inline sal_Int32 getBegin() const { return m_nBegin; }
    1200                 :            : 
    1201                 :     102177 :         inline sal_Int32 getLength() const { return m_nLength; }
    1202                 :            : 
    1203                 :      26765 :         inline sal_Int32 getEnd() const { return m_nBegin + m_nLength; }
    1204                 :            : 
    1205                 :            :         inline sal_Int32 clear();
    1206                 :            : 
    1207                 :            :         inline sal_Int32 set(rtl::OUStringBuffer & rString,
    1208                 :            :                              rtl::OUString const & rSubString,
    1209                 :            :                              sal_Int32 nTheBegin);
    1210                 :            : 
    1211                 :            :         inline sal_Int32 set(rtl::OUString & rString,
    1212                 :            :                              rtl::OUString const & rSubString);
    1213                 :            : 
    1214                 :            :         inline sal_Int32 set(rtl::OUStringBuffer & rString,
    1215                 :            :                              rtl::OUString const & rSubString);
    1216                 :            : 
    1217                 :            :         inline void operator +=(sal_Int32 nDelta);
    1218                 :            : 
    1219                 :            :         int compare(SubString const & rOther,
    1220                 :            :             rtl::OUStringBuffer const & rThisString,
    1221                 :            :             rtl::OUStringBuffer const & rOtherString) const;
    1222                 :            :     };
    1223                 :            : 
    1224                 :            :     rtl::OUStringBuffer m_aAbsURIRef;
    1225                 :            :     SubString m_aScheme;
    1226                 :            :     SubString m_aUser;
    1227                 :            :     SubString m_aAuth;
    1228                 :            :     SubString m_aHost;
    1229                 :            :     SubString m_aPort;
    1230                 :            :     SubString m_aPath;
    1231                 :            :     SubString m_aQuery;
    1232                 :            :     SubString m_aFragment;
    1233                 :            :     INetProtocol m_eScheme;
    1234                 :            :     INetProtocol m_eSmartScheme;
    1235                 :            : 
    1236                 :            :     TOOLS_DLLPRIVATE void setInvalid();
    1237                 :            : 
    1238                 :            :     bool setAbsURIRef(
    1239                 :            :         rtl::OUString const & rTheAbsURIRef, bool bOctets,
    1240                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bSmart,
    1241                 :            :         FSysStyle eStyle);
    1242                 :            : 
    1243                 :            :     // Relative URLs:
    1244                 :            : 
    1245                 :            :     bool convertRelToAbs(
    1246                 :            :         rtl::OUString const & rTheRelURIRef, bool bOctets,
    1247                 :            :         INetURLObject & rTheAbsURIRef, bool & rWasAbsolute,
    1248                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
    1249                 :            :         bool bIgnoreFragment, bool bSmart, bool bRelativeNonURIs,
    1250                 :            :         FSysStyle eStyle) const;
    1251                 :            : 
    1252                 :            :     bool convertAbsToRel(
    1253                 :            :         rtl::OUString const & rTheAbsURIRef, bool bOctets,
    1254                 :            :         rtl::OUString & rTheRelURIRef, EncodeMechanism eEncodeMechanism,
    1255                 :            :         DecodeMechanism eDecodeMechanism, rtl_TextEncoding eCharset,
    1256                 :            :         FSysStyle eStyle) const;
    1257                 :            : 
    1258                 :            :     // External URLs:
    1259                 :            : 
    1260                 :            :     static bool convertIntToExt(
    1261                 :            :         rtl::OUString const & rTheIntURIRef, bool bOctets,
    1262                 :            :         rtl::OUString & rTheExtURIRef, DecodeMechanism eDecodeMechanism,
    1263                 :            :         rtl_TextEncoding eCharset);
    1264                 :            : 
    1265                 :            :     static bool convertExtToInt(
    1266                 :            :         rtl::OUString const & rTheExtURIRef, bool bOctets,
    1267                 :            :         rtl::OUString & rTheIntURIRef, DecodeMechanism eDecodeMechanism,
    1268                 :            :         rtl_TextEncoding eCharset);
    1269                 :            : 
    1270                 :            :     // Scheme:
    1271                 :            : 
    1272                 :            :     struct PrefixInfo;
    1273                 :            : 
    1274                 :            :     TOOLS_DLLPRIVATE static inline SchemeInfo const & getSchemeInfo(
    1275                 :            :         INetProtocol eTheScheme);
    1276                 :            : 
    1277                 :            :     TOOLS_DLLPRIVATE inline SchemeInfo const & getSchemeInfo() const;
    1278                 :            : 
    1279                 :            :     TOOLS_DLLPRIVATE static PrefixInfo const * getPrefix(
    1280                 :            :         sal_Unicode const *& rBegin, sal_Unicode const * pEnd);
    1281                 :            : 
    1282                 :            :     // Authority:
    1283                 :            : 
    1284                 :            :     TOOLS_DLLPRIVATE sal_Int32 getAuthorityBegin() const;
    1285                 :            : 
    1286                 :            :     TOOLS_DLLPRIVATE SubString getAuthority() const;
    1287                 :            : 
    1288                 :            :     // User Info:
    1289                 :            : 
    1290                 :            :     bool setUser(
    1291                 :            :         rtl::OUString const & rTheUser, bool bOctets,
    1292                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1293                 :            : 
    1294                 :            :     bool clearPassword();
    1295                 :            : 
    1296                 :            :     bool setPassword(
    1297                 :            :         rtl::OUString const & rThePassword, bool bOctets,
    1298                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1299                 :            : 
    1300                 :            :     // Host and Port:
    1301                 :            : 
    1302                 :            :     TOOLS_DLLPRIVATE static bool parseHost(
    1303                 :            :         sal_Unicode const *& rBegin, sal_Unicode const * pEnd,
    1304                 :            :         rtl::OUString & rCanonic);
    1305                 :            : 
    1306                 :            :     TOOLS_DLLPRIVATE static bool parseHostOrNetBiosName(
    1307                 :            :         sal_Unicode const * pBegin, sal_Unicode const * pEnd, bool bOctets,
    1308                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
    1309                 :            :         bool bNetBiosName, rtl::OUStringBuffer* pCanonic);
    1310                 :            : 
    1311                 :            :     bool setHost(
    1312                 :            :         rtl::OUString const & rTheHost, bool bOctets,
    1313                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1314                 :            : 
    1315                 :            :     // Path:
    1316                 :            : 
    1317                 :            :     TOOLS_DLLPRIVATE static bool parsePath(
    1318                 :            :         INetProtocol eScheme, sal_Unicode const ** pBegin,
    1319                 :            :         sal_Unicode const * pEnd, bool bOctets, EncodeMechanism eMechanism,
    1320                 :            :         rtl_TextEncoding eCharset, bool bSkippedInitialSlash,
    1321                 :            :         sal_uInt32 nSegmentDelimiter, sal_uInt32 nAltSegmentDelimiter,
    1322                 :            :         sal_uInt32 nQueryDelimiter, sal_uInt32 nFragmentDelimiter,
    1323                 :            :         rtl::OUStringBuffer &rSynPath);
    1324                 :            : 
    1325                 :            :     bool setPath(
    1326                 :            :         rtl::OUString const & rThePath, bool bOctets,
    1327                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1328                 :            : 
    1329                 :            :     // Hierarchical Path:
    1330                 :            : 
    1331                 :            :     TOOLS_DLLPRIVATE bool checkHierarchical() const;
    1332                 :            : 
    1333                 :            :     bool appendSegment(
    1334                 :            :         rtl::OUString const & rTheSegment, bool bOctets,
    1335                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1336                 :            : 
    1337                 :            :     TOOLS_DLLPRIVATE SubString getSegment(
    1338                 :            :         sal_Int32 nIndex, bool bIgnoreFinalSlash) const;
    1339                 :            : 
    1340                 :            :     bool insertName(
    1341                 :            :         rtl::OUString const & rTheName, bool bOctets, bool bAppendFinalSlash,
    1342                 :            :         sal_Int32 nIndex, bool bIgnoreFinalSlash, EncodeMechanism eMechanism,
    1343                 :            :         rtl_TextEncoding eCharset);
    1344                 :            : 
    1345                 :            :     // Query:
    1346                 :            : 
    1347                 :            :     bool clearQuery();
    1348                 :            : 
    1349                 :            :     bool setQuery(
    1350                 :            :         rtl::OUString const & rTheQuery, bool bOctets,
    1351                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1352                 :            : 
    1353                 :            :     // Fragment:
    1354                 :            : 
    1355                 :            :     bool clearFragment();
    1356                 :            : 
    1357                 :            :     bool setFragment(
    1358                 :            :         rtl::OUString const & rTheMark, bool bOctets,
    1359                 :            :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1360                 :            : 
    1361                 :            :     // FILE URLs:
    1362                 :            : 
    1363                 :            :     TOOLS_DLLPRIVATE bool hasDosVolume(FSysStyle eStyle) const;
    1364                 :            : 
    1365                 :            :     // Coding:
    1366                 :            : 
    1367                 :          0 :     static inline rtl::OUString extend(const rtl::OString& rOctets)
    1368                 :            :     {
    1369                 :          0 :         return rtl::OStringToOUString(rOctets, RTL_TEXTENCODING_ISO_8859_1);
    1370                 :            :     }
    1371                 :            : 
    1372                 :     879784 :     static inline sal_Char getEscapePrefix(INetProtocol eTheScheme)
    1373         [ -  + ]:     879784 :     { return eTheScheme == INET_PROT_VIM ? '=' : '%'; }
    1374                 :            : 
    1375                 :     879784 :     inline sal_Char getEscapePrefix() const
    1376                 :     879784 :     { return getEscapePrefix(m_eScheme); }
    1377                 :            : 
    1378                 :            :     TOOLS_DLLPRIVATE static inline void appendEscape(
    1379                 :            :         rtl::OUStringBuffer & rTheText, sal_Char cEscapePrefix,
    1380                 :            :         sal_uInt32 nOctet);
    1381                 :            : 
    1382                 :            :     static rtl::OUString encodeText(
    1383                 :            :         sal_Unicode const * pBegin, sal_Unicode const * pEnd, bool bOctets,
    1384                 :            :         Part ePart, sal_Char cEscapePrefix, EncodeMechanism eMechanism,
    1385                 :            :         rtl_TextEncoding eCharset, bool bKeepVisibleEscapes);
    1386                 :            : 
    1387                 :            :     static inline rtl::OUString encodeText(
    1388                 :            :         rtl::OUString const & rTheText, bool bOctets, Part ePart,
    1389                 :            :         sal_Char cEscapePrefix, EncodeMechanism eMechanism,
    1390                 :            :         rtl_TextEncoding eCharset, bool bKeepVisibleEscapes);
    1391                 :            : 
    1392                 :            :     static rtl::OUString decode(
    1393                 :            :         sal_Unicode const * pBegin, sal_Unicode const * pEnd,
    1394                 :            :         sal_Char cEscapePrefix, DecodeMechanism, rtl_TextEncoding eCharset);
    1395                 :            : 
    1396                 :            :     inline rtl::OUString decode(
    1397                 :            :         SubString const & rSubString, sal_Char cEscapePrefix,
    1398                 :            :         DecodeMechanism eMechanism, rtl_TextEncoding eCharset) const;
    1399                 :            : 
    1400                 :            :     // Specialized helpers:
    1401                 :            : 
    1402                 :            :     TOOLS_DLLPRIVATE static bool scanIPv6reference(
    1403                 :            :         sal_Unicode const *& rBegin, sal_Unicode const * pEnd);
    1404                 :            : 
    1405                 :            : private:
    1406                 :            :     void changeScheme(INetProtocol eTargetScheme);
    1407                 :            : };
    1408                 :            : 
    1409                 :            : // static
    1410                 :      13836 : inline rtl::OUString INetURLObject::encodeText(rtl::OUString const & rTheText,
    1411                 :            :                                            bool bOctets, Part ePart,
    1412                 :            :                                            sal_Char cEscapePrefix,
    1413                 :            :                                            EncodeMechanism eMechanism,
    1414                 :            :                                            rtl_TextEncoding eCharset,
    1415                 :            :                                            bool bKeepVisibleEscapes)
    1416                 :            : {
    1417                 :            :     return encodeText(rTheText.getStr(),
    1418                 :      13836 :                       rTheText.getStr() + rTheText.getLength(), bOctets, ePart,
    1419                 :            :                       cEscapePrefix, eMechanism, eCharset,
    1420                 :      13836 :                       bKeepVisibleEscapes);
    1421                 :            : }
    1422                 :            : 
    1423                 :      18918 : inline rtl::OUString INetURLObject::decode(SubString const & rSubString,
    1424                 :            :                                        sal_Char cEscapePrefix,
    1425                 :            :                                        DecodeMechanism eMechanism,
    1426                 :            :                                        rtl_TextEncoding eCharset) const
    1427                 :            : {
    1428                 :      18918 :     return rSubString.isPresent() ?
    1429                 :       7584 :                decode(m_aAbsURIRef.getStr() + rSubString.getBegin(),
    1430                 :       7584 :                       m_aAbsURIRef.getStr() + rSubString.getEnd(),
    1431                 :            :                       cEscapePrefix, eMechanism, eCharset) :
    1432         [ +  + ]:      26502 :                rtl::OUString();
    1433                 :            : }
    1434                 :            : 
    1435                 :          0 : inline INetURLObject::INetURLObject(const rtl::OString& rTheAbsURIRef,
    1436                 :            :                                     EncodeMechanism eMechanism,
    1437                 :            :                                     rtl_TextEncoding eCharset):
    1438                 :          0 :     m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP)
    1439                 :            : {
    1440                 :            :     setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset, false,
    1441 [ #  # ][ #  # ]:          0 :                  FSysStyle(0));
    1442                 :          0 : }
    1443                 :            : 
    1444                 :        510 : inline INetURLObject::INetURLObject(rtl::OUString const & rTheAbsURIRef,
    1445                 :            :                                     EncodeMechanism eMechanism,
    1446                 :            :                                     rtl_TextEncoding eCharset):
    1447                 :        510 :     m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP)
    1448                 :            : {
    1449                 :            :     setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, false,
    1450         [ +  - ]:        510 :                  FSysStyle(0));
    1451                 :        510 : }
    1452                 :            : 
    1453                 :            : inline bool INetURLObject::SetURL(const rtl::OString& rTheAbsURIRef,
    1454                 :            :                                   EncodeMechanism eMechanism,
    1455                 :            :                                   rtl_TextEncoding eCharset)
    1456                 :            : {
    1457                 :            :     return setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset,
    1458                 :            :                         false, FSysStyle(0));
    1459                 :            : }
    1460                 :            : 
    1461                 :            : inline bool INetURLObject::SetURL(rtl::OUString const & rTheAbsURIRef,
    1462                 :            :                                   EncodeMechanism eMechanism,
    1463                 :            :                                   rtl_TextEncoding eCharset)
    1464                 :            : {
    1465                 :            :     return setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, false,
    1466                 :            :                         FSysStyle(0));
    1467                 :            : }
    1468                 :            : 
    1469                 :            : inline INetURLObject::INetURLObject(rtl::OUString const & rTheAbsURIRef,
    1470                 :            :                                     INetProtocol eTheSmartScheme,
    1471                 :            :                                     EncodeMechanism eMechanism,
    1472                 :            :                                     rtl_TextEncoding eCharset,
    1473                 :            :                                     FSysStyle eStyle):
    1474                 :            :     m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(eTheSmartScheme)
    1475                 :            : {
    1476                 :            :     setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, true, eStyle);
    1477                 :            : }
    1478                 :            : 
    1479                 :            : inline bool INetURLObject::SetSmartURL(const rtl::OString& rTheAbsURIRef,
    1480                 :            :                                        EncodeMechanism eMechanism,
    1481                 :            :                                        rtl_TextEncoding eCharset,
    1482                 :            :                                        FSysStyle eStyle)
    1483                 :            : {
    1484                 :            :     return setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset,
    1485                 :            :                         true, eStyle);
    1486                 :            : }
    1487                 :            : 
    1488                 :            : inline bool INetURLObject::SetSmartURL(rtl::OUString const & rTheAbsURIRef,
    1489                 :            :                                        EncodeMechanism eMechanism,
    1490                 :            :                                        rtl_TextEncoding eCharset,
    1491                 :            :                                        FSysStyle eStyle)
    1492                 :            : {
    1493                 :            :     return setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, true,
    1494                 :            :                         eStyle);
    1495                 :            : }
    1496                 :            : 
    1497                 :            : inline INetURLObject
    1498                 :            : INetURLObject::smartRel2Abs(const rtl::OString& rTheRelURIRef,
    1499                 :            :                             bool & rWasAbsolute,
    1500                 :            :                             bool bIgnoreFragment,
    1501                 :            :                             EncodeMechanism eMechanism,
    1502                 :            :                             rtl_TextEncoding eCharset,
    1503                 :            :                             bool bRelativeNonURIs,
    1504                 :            :                             FSysStyle eStyle) const
    1505                 :            : {
    1506                 :            :     INetURLObject aTheAbsURIRef;
    1507                 :            :     convertRelToAbs(extend(rTheRelURIRef), true, aTheAbsURIRef, rWasAbsolute,
    1508                 :            :                     eMechanism, eCharset, bIgnoreFragment, true,
    1509                 :            :                     bRelativeNonURIs, eStyle);
    1510                 :            :     return aTheAbsURIRef;
    1511                 :            : }
    1512                 :            : 
    1513                 :            : inline INetURLObject
    1514                 :            : INetURLObject::smartRel2Abs(rtl::OUString const & rTheRelURIRef,
    1515                 :            :                             bool & rWasAbsolute,
    1516                 :            :                             bool bIgnoreFragment,
    1517                 :            :                             EncodeMechanism eMechanism,
    1518                 :            :                             rtl_TextEncoding eCharset,
    1519                 :            :                             bool bRelativeNonURIs,
    1520                 :            :                             FSysStyle eStyle) const
    1521                 :            : {
    1522                 :            :     INetURLObject aTheAbsURIRef;
    1523                 :            :     convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, rWasAbsolute,
    1524                 :            :                     eMechanism, eCharset, bIgnoreFragment, true,
    1525                 :            :                     bRelativeNonURIs, eStyle);
    1526                 :            :     return aTheAbsURIRef;
    1527                 :            : }
    1528                 :            : 
    1529                 :            : inline bool INetURLObject::GetNewAbsURL(const rtl::OString& rTheRelURIRef,
    1530                 :            :                                         INetURLObject * pTheAbsURIRef,
    1531                 :            :                                         EncodeMechanism eMechanism,
    1532                 :            :                                         rtl_TextEncoding eCharset,
    1533                 :            :                                         FSysStyle eStyle, bool bIgnoreFragment)
    1534                 :            :     const
    1535                 :            : {
    1536                 :            :     INetURLObject aTheAbsURIRef;
    1537                 :            :     bool bWasAbsolute;
    1538                 :            :     if (!convertRelToAbs(extend(rTheRelURIRef), true, aTheAbsURIRef,
    1539                 :            :                          bWasAbsolute, eMechanism, eCharset, bIgnoreFragment,
    1540                 :            :                          false, false, eStyle))
    1541                 :            :         return false;
    1542                 :            :     if (pTheAbsURIRef)
    1543                 :            :         *pTheAbsURIRef = aTheAbsURIRef;
    1544                 :            :     return true;
    1545                 :            : }
    1546                 :            : 
    1547                 :            : inline bool INetURLObject::GetNewAbsURL(rtl::OUString const & rTheRelURIRef,
    1548                 :            :                                         INetURLObject * pTheAbsURIRef,
    1549                 :            :                                         EncodeMechanism eMechanism,
    1550                 :            :                                         rtl_TextEncoding eCharset,
    1551                 :            :                                         FSysStyle eStyle, bool bIgnoreFragment)
    1552                 :            :     const
    1553                 :            : {
    1554                 :            :     INetURLObject aTheAbsURIRef;
    1555                 :            :     bool bWasAbsolute;
    1556                 :            :     if (!convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, bWasAbsolute,
    1557                 :            :                          eMechanism, eCharset, bIgnoreFragment, false, false,
    1558                 :            :                          eStyle))
    1559                 :            :         return false;
    1560                 :            :     if (pTheAbsURIRef)
    1561                 :            :         *pTheAbsURIRef = aTheAbsURIRef;
    1562                 :            :     return true;
    1563                 :            : }
    1564                 :            : 
    1565                 :            : // static
    1566                 :            : inline rtl::OUString INetURLObject::GetRelURL(const rtl::OString& rTheBaseURIRef,
    1567                 :            :                                           const rtl::OString& rTheAbsURIRef,
    1568                 :            :                                           EncodeMechanism eEncodeMechanism,
    1569                 :            :                                           DecodeMechanism eDecodeMechanism,
    1570                 :            :                                           rtl_TextEncoding eCharset,
    1571                 :            :                                           FSysStyle eStyle)
    1572                 :            : {
    1573                 :            :     rtl::OUString aTheRelURIRef;
    1574                 :            :     INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset).
    1575                 :            :         convertAbsToRel(extend(rTheAbsURIRef), true, aTheRelURIRef,
    1576                 :            :                         eEncodeMechanism, eDecodeMechanism, eCharset, eStyle);
    1577                 :            :     return aTheRelURIRef;
    1578                 :            : }
    1579                 :            : 
    1580                 :            : // static
    1581                 :            : inline rtl::OUString INetURLObject::GetRelURL(rtl::OUString const & rTheBaseURIRef,
    1582                 :            :                                           rtl::OUString const & rTheAbsURIRef,
    1583                 :            :                                           EncodeMechanism eEncodeMechanism,
    1584                 :            :                                           DecodeMechanism eDecodeMechanism,
    1585                 :            :                                           rtl_TextEncoding eCharset,
    1586                 :            :                                           FSysStyle eStyle)
    1587                 :            : {
    1588                 :            :     rtl::OUString aTheRelURIRef;
    1589                 :            :     INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset).
    1590                 :            :         convertAbsToRel(rTheAbsURIRef, false, aTheRelURIRef, eEncodeMechanism,
    1591                 :            :                         eDecodeMechanism, eCharset, eStyle);
    1592                 :            :     return aTheRelURIRef;
    1593                 :            : }
    1594                 :            : 
    1595                 :            : // static
    1596                 :            : inline bool INetURLObject::translateToExternal(const rtl::OString& rTheIntURIRef,
    1597                 :            :                                                rtl::OUString & rTheExtURIRef,
    1598                 :            :                                                DecodeMechanism
    1599                 :            :                                                    eDecodeMechanism,
    1600                 :            :                                                rtl_TextEncoding eCharset)
    1601                 :            : {
    1602                 :            :     rtl::OUString aTheExtURIRef;
    1603                 :            :     bool bRet = convertIntToExt(extend(rTheIntURIRef), true, aTheExtURIRef,
    1604                 :            :                                 eDecodeMechanism, eCharset);
    1605                 :            :     rTheExtURIRef = aTheExtURIRef;
    1606                 :            :     return bRet;
    1607                 :            : }
    1608                 :            : 
    1609                 :            : // static
    1610                 :          0 : inline bool INetURLObject::translateToExternal(rtl::OUString const &
    1611                 :            :                                                    rTheIntURIRef,
    1612                 :            :                                                rtl::OUString & rTheExtURIRef,
    1613                 :            :                                                DecodeMechanism
    1614                 :            :                                                    eDecodeMechanism,
    1615                 :            :                                                rtl_TextEncoding eCharset)
    1616                 :            : {
    1617                 :            :     return convertIntToExt(rTheIntURIRef, false, rTheExtURIRef,
    1618                 :          0 :                            eDecodeMechanism, eCharset);
    1619                 :            : }
    1620                 :            : 
    1621                 :            : // static
    1622                 :            : inline bool INetURLObject::translateToInternal(const rtl::OString&
    1623                 :            :                                                    rTheExtURIRef,
    1624                 :            :                                                rtl::OUString & rTheIntURIRef,
    1625                 :            :                                                DecodeMechanism
    1626                 :            :                                                    eDecodeMechanism,
    1627                 :            :                                                rtl_TextEncoding eCharset)
    1628                 :            : {
    1629                 :            :     rtl::OUString aTheIntURIRef;
    1630                 :            :     bool bRet = convertExtToInt(extend(rTheExtURIRef), true, aTheIntURIRef,
    1631                 :            :                            eDecodeMechanism, eCharset);
    1632                 :            :     rTheIntURIRef = aTheIntURIRef;
    1633                 :            :     return bRet;
    1634                 :            : }
    1635                 :            : 
    1636                 :            : // static
    1637                 :            : inline bool INetURLObject::translateToInternal(rtl::OUString const &
    1638                 :            :                                                    rTheExtURIRef,
    1639                 :            :                                                rtl::OUString & rTheIntURIRef,
    1640                 :            :                                                DecodeMechanism
    1641                 :            :                                                    eDecodeMechanism,
    1642                 :            :                                                rtl_TextEncoding eCharset)
    1643                 :            : {
    1644                 :            :     return convertExtToInt(rTheExtURIRef, false, rTheIntURIRef,
    1645                 :            :                            eDecodeMechanism, eCharset);
    1646                 :            : }
    1647                 :            : 
    1648                 :            : inline bool INetURLObject::SetPass(const rtl::OString& rThePassword,
    1649                 :            :                                    EncodeMechanism eMechanism,
    1650                 :            :                                    rtl_TextEncoding eCharset)
    1651                 :            : {
    1652                 :            :     return rThePassword.isEmpty() ?
    1653                 :            :                clearPassword() :
    1654                 :            :                setPassword(extend(rThePassword), true, eMechanism, eCharset);
    1655                 :            : }
    1656                 :            : 
    1657                 :            : inline bool INetURLObject::SetPass(rtl::OUString const & rThePassword,
    1658                 :            :                                    EncodeMechanism eMechanism,
    1659                 :            :                                    rtl_TextEncoding eCharset)
    1660                 :            : {
    1661                 :            :     return rThePassword.isEmpty() ?
    1662                 :            :                clearPassword() :
    1663                 :            :                setPassword(rThePassword, false, eMechanism, eCharset);
    1664                 :            : }
    1665                 :            : 
    1666                 :            : inline bool INetURLObject::SetUserAndPass(const rtl::OString& rTheUser,
    1667                 :            :                                           const rtl::OString& rThePassword,
    1668                 :            :                                           EncodeMechanism eMechanism,
    1669                 :            :                                           rtl_TextEncoding eCharset)
    1670                 :            : {
    1671                 :            :     return setUser(extend(rTheUser), true, eMechanism, eCharset)
    1672                 :            :            && (rThePassword.isEmpty() ?
    1673                 :            :                    clearPassword() :
    1674                 :            :                    setPassword(extend(rThePassword), true, eMechanism,
    1675                 :            :                                eCharset));
    1676                 :            : }
    1677                 :            : 
    1678                 :            : inline bool INetURLObject::SetUserAndPass(rtl::OUString const & rTheUser,
    1679                 :            :                                           rtl::OUString const & rThePassword,
    1680                 :            :                                           EncodeMechanism eMechanism,
    1681                 :            :                                           rtl_TextEncoding eCharset)
    1682                 :            : {
    1683                 :            :     return setUser(rTheUser, false, eMechanism, eCharset)
    1684                 :            :            && (rThePassword.isEmpty() ?
    1685                 :            :                    clearPassword() :
    1686                 :            :                    setPassword(rThePassword, false, eMechanism, eCharset));
    1687                 :            : }
    1688                 :            : 
    1689                 :          0 : inline bool INetURLObject::insertName(rtl::OUString const & rTheName,
    1690                 :            :                                       bool bAppendFinalSlash,
    1691                 :            :                                       sal_Int32 nIndex,
    1692                 :            :                                       bool bIgnoreFinalSlash,
    1693                 :            :                                       EncodeMechanism eMechanism,
    1694                 :            :                                       rtl_TextEncoding eCharset)
    1695                 :            : {
    1696                 :            :     return insertName(rTheName, false, bAppendFinalSlash, nIndex,
    1697                 :          0 :                       bIgnoreFinalSlash, eMechanism, eCharset);
    1698                 :            : }
    1699                 :            : 
    1700                 :            : inline bool INetURLObject::SetParam(const rtl::OString& rTheQuery,
    1701                 :            :                                     EncodeMechanism eMechanism,
    1702                 :            :                                     rtl_TextEncoding eCharset)
    1703                 :            : {
    1704                 :            :     return rTheQuery.isEmpty() ?
    1705                 :            :                clearQuery() :
    1706                 :            :                setQuery(extend(rTheQuery), true, eMechanism, eCharset);
    1707                 :            : }
    1708                 :            : 
    1709                 :            : inline bool INetURLObject::SetParam(rtl::OUString const & rTheQuery,
    1710                 :            :                                     EncodeMechanism eMechanism,
    1711                 :            :                                     rtl_TextEncoding eCharset)
    1712                 :            : {
    1713                 :            :     return rTheQuery.isEmpty() ?
    1714                 :            :                clearQuery() :
    1715                 :            :                setQuery(rTheQuery, false, eMechanism, eCharset);
    1716                 :            : }
    1717                 :            : 
    1718                 :            : inline bool INetURLObject::SetMark(const rtl::OString& rTheFragment,
    1719                 :            :                                    EncodeMechanism eMechanism,
    1720                 :            :                                    rtl_TextEncoding eCharset)
    1721                 :            : {
    1722                 :            :     return rTheFragment.isEmpty() ?
    1723                 :            :                clearFragment() :
    1724                 :            :                setFragment(extend(rTheFragment), true, eMechanism, eCharset);
    1725                 :            : }
    1726                 :            : 
    1727                 :            : inline bool INetURLObject::SetMark(rtl::OUString const & rTheFragment,
    1728                 :            :                                    EncodeMechanism eMechanism,
    1729                 :            :                                    rtl_TextEncoding eCharset)
    1730                 :            : {
    1731                 :            :     return rTheFragment.isEmpty() ?
    1732                 :            :                clearFragment() :
    1733                 :            :                setFragment(rTheFragment, false, eMechanism, eCharset);
    1734                 :            : }
    1735                 :            : 
    1736                 :            : inline INetURLObject::INetURLObject(rtl::OUString const & rFSysPath,
    1737                 :            :                                     FSysStyle eStyle):
    1738                 :            :     m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP)
    1739                 :            : {
    1740                 :            :     setFSysPath(rFSysPath, eStyle);
    1741                 :            : }
    1742                 :            : 
    1743                 :            : // static
    1744                 :            : inline rtl::OUString INetURLObject::encode(const rtl::OString& rText, Part ePart,
    1745                 :            :                                        sal_Char cEscapePrefix,
    1746                 :            :                                        EncodeMechanism eMechanism,
    1747                 :            :                                        rtl_TextEncoding eCharset)
    1748                 :            : {
    1749                 :            :     return encodeText(extend(rText), true, ePart, cEscapePrefix, eMechanism,
    1750                 :            :                       eCharset, false);
    1751                 :            : }
    1752                 :            : 
    1753                 :            : // static
    1754                 :            : inline rtl::OUString INetURLObject::encode(rtl::OUString const & rText, Part ePart,
    1755                 :            :                                        sal_Char cEscapePrefix,
    1756                 :            :                                        EncodeMechanism eMechanism,
    1757                 :            :                                        rtl_TextEncoding eCharset)
    1758                 :            : {
    1759                 :            :     return encodeText(rText, false, ePart, cEscapePrefix, eMechanism,
    1760                 :            :                       eCharset, false);
    1761                 :            : }
    1762                 :            : 
    1763                 :            : // static
    1764                 :          0 : inline rtl::OUString INetURLObject::decode(rtl::OUString const & rText,
    1765                 :            :                                        sal_Char cEscapePrefix,
    1766                 :            :                                        DecodeMechanism eMechanism,
    1767                 :            :                                        rtl_TextEncoding eCharset)
    1768                 :            : {
    1769                 :          0 :     return decode(rText.getStr(), rText.getStr() + rText.getLength(),
    1770                 :          0 :                   cEscapePrefix, eMechanism, eCharset);
    1771                 :            : }
    1772                 :            : 
    1773                 :       4662 : inline rtl::OUString INetURLObject::decode(rtl::OUStringBuffer const & rText,
    1774                 :            :                                        sal_Char cEscapePrefix,
    1775                 :            :                                        DecodeMechanism eMechanism,
    1776                 :            :                                        rtl_TextEncoding eCharset)
    1777                 :            : {
    1778                 :       4662 :     return decode(rText.getStr(), rText.getStr() + rText.getLength(),
    1779                 :       4662 :                   cEscapePrefix, eMechanism, eCharset);
    1780                 :            : }
    1781                 :            : 
    1782                 :            : #endif
    1783                 :            : 
    1784                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10