LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/tools - urlobj.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 101 142 71.1 %
Date: 2013-07-09 Functions: 49 62 79.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10