LCOV - code coverage report
Current view: top level - libreoffice/tools/inc/tools - urlobj.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 41 56 73.2 %
Date: 2012-12-27 Functions: 23 29 79.3 %
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        1422 : 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 rtl::OString or a rtl::OUString
     117             :         as input.  Using a rtl::OString, octets in the range 0x80--0xFF are
     118             :         replaced by single escape sequences.  Using a rtl::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           0 :     inline INetURLObject():
     190           0 :         m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP) {}
     191             : 
     192        1505 :     inline bool HasError() const { return m_eScheme == INET_PROT_NOT_VALID; }
     193             : 
     194         667 :     inline rtl::OUString GetMainURL(DecodeMechanism eMechanism,
     195             :                                 rtl_TextEncoding eCharset
     196             :                                     = RTL_TEXTENCODING_UTF8) const
     197         667 :     { return decode(m_aAbsURIRef, getEscapePrefix(), eMechanism, eCharset); }
     198             : 
     199             :     rtl::OUString GetURLNoPass(DecodeMechanism eMechanism = DECODE_TO_IURI,
     200             :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     201             :         const;
     202             : 
     203             :     rtl::OUString GetURLNoMark(DecodeMechanism eMechanism = DECODE_TO_IURI,
     204             :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     205             :         const;
     206             : 
     207             :     rtl::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             :     inline bool operator !=(INetURLObject const & rObject) const
     219             :     { 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 rtl::OString& rTheAbsURIRef,
     229             :                          EncodeMechanism eMechanism = WAS_ENCODED,
     230             :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     231             : 
     232             :     inline INetURLObject(rtl::OUString const & rTheAbsURIRef,
     233             :                          EncodeMechanism eMechanism = WAS_ENCODED,
     234             :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     235             : 
     236             :     inline bool SetURL(const rtl::OString& rTheAbsURIRef,
     237             :                        EncodeMechanism eMechanism = WAS_ENCODED,
     238             :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     239             : 
     240             :     inline bool SetURL(rtl::OUString const & rTheAbsURIRef,
     241             :                        EncodeMechanism eMechanism = WAS_ENCODED,
     242             :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     243             : 
     244             :     bool ConcatData(INetProtocol eTheScheme, rtl::OUString const & rTheUser,
     245             :                     rtl::OUString const & rThePassword,
     246             :                     rtl::OUString const & rTheHost, sal_uInt32 nThePort,
     247             :                     rtl::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(rtl::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             :     inline void SetSmartProtocol(INetProtocol eTheSmartScheme)
     357             :     { m_eSmartScheme = eTheSmartScheme; }
     358             : 
     359             :     inline bool
     360             :     SetSmartURL(const rtl::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(rtl::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 rtl::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(rtl::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 rtl::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(rtl::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 rtl::OUString
     415             :     GetAbsURL(rtl::OUString const & rTheBaseURIRef,
     416             :               rtl::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 rtl::OUString
     424             :     GetRelURL(const rtl::OString& rTheBaseURIRef,
     425             :               const rtl::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 rtl::OUString
     432             :     GetRelURL(rtl::OUString const & rTheBaseURIRef,
     433             :               rtl::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             :     rtl::OUString getExternalURL(DecodeMechanism eMechanism = DECODE_TO_IURI,
     442             :                              rtl_TextEncoding eCharset
     443             :                                  = RTL_TEXTENCODING_UTF8) const;
     444             : 
     445             :     static inline bool translateToExternal(const rtl::OString& rTheIntURIRef,
     446             :                                            rtl::OUString & rTheExtURIRef,
     447             :                                            DecodeMechanism eDecodeMechanism
     448             :                                                = DECODE_TO_IURI,
     449             :                                            rtl_TextEncoding eCharset
     450             :                                                = RTL_TEXTENCODING_UTF8);
     451             : 
     452             :     static inline bool translateToExternal(rtl::OUString const & rTheIntURIRef,
     453             :                                            rtl::OUString & rTheExtURIRef,
     454             :                                            DecodeMechanism eDecodeMechanism
     455             :                                                = DECODE_TO_IURI,
     456             :                                            rtl_TextEncoding eCharset
     457             :                                                = RTL_TEXTENCODING_UTF8);
     458             : 
     459             :     static inline bool translateToInternal(const rtl::OString& rTheExtURIRef,
     460             :                                            rtl::OUString & rTheIntURIRef,
     461             :                                            DecodeMechanism eDecodeMechanism
     462             :                                                = DECODE_TO_IURI,
     463             :                                            rtl_TextEncoding eCharset
     464             :                                                = RTL_TEXTENCODING_UTF8);
     465             : 
     466             :     static inline bool translateToInternal(rtl::OUString const & rTheExtURIRef,
     467             :                                            rtl::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             :     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 rtl::OUString GetScheme(INetProtocol eTheScheme);
     486             : 
     487             :     static inline INetProtocol CompareProtocolScheme(const rtl::OString&
     488             :                                                          rTheAbsURIRef)
     489             :     { return CompareProtocolScheme(extend(rTheAbsURIRef)); }
     490             : 
     491             :     static INetProtocol CompareProtocolScheme(rtl::OUString const &
     492             :                                                   rTheAbsURIRef);
     493             : 
     494             :     // User Info:
     495             : 
     496             :     inline bool HasUserData() const { return m_aUser.isPresent(); }
     497             : 
     498             :     inline bool IsEmptyUser() const
     499             :     { return m_aUser.isPresent() && m_aUser.isEmpty(); }
     500             : 
     501        1476 :     inline rtl::OUString GetUser(DecodeMechanism eMechanism = DECODE_TO_IURI,
     502             :                              rtl_TextEncoding eCharset
     503             :                                  = RTL_TEXTENCODING_UTF8) const
     504        1476 :     { return decode(m_aUser, getEscapePrefix(), eMechanism, eCharset); }
     505             : 
     506        1476 :     inline rtl::OUString GetPass(DecodeMechanism eMechanism = DECODE_TO_IURI,
     507             :                              rtl_TextEncoding eCharset
     508             :                                  = RTL_TEXTENCODING_UTF8) const
     509        1476 :     { return decode(m_aAuth, getEscapePrefix(), eMechanism, eCharset); }
     510             : 
     511             :     inline bool SetUser(const rtl::OString& rTheUser,
     512             :                         EncodeMechanism eMechanism = WAS_ENCODED,
     513             :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     514             :     { return setUser(extend(rTheUser), true, eMechanism, eCharset); }
     515             : 
     516             :     inline bool SetUser(rtl::OUString const & rTheUser,
     517             :                         EncodeMechanism eMechanism = WAS_ENCODED,
     518             :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     519             :     { return setUser(rTheUser, false, eMechanism, eCharset); }
     520             : 
     521             :     inline bool SetPass(const rtl::OString& rThePassword,
     522             :                         EncodeMechanism eMechanism = WAS_ENCODED,
     523             :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     524             : 
     525             :     inline bool SetPass(rtl::OUString const & rThePassword,
     526             :                         EncodeMechanism eMechanism = WAS_ENCODED,
     527             :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     528             : 
     529             :     inline bool SetUserAndPass(const rtl::OString& rTheUser,
     530             :                                const rtl::OString& rThePassword,
     531             :                                EncodeMechanism eMechanism = WAS_ENCODED,
     532             :                                rtl_TextEncoding eCharset
     533             :                                    = RTL_TEXTENCODING_UTF8);
     534             : 
     535             :     inline bool SetUserAndPass(rtl::OUString const & rTheUser,
     536             :                                rtl::OUString const & rThePassword,
     537             :                                EncodeMechanism eMechanism = WAS_ENCODED,
     538             :                                rtl_TextEncoding eCharset
     539             :                                    = RTL_TEXTENCODING_UTF8);
     540             : 
     541             :     // Host and Port:
     542             : 
     543             :     inline bool HasPort() const { return m_aPort.isPresent(); }
     544             : 
     545        1476 :     inline rtl::OUString GetHost(DecodeMechanism eMechanism = DECODE_TO_IURI,
     546             :                              rtl_TextEncoding eCharset
     547             :                                  = RTL_TEXTENCODING_UTF8) const
     548        1476 :     { return decode(m_aHost, getEscapePrefix(), eMechanism, eCharset); }
     549             : 
     550             :     rtl::OUString GetHostPort(DecodeMechanism eMechanism = DECODE_TO_IURI,
     551             :                           rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     552             : 
     553             :     sal_uInt32 GetPort() const;
     554             : 
     555             :     inline bool SetHost(const rtl::OString& rTheHost,
     556             :                         EncodeMechanism eMechanism = WAS_ENCODED,
     557             :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     558             :     { return setHost(extend(rTheHost), true, eMechanism, eCharset); }
     559             : 
     560             :     inline bool SetHost(rtl::OUString const & rTheHost,
     561             :                         EncodeMechanism eMechanism = WAS_ENCODED,
     562             :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     563             :     { return setHost(rTheHost, false, eMechanism, eCharset); }
     564             : 
     565             :     bool SetPort(sal_uInt32 nThePort);
     566             : 
     567             :     // Path:
     568             : 
     569             :     inline bool HasURLPath() const { return !m_aPath.isEmpty(); }
     570             : 
     571        1476 :     inline rtl::OUString GetURLPath(DecodeMechanism eMechanism = DECODE_TO_IURI,
     572             :                                 rtl_TextEncoding eCharset
     573             :                                     = RTL_TEXTENCODING_UTF8) const
     574        1476 :     { return decode(m_aPath, getEscapePrefix(), eMechanism, eCharset); }
     575             : 
     576             :     inline bool SetURLPath(const rtl::OString& rThePath,
     577             :                            EncodeMechanism eMechanism = WAS_ENCODED,
     578             :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     579             :     { return setPath(extend(rThePath), true, eMechanism, eCharset); }
     580             : 
     581             :     inline bool SetURLPath(rtl::OUString const & rThePath,
     582             :                            EncodeMechanism eMechanism = WAS_ENCODED,
     583             :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     584             :     { return setPath(rThePath, false, eMechanism, eCharset); }
     585             : 
     586             :     // Hierarchical Path:
     587             : 
     588             :     /** A constant to address the last segment in various methods dealing with
     589             :         hierarchical paths.
     590             : 
     591             :         @descr  It is often more efficient to address the last segment using
     592             :         this constant, than to determine its ordinal value using
     593             :         getSegmentCount().
     594             :      */
     595             :     enum { LAST_SEGMENT = -1 };
     596             : 
     597             :     /** The number of segments in the hierarchical path.
     598             : 
     599             :         @descr  Using RFC 2396 and RFC 2234, a hierarchical path is of the
     600             :         form
     601             : 
     602             :           hierarchical-path = 1*("/" segment)
     603             : 
     604             :           segment = name *(";" param)
     605             : 
     606             :           name = [base ["." extension]]
     607             : 
     608             :           base = 1*pchar
     609             : 
     610             :           extension = *<any pchar except ".">
     611             : 
     612             :           param = *pchar
     613             : 
     614             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     615             :         hierarchical path does not denote an empty segment, but is ignored.
     616             : 
     617             :         @return  The number of segments in the hierarchical path.  If the path
     618             :         is not hierarchical, 0 is returned.
     619             :      */
     620             :     sal_Int32 getSegmentCount(bool bIgnoreFinalSlash = true) const;
     621             : 
     622             :     /** Remove a segment from the hierarchical path.
     623             : 
     624             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     625             :         if addressing the last segment.
     626             : 
     627             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     628             :         hierarchical path does not denote an empty segment, but is ignored.
     629             : 
     630             :         @return  True if the segment has successfully been removed (and the
     631             :         resulting URI is still valid).  If the path is not hierarchical, or
     632             :         the specified segment does not exist, false is returned.  If false is
     633             :         returned, the object is not modified.
     634             :      */
     635             :     bool removeSegment(sal_Int32 nIndex = LAST_SEGMENT,
     636             :                        bool bIgnoreFinalSlash = true);
     637             : 
     638             :     /** Insert a new segment into the hierarchical path.
     639             : 
     640             :         @param rTheName  The name part of the new segment.  The new segment
     641             :         will contain no parameters.
     642             : 
     643             :         @param bAppendFinalSlash  If the new segment is appended at the end of
     644             :         the hierarchical path, this parameter specifies whether to add a final
     645             :         slash after it or not.
     646             : 
     647             :         @param nIndex  The non-negative index of the segment before which
     648             :         to insert the new segment.  LAST_SEGMENT or an nIndex that equals
     649             :         getSegmentCount() inserts the new segment at the end of the
     650             :         hierarchical path.
     651             : 
     652             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     653             :         hierarchical path does not denote an empty segment, but is ignored.
     654             : 
     655             :         @param eMechanism  See the general discussion for set-methods.
     656             : 
     657             :         @param eCharset  See the general discussion for set-methods.
     658             : 
     659             :         @return  True if the segment has successfully been inserted (and the
     660             :         resulting URI is still valid).  If the path is not hierarchical, or
     661             :         the specified place to insert the new segment does not exist, false is
     662             :         returned.  If false is returned, the object is not modified.
     663             :      */
     664             :     inline bool insertName(rtl::OUString const & rTheName,
     665             :                            bool bAppendFinalSlash = false,
     666             :                            sal_Int32 nIndex = LAST_SEGMENT,
     667             :                            bool bIgnoreFinalSlash = true,
     668             :                            EncodeMechanism eMechanism = WAS_ENCODED,
     669             :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     670             : 
     671             :     /** Get the name of a segment of the hierarchical path.
     672             : 
     673             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     674             :         if addressing the last segment.
     675             : 
     676             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     677             :         hierarchical path does not denote an empty segment, but is ignored.
     678             : 
     679             :         @param eMechanism  See the general discussion for get-methods.
     680             : 
     681             :         @param eCharset  See the general discussion for get-methods.
     682             : 
     683             :         @return  The name part of the specified segment.  If the path is not
     684             :         hierarchical, or the specified segment does not exits, an empty string
     685             :         is returned.
     686             :      */
     687             :     rtl::OUString getName(sal_Int32 nIndex = LAST_SEGMENT,
     688             :                       bool bIgnoreFinalSlash = true,
     689             :                       DecodeMechanism eMechanism = DECODE_TO_IURI,
     690             :                       rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     691             :         const;
     692             : 
     693             :     /** Set the name of a segment (preserving any parameters and any query or
     694             :         fragment part).
     695             : 
     696             :         @param rTheName  The new name.
     697             : 
     698             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     699             :         if addressing the last segment.
     700             : 
     701             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     702             :         hierarchical path does not denote an empty segment, but is ignored.
     703             : 
     704             :         @param eMechanism  See the general discussion for set-methods.
     705             : 
     706             :         @param eCharset  See the general discussion for set-methods.
     707             : 
     708             :         @return  True if the name has successfully been modified (and the
     709             :         resulting URI is still valid).  If the path is not hierarchical, or
     710             :         the specified segment does not exist, false is returned.  If false is
     711             :         returned, the object is not modified.
     712             :      */
     713             :     bool setName(rtl::OUString const & rTheName,
     714             :                  sal_Int32 nIndex = LAST_SEGMENT,
     715             :                  bool bIgnoreFinalSlash = true,
     716             :                  EncodeMechanism eMechanism = WAS_ENCODED,
     717             :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     718             : 
     719             :     /** Get the base of the name of a segment.
     720             : 
     721             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     722             :         if addressing the last segment.
     723             : 
     724             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     725             :         hierarchical path does not denote an empty segment, but is ignored.
     726             : 
     727             :         @param eMechanism  See the general discussion for get-methods.
     728             : 
     729             :         @param eCharset  See the general discussion for get-methods.
     730             : 
     731             :         @return  The base part of the specified segment.  If the path is
     732             :         not hierarchical, or the specified segment does not exits, an empty
     733             :         string is returned.
     734             :      */
     735             :     rtl::OUString getBase(sal_Int32 nIndex = LAST_SEGMENT,
     736             :                       bool bIgnoreFinalSlash = true,
     737             :                       DecodeMechanism eMechanism = DECODE_TO_IURI,
     738             :                       rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     739             :         const;
     740             : 
     741             :     /** Set the base of the name of a segment (preserving the extension).
     742             : 
     743             :         @param rTheBase  The new base.
     744             : 
     745             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     746             :         if addressing the last segment.
     747             : 
     748             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     749             :         hierarchical path does not denote an empty segment, but is ignored.
     750             : 
     751             :         @param eMechanism  See the general discussion for set-methods.
     752             : 
     753             :         @param eCharset  See the general discussion for set-methods.
     754             : 
     755             :         @return  True if the base has successfully been modified (and the
     756             :         resulting URI is still valid).  If the path is not hierarchical, or
     757             :         the specified segment does not exist, false is returned.  If false is
     758             :         returned, the object is not modified.
     759             :      */
     760             :     bool setBase(rtl::OUString const & rTheBase,
     761             :                  sal_Int32 nIndex = LAST_SEGMENT,
     762             :                  bool bIgnoreFinalSlash = true,
     763             :                  EncodeMechanism eMechanism = WAS_ENCODED,
     764             :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     765             : 
     766             :     /** Determine whether the name of a segment has an extension.
     767             : 
     768             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     769             :         if addressing the last segment.
     770             : 
     771             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     772             :         hierarchical path does not denote an empty segment, but is ignored.
     773             : 
     774             :         @return  True if the name of the specified segment has an extension.
     775             :         If the path is not hierarchical, or the specified segment does not
     776             :         exist, false is returned.
     777             :      */
     778             :     bool hasExtension(sal_Int32 nIndex = LAST_SEGMENT,
     779             :                       bool bIgnoreFinalSlash = true) const;
     780             : 
     781             :     /** Get the extension of the name of a segment.
     782             : 
     783             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     784             :         if addressing the last segment.
     785             : 
     786             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     787             :         hierarchical path does not denote an empty segment, but is ignored.
     788             : 
     789             :         @param eMechanism  See the general discussion for get-methods.
     790             : 
     791             :         @param eCharset  See the general discussion for get-methods.
     792             : 
     793             :         @return  The extension part of the specified segment.  If the path is
     794             :         not hierarchical, or the specified segment does not exits, an empty
     795             :         string is returned.
     796             :      */
     797             :     rtl::OUString getExtension(sal_Int32 nIndex = LAST_SEGMENT,
     798             :                            bool bIgnoreFinalSlash = true,
     799             :                            DecodeMechanism eMechanism = DECODE_TO_IURI,
     800             :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     801             :         const;
     802             : 
     803             :     /** Set the extension of the name of a segment (replacing an already
     804             :         existing extension).
     805             : 
     806             :         @param rTheExtension  The new extension.
     807             : 
     808             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     809             :         if addressing the last segment.
     810             : 
     811             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     812             :         hierarchical path does not denote an empty segment, but is ignored.
     813             : 
     814             :         @param eMechanism  See the general discussion for set-methods.
     815             : 
     816             :         @param eCharset  See the general discussion for set-methods.
     817             : 
     818             :         @return  True if the extension has successfully been modified (and the
     819             :         resulting URI is still valid).  If the path is not hierarchical, or
     820             :         the specified segment does not exist, false is returned.  If false is
     821             :         returned, the object is not modified.
     822             :      */
     823             :     bool setExtension(rtl::OUString const & rTheExtension,
     824             :                       sal_Int32 nIndex = LAST_SEGMENT,
     825             :                       bool bIgnoreFinalSlash = true,
     826             :                       EncodeMechanism eMechanism = WAS_ENCODED,
     827             :                       rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     828             : 
     829             :     /** Remove the extension of the name of a segment.
     830             : 
     831             :         @param nIndex  The non-negative index of the segment, or LAST_SEGMENT
     832             :         if addressing the last segment.
     833             : 
     834             :         @param bIgnoreFinalSlash  If true, a final slash at the end of the
     835             :         hierarchical path does not denote an empty segment, but is ignored.
     836             : 
     837             :         @return  True if the extension has successfully been removed (and the
     838             :         resulting URI is still valid), or if the name did not have an
     839             :         extension.  If the path is not hierarchical, or the specified segment
     840             :         does not exist, false is returned.  If false is returned, the object
     841             :         is not modified.
     842             :      */
     843             :     bool removeExtension(sal_Int32 nIndex = LAST_SEGMENT,
     844             :                          bool bIgnoreFinalSlash = true);
     845             : 
     846             :     /** Determine whether the hierarchical path ends in a final slash.
     847             : 
     848             :         @return  True if the hierarchical path ends in a final slash.  If the
     849             :         path is not hierarchical, false is returned.
     850             :      */
     851             :     bool hasFinalSlash() const;
     852             : 
     853             :     /** Make the hierarchical path end in a final slash (if it does not
     854             :         already do so).
     855             : 
     856             :         @return  True if a final slash has successfully been appended (and the
     857             :         resulting URI is still valid), or if the hierarchical path already
     858             :         ended in a final slash.  If the path is not hierarchical, false is
     859             :         returned.  If false is returned, the object is not modified.
     860             :      */
     861             :     bool setFinalSlash();
     862             : 
     863             :     /** Remove a final slash from the hierarchical path.
     864             : 
     865             :         @return  True if a final slash has successfully been removed (and the
     866             :         resulting URI is still valid), or if the hierarchical path already did
     867             :         not end in a final slash.  If the path is not hierarchical, false is
     868             :         returned.  If false is returned, the object is not modified.
     869             :      */
     870             :     bool removeFinalSlash();
     871             : 
     872             :     // Query:
     873             : 
     874        1476 :     inline bool HasParam() const { return m_aQuery.isPresent(); }
     875             : 
     876        1476 :     inline rtl::OUString GetParam(DecodeMechanism eMechanism = DECODE_TO_IURI,
     877             :                               rtl_TextEncoding eCharset
     878             :                                   = RTL_TEXTENCODING_UTF8) const
     879        1476 :     { return decode(m_aQuery, getEscapePrefix(), eMechanism, eCharset); }
     880             : 
     881             :     inline bool SetParam(const rtl::OString& rTheQuery,
     882             :                          EncodeMechanism eMechanism = WAS_ENCODED,
     883             :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     884             : 
     885             :     inline bool SetParam(rtl::OUString const & rTheQuery,
     886             :                          EncodeMechanism eMechanism = WAS_ENCODED,
     887             :                          rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     888             : 
     889             :     // Fragment:
     890             : 
     891             :     inline bool HasMark() const { return m_aFragment.isPresent(); }
     892             : 
     893             :     inline rtl::OUString GetMark(DecodeMechanism eMechanism = DECODE_TO_IURI,
     894             :                              rtl_TextEncoding eCharset
     895             :                                  = RTL_TEXTENCODING_UTF8) const
     896             :     { return decode(m_aFragment, getEscapePrefix(), eMechanism, eCharset); }
     897             : 
     898             :     inline bool SetMark(const rtl::OString& rTheFragment,
     899             :                         EncodeMechanism eMechanism = WAS_ENCODED,
     900             :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     901             : 
     902             :     inline bool SetMark(rtl::OUString const & rTheFragment,
     903             :                         EncodeMechanism eMechanism = WAS_ENCODED,
     904             :                         rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
     905             : 
     906             :     // File URLs:
     907             : 
     908             :     /** Create an INetURLObject from a file system path.
     909             : 
     910             :         @param rFSysPath  A file system path.  An URL is not allowed here!
     911             : 
     912             :         @param eStyle  The notation of rFSysPath.
     913             :      */
     914             :     inline INetURLObject(rtl::OUString const & rFSysPath, FSysStyle eStyle);
     915             : 
     916             :     /** Set this INetURLObject to a file URL constructed from a file system
     917             :         path.
     918             : 
     919             :         @param rFSysPath  A file system path.  An URL is not allowed here!
     920             : 
     921             :         @param eStyle  The notation of rFSysPath.
     922             : 
     923             :         @return  True if this INetURLObject has successfully been changed.  If
     924             :         false is returned, this INetURLObject has not been modified.
     925             :      */
     926             :     bool setFSysPath(rtl::OUString const & rFSysPath, FSysStyle eStyle);
     927             : 
     928             :     /** Return the file system path represented by a file URL (ignoring any
     929             :         fragment part).
     930             : 
     931             :         @param eStyle  The notation of the returned file system path.
     932             : 
     933             :         @param pDelimiter  Upon successful return, this parameter can return
     934             :         the character that is the 'main' delimiter within the returned file
     935             :         system path (e.g., "/" for Unix, "\" for DOS, ":" for Mac).  This is
     936             :         especially useful for routines that later try to shorten the returned
     937             :         file system path at a 'good' position, e.g. to fit it into some
     938             :         limited display space.
     939             : 
     940             :         @return  The file system path represented by this file URL.  If this
     941             :         file URL does not represent a file system path according to the
     942             :         specified notation, or if this is not a file URL at all, an empty
     943             :         string is returned.
     944             :      */
     945             :     rtl::OUString getFSysPath(FSysStyle eStyle, sal_Unicode * pDelimiter = 0)
     946             :         const;
     947             : 
     948             :     // POP3 and URLs:
     949             : 
     950             :     rtl::OUString GetMsgId(DecodeMechanism eMechanism = DECODE_TO_IURI,
     951             :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
     952             :         const;
     953             : 
     954             :     // Coding:
     955             : 
     956             :     enum Part
     957             :     {
     958             :         PART_OBSOLETE_NORMAL = 0x001, // Obsolete, do not use!
     959             :         PART_OBSOLETE_FILE = 0x002, // Obsolete, do not use!
     960             :         PART_OBSOLETE_PARAM = 0x004, // Obsolete, do not use!
     961             :         PART_USER_PASSWORD = 0x008,
     962             :         PART_IMAP_ACHAR = 0x010,
     963             :         PART_VIM = 0x020,
     964             :         PART_HOST_EXTRA = 0x040,
     965             :         PART_FPATH = 0x080,
     966             :         PART_AUTHORITY = 0x100,
     967             :         PART_PATH_SEGMENTS_EXTRA = 0x200,
     968             :         PART_REL_SEGMENT_EXTRA = 0x400,
     969             :         PART_URIC = 0x800,
     970             :         PART_HTTP_PATH = 0x1000,
     971             :         PART_FILE_SEGMENT_EXTRA = 0x2000, // Obsolete, do not use!
     972             :         PART_MESSAGE_ID = 0x4000,
     973             :         PART_MESSAGE_ID_PATH = 0x8000,
     974             :         PART_MAILTO = 0x10000,
     975             :         PART_PATH_BEFORE_QUERY = 0x20000,
     976             :         PART_PCHAR = 0x40000,
     977             :         PART_FRAGMENT = 0x80000, // Obsolete, do not use!
     978             :         PART_VISIBLE = 0x100000,
     979             :         PART_VISIBLE_NONSPECIAL = 0x200000,
     980             :         PART_CREATEFRAGMENT = 0x400000,
     981             :         PART_UNO_PARAM_VALUE = 0x800000,
     982             :         PART_UNAMBIGUOUS = 0x1000000,
     983             :         PART_URIC_NO_SLASH = 0x2000000,
     984             :         PART_HTTP_QUERY = 0x4000000, //TODO! unused?
     985             :         PART_NEWS_ARTICLE_LOCALPART = 0x8000000,
     986             :         max_part = 0x80000000
     987             :             // Do not use!  Only there to allow compatible changes in the
     988             :             // future.
     989             :     };
     990             : 
     991             :     enum EscapeType
     992             :     {
     993             :         ESCAPE_NO,
     994             :         ESCAPE_OCTET,
     995             :         ESCAPE_UTF32
     996             :     };
     997             : 
     998             :     /** Encode some text as part of a URI.
     999             : 
    1000             :         @param rText  Some text (for its interpretation, see the general
    1001             :         discussion for set-methods).
    1002             : 
    1003             :         @param ePart  The part says which characters are 'forbidden' and must
    1004             :         be encoded (replaced by escape sequences).  Characters outside the US-
    1005             :         ASCII range are always 'forbidden.'
    1006             : 
    1007             :         @param cEscapePrefix  The first character in an escape sequence
    1008             :         (normally '%').
    1009             : 
    1010             :         @param eMechanism  See the general discussion for set-methods.
    1011             : 
    1012             :         @param eCharset  See the general discussion for set-methods.
    1013             : 
    1014             :         @return  The encoded representation of the text ('forbidden'
    1015             :         characters replaced by escape sequences).
    1016             :      */
    1017             :     static inline rtl::OUString encode(const rtl::OString& rText, Part ePart,
    1018             :                                    sal_Char cEscapePrefix,
    1019             :                                    EncodeMechanism eMechanism,
    1020             :                                    rtl_TextEncoding eCharset
    1021             :                                        = RTL_TEXTENCODING_UTF8);
    1022             : 
    1023             :     /** Encode some text as part of a URI.
    1024             : 
    1025             :         @param rText  Some text (for its interpretation, see the general
    1026             :         discussion for set-methods).
    1027             : 
    1028             :         @param ePart  The part says which characters are 'forbidden' and must
    1029             :         be encoded (replaced by escape sequences).  Characters outside the US-
    1030             :         ASCII range are always 'forbidden.'
    1031             : 
    1032             :         @param cEscapePrefix  The first character in an escape sequence
    1033             :         (normally '%').
    1034             : 
    1035             :         @param eMechanism  See the general discussion for set-methods.
    1036             : 
    1037             :         @param eCharset  See the general discussion for set-methods.
    1038             : 
    1039             :         @return  The text, encoded according to the given mechanism and
    1040             :         charset ('forbidden' characters replaced by escape sequences).
    1041             :      */
    1042             :     static inline rtl::OUString encode(rtl::OUString const & rText, Part ePart,
    1043             :                                    sal_Char cEscapePrefix,
    1044             :                                    EncodeMechanism eMechanism,
    1045             :                                    rtl_TextEncoding eCharset
    1046             :                                        = RTL_TEXTENCODING_UTF8);
    1047             : 
    1048             :     /** Decode some text.
    1049             : 
    1050             :         @param rText  Some (encoded) text.
    1051             : 
    1052             :         @param cEscapePrefix  The first character in an escape sequence
    1053             :         (normally '%').
    1054             : 
    1055             :         @param eMechanism  See the general discussion for get-methods.
    1056             : 
    1057             :         @param eCharset  See the general discussion for get-methods.
    1058             : 
    1059             :         @return  The text, decoded according to the given mechanism and
    1060             :         charset (escape sequences replaced by 'raw' characters).
    1061             :      */
    1062             :     static inline rtl::OUString decode(rtl::OUString const & rText,
    1063             :                                    sal_Char cEscapePrefix,
    1064             :                                    DecodeMechanism eMechanism,
    1065             :                                    rtl_TextEncoding eCharset
    1066             :                                        = RTL_TEXTENCODING_UTF8);
    1067             : 
    1068             :     static inline rtl::OUString decode(rtl::OUStringBuffer const & rText,
    1069             :                                    sal_Char cEscapePrefix,
    1070             :                                    DecodeMechanism eMechanism,
    1071             :                                    rtl_TextEncoding eCharset
    1072             :                                        = RTL_TEXTENCODING_UTF8);
    1073             : 
    1074             :     static void appendUCS4Escape(rtl::OUStringBuffer & rTheText,
    1075             :                                  sal_Char cEscapePrefix,
    1076             :                                  sal_uInt32 nUCS4);
    1077             : 
    1078             :     static void appendUCS4(rtl::OUStringBuffer & rTheText, sal_uInt32 nUCS4,
    1079             :                            EscapeType eEscapeType, bool bOctets, Part ePart,
    1080             :                            sal_Char cEscapePrefix, rtl_TextEncoding eCharset,
    1081             :                            bool bKeepVisibleEscapes);
    1082             : 
    1083             :     static sal_uInt32 getUTF32(sal_Unicode const *& rBegin,
    1084             :                                sal_Unicode const * pEnd, bool bOctets,
    1085             :                                sal_Char cEscapePrefix,
    1086             :                                EncodeMechanism eMechanism,
    1087             :                                rtl_TextEncoding eCharset,
    1088             :                                EscapeType & rEscapeType);
    1089             : 
    1090             :     // Specialized helpers:
    1091             : 
    1092             :     static sal_uInt32 scanDomain(sal_Unicode const *& rBegin,
    1093             :                                  sal_Unicode const * pEnd,
    1094             :                                  bool bEager = true);
    1095             : 
    1096             :     // OBSOLETE Hierarchical Path:
    1097             : 
    1098             :     rtl::OUString GetPartBeforeLastName(DecodeMechanism eMechanism
    1099             :                                         = DECODE_TO_IURI,
    1100             :                                     rtl_TextEncoding eCharset
    1101             :                                         = RTL_TEXTENCODING_UTF8) const;
    1102             : 
    1103             :     /** Get the last segment in the path.
    1104             : 
    1105             :         @param eMechanism  See the general discussion for get-methods.
    1106             : 
    1107             :         @param eCharset  See the general discussion for get-methods.
    1108             : 
    1109             :         @return  For a hierarchical URL, the last segment (everything after
    1110             :         the last unencoded '/').  Not that this last segment may be empty.  If
    1111             :         the URL is not hierarchical, an empty string is returned.
    1112             :      */
    1113             :     rtl::OUString GetLastName(DecodeMechanism eMechanism = DECODE_TO_IURI,
    1114             :                           rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
    1115             :         const;
    1116             : 
    1117             :     /** Get the 'extension' of the last segment in the path.
    1118             : 
    1119             :         @param eMechanism  See the general discussion for get-methods.
    1120             : 
    1121             :         @param eCharset  See the general discussion for get-methods.
    1122             : 
    1123             :         @return  For a hierarchical URL, everything after the first unencoded
    1124             :         '.' in the last segment of the path.  Note that this 'extension' may
    1125             :         be empty.  If the URL is not hierarchical, or if the last segment does
    1126             :         not contain an unencoded '.', an empty string is returned.
    1127             :      */
    1128             :     rtl::OUString GetFileExtension(DecodeMechanism eMechanism = DECODE_TO_IURI,
    1129             :                                rtl_TextEncoding eCharset
    1130             :                                    = RTL_TEXTENCODING_UTF8) const;
    1131             : 
    1132             :     inline bool Append(const rtl::OString& rTheSegment,
    1133             :                        EncodeMechanism eMechanism = WAS_ENCODED,
    1134             :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
    1135             :     { return appendSegment(extend(rTheSegment), true, eMechanism, eCharset); }
    1136             : 
    1137             :     inline bool Append(rtl::OUString const & rTheSegment,
    1138             :                        EncodeMechanism eMechanism = WAS_ENCODED,
    1139             :                        rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
    1140             :     { return appendSegment(rTheSegment, false, eMechanism, eCharset); }
    1141             : 
    1142             :     bool CutLastName();
    1143             : 
    1144             :     // OBSOLETE File URLs:
    1145             : 
    1146             :     rtl::OUString PathToFileName() const;
    1147             : 
    1148             :     rtl::OUString GetFull() const;
    1149             : 
    1150             :     rtl::OUString GetPath() const;
    1151             : 
    1152             :     void SetBase(rtl::OUString const & rTheBase);
    1153             : 
    1154             :     rtl::OUString GetBase() const;
    1155             : 
    1156             :     void SetName(rtl::OUString const & rTheName,
    1157             :                  EncodeMechanism eMechanism = WAS_ENCODED,
    1158             :                  rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
    1159             : 
    1160             :     inline rtl::OUString GetName(DecodeMechanism eMechanism = DECODE_TO_IURI,
    1161             :                              rtl_TextEncoding eCharset
    1162             :                                  = RTL_TEXTENCODING_UTF8) const
    1163             :     { return GetLastName(eMechanism, eCharset); }
    1164             : 
    1165             :     void SetExtension(rtl::OUString const & rTheExtension,
    1166             :                       EncodeMechanism eMechanism = WAS_ENCODED,
    1167             :                       rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
    1168             : 
    1169             :     inline rtl::OUString GetExtension(
    1170             :                                   DecodeMechanism eMechanism = DECODE_TO_IURI,
    1171             :                                   rtl_TextEncoding eCharset
    1172             :                                       = RTL_TEXTENCODING_UTF8) const
    1173             :     { return GetFileExtension(eMechanism, eCharset); }
    1174             : 
    1175             :     rtl::OUString CutExtension(DecodeMechanism eMechanism = DECODE_TO_IURI,
    1176             :                            rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
    1177             : 
    1178             :     bool IsCaseSensitive() const;
    1179             : 
    1180             : 
    1181             : private:
    1182             :     // General Structure:
    1183             : 
    1184             :     class SubString
    1185             :     {
    1186             :         sal_Int32 m_nBegin;
    1187             :         sal_Int32 m_nLength;
    1188             : 
    1189             :     public:
    1190       41504 :         explicit inline SubString(sal_Int32 nTheBegin = -1,
    1191             :                                   sal_Int32 nTheLength = 0):
    1192       41504 :             m_nBegin(nTheBegin), m_nLength(nTheLength) {}
    1193             : 
    1194       31590 :         inline bool isPresent() const { return m_nBegin != -1; }
    1195             : 
    1196       28441 :         inline bool isEmpty() const { return m_nLength == 0; }
    1197             : 
    1198       32768 :         inline sal_Int32 getBegin() const { return m_nBegin; }
    1199             : 
    1200       26584 :         inline sal_Int32 getLength() const { return m_nLength; }
    1201             : 
    1202        5825 :         inline sal_Int32 getEnd() const { return m_nBegin + m_nLength; }
    1203             : 
    1204             :         inline sal_Int32 clear();
    1205             : 
    1206             :         inline sal_Int32 set(rtl::OUStringBuffer & rString,
    1207             :                              rtl::OUString const & rSubString,
    1208             :                              sal_Int32 nTheBegin);
    1209             : 
    1210             :         inline sal_Int32 set(rtl::OUString & rString,
    1211             :                              rtl::OUString const & rSubString);
    1212             : 
    1213             :         inline sal_Int32 set(rtl::OUStringBuffer & rString,
    1214             :                              rtl::OUString const & rSubString);
    1215             : 
    1216             :         inline void operator +=(sal_Int32 nDelta);
    1217             : 
    1218             :         int compare(SubString const & rOther,
    1219             :             rtl::OUStringBuffer const & rThisString,
    1220             :             rtl::OUStringBuffer const & rOtherString) const;
    1221             :     };
    1222             : 
    1223             :     rtl::OUStringBuffer m_aAbsURIRef;
    1224             :     SubString m_aScheme;
    1225             :     SubString m_aUser;
    1226             :     SubString m_aAuth;
    1227             :     SubString m_aHost;
    1228             :     SubString m_aPort;
    1229             :     SubString m_aPath;
    1230             :     SubString m_aQuery;
    1231             :     SubString m_aFragment;
    1232             :     INetProtocol m_eScheme;
    1233             :     INetProtocol m_eSmartScheme;
    1234             : 
    1235             :     TOOLS_DLLPRIVATE void setInvalid();
    1236             : 
    1237             :     bool setAbsURIRef(
    1238             :         rtl::OUString const & rTheAbsURIRef, bool bOctets,
    1239             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bSmart,
    1240             :         FSysStyle eStyle);
    1241             : 
    1242             :     // Relative URLs:
    1243             : 
    1244             :     bool convertRelToAbs(
    1245             :         rtl::OUString const & rTheRelURIRef, bool bOctets,
    1246             :         INetURLObject & rTheAbsURIRef, bool & rWasAbsolute,
    1247             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
    1248             :         bool bIgnoreFragment, bool bSmart, bool bRelativeNonURIs,
    1249             :         FSysStyle eStyle) const;
    1250             : 
    1251             :     bool convertAbsToRel(
    1252             :         rtl::OUString const & rTheAbsURIRef, bool bOctets,
    1253             :         rtl::OUString & rTheRelURIRef, EncodeMechanism eEncodeMechanism,
    1254             :         DecodeMechanism eDecodeMechanism, rtl_TextEncoding eCharset,
    1255             :         FSysStyle eStyle) const;
    1256             : 
    1257             :     // External URLs:
    1258             : 
    1259             :     static bool convertIntToExt(
    1260             :         rtl::OUString const & rTheIntURIRef, bool bOctets,
    1261             :         rtl::OUString & rTheExtURIRef, DecodeMechanism eDecodeMechanism,
    1262             :         rtl_TextEncoding eCharset);
    1263             : 
    1264             :     static bool convertExtToInt(
    1265             :         rtl::OUString const & rTheExtURIRef, bool bOctets,
    1266             :         rtl::OUString & rTheIntURIRef, DecodeMechanism eDecodeMechanism,
    1267             :         rtl_TextEncoding eCharset);
    1268             : 
    1269             :     // Scheme:
    1270             : 
    1271             :     struct PrefixInfo;
    1272             : 
    1273             :     TOOLS_DLLPRIVATE static inline SchemeInfo const & getSchemeInfo(
    1274             :         INetProtocol eTheScheme);
    1275             : 
    1276             :     TOOLS_DLLPRIVATE inline SchemeInfo const & getSchemeInfo() const;
    1277             : 
    1278             :     TOOLS_DLLPRIVATE static PrefixInfo const * getPrefix(
    1279             :         sal_Unicode const *& rBegin, sal_Unicode const * pEnd);
    1280             : 
    1281             :     // Authority:
    1282             : 
    1283             :     TOOLS_DLLPRIVATE sal_Int32 getAuthorityBegin() const;
    1284             : 
    1285             :     TOOLS_DLLPRIVATE SubString getAuthority() const;
    1286             : 
    1287             :     // User Info:
    1288             : 
    1289             :     bool setUser(
    1290             :         rtl::OUString const & rTheUser, bool bOctets,
    1291             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1292             : 
    1293             :     bool clearPassword();
    1294             : 
    1295             :     bool setPassword(
    1296             :         rtl::OUString const & rThePassword, bool bOctets,
    1297             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1298             : 
    1299             :     // Host and Port:
    1300             : 
    1301             :     TOOLS_DLLPRIVATE static bool parseHost(
    1302             :         sal_Unicode const *& rBegin, sal_Unicode const * pEnd,
    1303             :         rtl::OUString & rCanonic);
    1304             : 
    1305             :     TOOLS_DLLPRIVATE static bool parseHostOrNetBiosName(
    1306             :         sal_Unicode const * pBegin, sal_Unicode const * pEnd, bool bOctets,
    1307             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset,
    1308             :         bool bNetBiosName, rtl::OUStringBuffer* pCanonic);
    1309             : 
    1310             :     bool setHost(
    1311             :         rtl::OUString const & rTheHost, bool bOctets,
    1312             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1313             : 
    1314             :     // Path:
    1315             : 
    1316             :     TOOLS_DLLPRIVATE static bool parsePath(
    1317             :         INetProtocol eScheme, sal_Unicode const ** pBegin,
    1318             :         sal_Unicode const * pEnd, bool bOctets, EncodeMechanism eMechanism,
    1319             :         rtl_TextEncoding eCharset, bool bSkippedInitialSlash,
    1320             :         sal_uInt32 nSegmentDelimiter, sal_uInt32 nAltSegmentDelimiter,
    1321             :         sal_uInt32 nQueryDelimiter, sal_uInt32 nFragmentDelimiter,
    1322             :         rtl::OUStringBuffer &rSynPath);
    1323             : 
    1324             :     bool setPath(
    1325             :         rtl::OUString const & rThePath, bool bOctets,
    1326             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1327             : 
    1328             :     // Hierarchical Path:
    1329             : 
    1330             :     TOOLS_DLLPRIVATE bool checkHierarchical() const;
    1331             : 
    1332             :     bool appendSegment(
    1333             :         rtl::OUString const & rTheSegment, bool bOctets,
    1334             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1335             : 
    1336             :     TOOLS_DLLPRIVATE SubString getSegment(
    1337             :         sal_Int32 nIndex, bool bIgnoreFinalSlash) const;
    1338             : 
    1339             :     bool insertName(
    1340             :         rtl::OUString const & rTheName, bool bOctets, bool bAppendFinalSlash,
    1341             :         sal_Int32 nIndex, bool bIgnoreFinalSlash, EncodeMechanism eMechanism,
    1342             :         rtl_TextEncoding eCharset);
    1343             : 
    1344             :     // Query:
    1345             : 
    1346             :     bool clearQuery();
    1347             : 
    1348             :     bool setQuery(
    1349             :         rtl::OUString const & rTheQuery, bool bOctets,
    1350             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1351             : 
    1352             :     // Fragment:
    1353             : 
    1354             :     bool clearFragment();
    1355             : 
    1356             :     bool setFragment(
    1357             :         rtl::OUString const & rTheMark, bool bOctets,
    1358             :         EncodeMechanism eMechanism, rtl_TextEncoding eCharset);
    1359             : 
    1360             :     // FILE URLs:
    1361             : 
    1362             :     TOOLS_DLLPRIVATE bool hasDosVolume(FSysStyle eStyle) const;
    1363             : 
    1364             :     // Coding:
    1365             : 
    1366           0 :     static inline rtl::OUString extend(const rtl::OString& rOctets)
    1367             :     {
    1368           0 :         return rtl::OStringToOUString(rOctets, RTL_TEXTENCODING_ISO_8859_1);
    1369             :     }
    1370             : 
    1371       57672 :     static inline sal_Char getEscapePrefix(INetProtocol eTheScheme)
    1372       57672 :     { return eTheScheme == INET_PROT_VIM ? '=' : '%'; }
    1373             : 
    1374       57672 :     inline sal_Char getEscapePrefix() const
    1375       57672 :     { return getEscapePrefix(m_eScheme); }
    1376             : 
    1377             :     TOOLS_DLLPRIVATE static inline void appendEscape(
    1378             :         rtl::OUStringBuffer & rTheText, sal_Char cEscapePrefix,
    1379             :         sal_uInt32 nOctet);
    1380             : 
    1381             :     static rtl::OUString encodeText(
    1382             :         sal_Unicode const * pBegin, sal_Unicode const * pEnd, bool bOctets,
    1383             :         Part ePart, sal_Char cEscapePrefix, EncodeMechanism eMechanism,
    1384             :         rtl_TextEncoding eCharset, bool bKeepVisibleEscapes);
    1385             : 
    1386             :     static inline rtl::OUString encodeText(
    1387             :         rtl::OUString const & rTheText, bool bOctets, Part ePart,
    1388             :         sal_Char cEscapePrefix, EncodeMechanism eMechanism,
    1389             :         rtl_TextEncoding eCharset, bool bKeepVisibleEscapes);
    1390             : 
    1391             :     static rtl::OUString decode(
    1392             :         sal_Unicode const * pBegin, sal_Unicode const * pEnd,
    1393             :         sal_Char cEscapePrefix, DecodeMechanism, rtl_TextEncoding eCharset);
    1394             : 
    1395             :     inline rtl::OUString decode(
    1396             :         SubString const & rSubString, sal_Char cEscapePrefix,
    1397             :         DecodeMechanism eMechanism, rtl_TextEncoding eCharset) const;
    1398             : 
    1399             :     // Specialized helpers:
    1400             : 
    1401             :     TOOLS_DLLPRIVATE static bool scanIPv6reference(
    1402             :         sal_Unicode const *& rBegin, sal_Unicode const * pEnd);
    1403             : 
    1404             : private:
    1405             :     void changeScheme(INetProtocol eTargetScheme);
    1406             : };
    1407             : 
    1408             : // static
    1409        2182 : inline rtl::OUString INetURLObject::encodeText(rtl::OUString const & rTheText,
    1410             :                                            bool bOctets, Part ePart,
    1411             :                                            sal_Char cEscapePrefix,
    1412             :                                            EncodeMechanism eMechanism,
    1413             :                                            rtl_TextEncoding eCharset,
    1414             :                                            bool bKeepVisibleEscapes)
    1415             : {
    1416             :     return encodeText(rTheText.getStr(),
    1417        2182 :                       rTheText.getStr() + rTheText.getLength(), bOctets, ePart,
    1418             :                       cEscapePrefix, eMechanism, eCharset,
    1419        4364 :                       bKeepVisibleEscapes);
    1420             : }
    1421             : 
    1422        7380 : inline rtl::OUString INetURLObject::decode(SubString const & rSubString,
    1423             :                                        sal_Char cEscapePrefix,
    1424             :                                        DecodeMechanism eMechanism,
    1425             :                                        rtl_TextEncoding eCharset) const
    1426             : {
    1427        7380 :     return rSubString.isPresent() ?
    1428        2952 :                decode(m_aAbsURIRef.getStr() + rSubString.getBegin(),
    1429        2952 :                       m_aAbsURIRef.getStr() + rSubString.getEnd(),
    1430             :                       cEscapePrefix, eMechanism, eCharset) :
    1431       13284 :                rtl::OUString();
    1432             : }
    1433             : 
    1434           0 : inline INetURLObject::INetURLObject(const rtl::OString& rTheAbsURIRef,
    1435             :                                     EncodeMechanism eMechanism,
    1436             :                                     rtl_TextEncoding eCharset):
    1437           0 :     m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP)
    1438             : {
    1439             :     setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset, false,
    1440           0 :                  FSysStyle(0));
    1441           0 : }
    1442             : 
    1443          42 : inline INetURLObject::INetURLObject(rtl::OUString const & rTheAbsURIRef,
    1444             :                                     EncodeMechanism eMechanism,
    1445             :                                     rtl_TextEncoding eCharset):
    1446          42 :     m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP)
    1447             : {
    1448             :     setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, false,
    1449          42 :                  FSysStyle(0));
    1450          42 : }
    1451             : 
    1452             : inline bool INetURLObject::SetURL(const rtl::OString& rTheAbsURIRef,
    1453             :                                   EncodeMechanism eMechanism,
    1454             :                                   rtl_TextEncoding eCharset)
    1455             : {
    1456             :     return setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset,
    1457             :                         false, FSysStyle(0));
    1458             : }
    1459             : 
    1460             : inline bool INetURLObject::SetURL(rtl::OUString const & rTheAbsURIRef,
    1461             :                                   EncodeMechanism eMechanism,
    1462             :                                   rtl_TextEncoding eCharset)
    1463             : {
    1464             :     return setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, false,
    1465             :                         FSysStyle(0));
    1466             : }
    1467             : 
    1468             : inline INetURLObject::INetURLObject(rtl::OUString const & rTheAbsURIRef,
    1469             :                                     INetProtocol eTheSmartScheme,
    1470             :                                     EncodeMechanism eMechanism,
    1471             :                                     rtl_TextEncoding eCharset,
    1472             :                                     FSysStyle eStyle):
    1473             :     m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(eTheSmartScheme)
    1474             : {
    1475             :     setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, true, eStyle);
    1476             : }
    1477             : 
    1478             : inline bool INetURLObject::SetSmartURL(const rtl::OString& rTheAbsURIRef,
    1479             :                                        EncodeMechanism eMechanism,
    1480             :                                        rtl_TextEncoding eCharset,
    1481             :                                        FSysStyle eStyle)
    1482             : {
    1483             :     return setAbsURIRef(extend(rTheAbsURIRef), true, eMechanism, eCharset,
    1484             :                         true, eStyle);
    1485             : }
    1486             : 
    1487             : inline bool INetURLObject::SetSmartURL(rtl::OUString const & rTheAbsURIRef,
    1488             :                                        EncodeMechanism eMechanism,
    1489             :                                        rtl_TextEncoding eCharset,
    1490             :                                        FSysStyle eStyle)
    1491             : {
    1492             :     return setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, true,
    1493             :                         eStyle);
    1494             : }
    1495             : 
    1496             : inline INetURLObject
    1497             : INetURLObject::smartRel2Abs(const rtl::OString& rTheRelURIRef,
    1498             :                             bool & rWasAbsolute,
    1499             :                             bool bIgnoreFragment,
    1500             :                             EncodeMechanism eMechanism,
    1501             :                             rtl_TextEncoding eCharset,
    1502             :                             bool bRelativeNonURIs,
    1503             :                             FSysStyle eStyle) const
    1504             : {
    1505             :     INetURLObject aTheAbsURIRef;
    1506             :     convertRelToAbs(extend(rTheRelURIRef), true, aTheAbsURIRef, rWasAbsolute,
    1507             :                     eMechanism, eCharset, bIgnoreFragment, true,
    1508             :                     bRelativeNonURIs, eStyle);
    1509             :     return aTheAbsURIRef;
    1510             : }
    1511             : 
    1512             : inline INetURLObject
    1513             : INetURLObject::smartRel2Abs(rtl::OUString const & rTheRelURIRef,
    1514             :                             bool & rWasAbsolute,
    1515             :                             bool bIgnoreFragment,
    1516             :                             EncodeMechanism eMechanism,
    1517             :                             rtl_TextEncoding eCharset,
    1518             :                             bool bRelativeNonURIs,
    1519             :                             FSysStyle eStyle) const
    1520             : {
    1521             :     INetURLObject aTheAbsURIRef;
    1522             :     convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, rWasAbsolute,
    1523             :                     eMechanism, eCharset, bIgnoreFragment, true,
    1524             :                     bRelativeNonURIs, eStyle);
    1525             :     return aTheAbsURIRef;
    1526             : }
    1527             : 
    1528             : inline bool INetURLObject::GetNewAbsURL(const rtl::OString& rTheRelURIRef,
    1529             :                                         INetURLObject * pTheAbsURIRef,
    1530             :                                         EncodeMechanism eMechanism,
    1531             :                                         rtl_TextEncoding eCharset,
    1532             :                                         FSysStyle eStyle, bool bIgnoreFragment)
    1533             :     const
    1534             : {
    1535             :     INetURLObject aTheAbsURIRef;
    1536             :     bool bWasAbsolute;
    1537             :     if (!convertRelToAbs(extend(rTheRelURIRef), true, aTheAbsURIRef,
    1538             :                          bWasAbsolute, eMechanism, eCharset, bIgnoreFragment,
    1539             :                          false, false, eStyle))
    1540             :         return false;
    1541             :     if (pTheAbsURIRef)
    1542             :         *pTheAbsURIRef = aTheAbsURIRef;
    1543             :     return true;
    1544             : }
    1545             : 
    1546             : inline bool INetURLObject::GetNewAbsURL(rtl::OUString const & rTheRelURIRef,
    1547             :                                         INetURLObject * pTheAbsURIRef,
    1548             :                                         EncodeMechanism eMechanism,
    1549             :                                         rtl_TextEncoding eCharset,
    1550             :                                         FSysStyle eStyle, bool bIgnoreFragment)
    1551             :     const
    1552             : {
    1553             :     INetURLObject aTheAbsURIRef;
    1554             :     bool bWasAbsolute;
    1555             :     if (!convertRelToAbs(rTheRelURIRef, false, aTheAbsURIRef, bWasAbsolute,
    1556             :                          eMechanism, eCharset, bIgnoreFragment, false, false,
    1557             :                          eStyle))
    1558             :         return false;
    1559             :     if (pTheAbsURIRef)
    1560             :         *pTheAbsURIRef = aTheAbsURIRef;
    1561             :     return true;
    1562             : }
    1563             : 
    1564             : // static
    1565             : inline rtl::OUString INetURLObject::GetRelURL(const rtl::OString& rTheBaseURIRef,
    1566             :                                           const rtl::OString& rTheAbsURIRef,
    1567             :                                           EncodeMechanism eEncodeMechanism,
    1568             :                                           DecodeMechanism eDecodeMechanism,
    1569             :                                           rtl_TextEncoding eCharset,
    1570             :                                           FSysStyle eStyle)
    1571             : {
    1572             :     rtl::OUString aTheRelURIRef;
    1573             :     INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset).
    1574             :         convertAbsToRel(extend(rTheAbsURIRef), true, aTheRelURIRef,
    1575             :                         eEncodeMechanism, eDecodeMechanism, eCharset, eStyle);
    1576             :     return aTheRelURIRef;
    1577             : }
    1578             : 
    1579             : // static
    1580             : inline rtl::OUString INetURLObject::GetRelURL(rtl::OUString const & rTheBaseURIRef,
    1581             :                                           rtl::OUString const & rTheAbsURIRef,
    1582             :                                           EncodeMechanism eEncodeMechanism,
    1583             :                                           DecodeMechanism eDecodeMechanism,
    1584             :                                           rtl_TextEncoding eCharset,
    1585             :                                           FSysStyle eStyle)
    1586             : {
    1587             :     rtl::OUString aTheRelURIRef;
    1588             :     INetURLObject(rTheBaseURIRef, eEncodeMechanism, eCharset).
    1589             :         convertAbsToRel(rTheAbsURIRef, false, aTheRelURIRef, eEncodeMechanism,
    1590             :                         eDecodeMechanism, eCharset, eStyle);
    1591             :     return aTheRelURIRef;
    1592             : }
    1593             : 
    1594             : // static
    1595             : inline bool INetURLObject::translateToExternal(const rtl::OString& rTheIntURIRef,
    1596             :                                                rtl::OUString & rTheExtURIRef,
    1597             :                                                DecodeMechanism
    1598             :                                                    eDecodeMechanism,
    1599             :                                                rtl_TextEncoding eCharset)
    1600             : {
    1601             :     rtl::OUString aTheExtURIRef;
    1602             :     bool bRet = convertIntToExt(extend(rTheIntURIRef), true, aTheExtURIRef,
    1603             :                                 eDecodeMechanism, eCharset);
    1604             :     rTheExtURIRef = aTheExtURIRef;
    1605             :     return bRet;
    1606             : }
    1607             : 
    1608             : // static
    1609           0 : inline bool INetURLObject::translateToExternal(rtl::OUString const &
    1610             :                                                    rTheIntURIRef,
    1611             :                                                rtl::OUString & rTheExtURIRef,
    1612             :                                                DecodeMechanism
    1613             :                                                    eDecodeMechanism,
    1614             :                                                rtl_TextEncoding eCharset)
    1615             : {
    1616             :     return convertIntToExt(rTheIntURIRef, false, rTheExtURIRef,
    1617           0 :                            eDecodeMechanism, eCharset);
    1618             : }
    1619             : 
    1620             : // static
    1621             : inline bool INetURLObject::translateToInternal(const rtl::OString&
    1622             :                                                    rTheExtURIRef,
    1623             :                                                rtl::OUString & rTheIntURIRef,
    1624             :                                                DecodeMechanism
    1625             :                                                    eDecodeMechanism,
    1626             :                                                rtl_TextEncoding eCharset)
    1627             : {
    1628             :     rtl::OUString aTheIntURIRef;
    1629             :     bool bRet = convertExtToInt(extend(rTheExtURIRef), true, aTheIntURIRef,
    1630             :                            eDecodeMechanism, eCharset);
    1631             :     rTheIntURIRef = aTheIntURIRef;
    1632             :     return bRet;
    1633             : }
    1634             : 
    1635             : // static
    1636             : inline bool INetURLObject::translateToInternal(rtl::OUString const &
    1637             :                                                    rTheExtURIRef,
    1638             :                                                rtl::OUString & rTheIntURIRef,
    1639             :                                                DecodeMechanism
    1640             :                                                    eDecodeMechanism,
    1641             :                                                rtl_TextEncoding eCharset)
    1642             : {
    1643             :     return convertExtToInt(rTheExtURIRef, false, rTheIntURIRef,
    1644             :                            eDecodeMechanism, eCharset);
    1645             : }
    1646             : 
    1647             : inline bool INetURLObject::SetPass(const rtl::OString& rThePassword,
    1648             :                                    EncodeMechanism eMechanism,
    1649             :                                    rtl_TextEncoding eCharset)
    1650             : {
    1651             :     return rThePassword.isEmpty() ?
    1652             :                clearPassword() :
    1653             :                setPassword(extend(rThePassword), true, eMechanism, eCharset);
    1654             : }
    1655             : 
    1656             : inline bool INetURLObject::SetPass(rtl::OUString const & rThePassword,
    1657             :                                    EncodeMechanism eMechanism,
    1658             :                                    rtl_TextEncoding eCharset)
    1659             : {
    1660             :     return rThePassword.isEmpty() ?
    1661             :                clearPassword() :
    1662             :                setPassword(rThePassword, false, eMechanism, eCharset);
    1663             : }
    1664             : 
    1665             : inline bool INetURLObject::SetUserAndPass(const rtl::OString& rTheUser,
    1666             :                                           const rtl::OString& rThePassword,
    1667             :                                           EncodeMechanism eMechanism,
    1668             :                                           rtl_TextEncoding eCharset)
    1669             : {
    1670             :     return setUser(extend(rTheUser), true, eMechanism, eCharset)
    1671             :            && (rThePassword.isEmpty() ?
    1672             :                    clearPassword() :
    1673             :                    setPassword(extend(rThePassword), true, eMechanism,
    1674             :                                eCharset));
    1675             : }
    1676             : 
    1677             : inline bool INetURLObject::SetUserAndPass(rtl::OUString const & rTheUser,
    1678             :                                           rtl::OUString const & rThePassword,
    1679             :                                           EncodeMechanism eMechanism,
    1680             :                                           rtl_TextEncoding eCharset)
    1681             : {
    1682             :     return setUser(rTheUser, false, eMechanism, eCharset)
    1683             :            && (rThePassword.isEmpty() ?
    1684             :                    clearPassword() :
    1685             :                    setPassword(rThePassword, false, eMechanism, eCharset));
    1686             : }
    1687             : 
    1688           0 : inline bool INetURLObject::insertName(rtl::OUString const & rTheName,
    1689             :                                       bool bAppendFinalSlash,
    1690             :                                       sal_Int32 nIndex,
    1691             :                                       bool bIgnoreFinalSlash,
    1692             :                                       EncodeMechanism eMechanism,
    1693             :                                       rtl_TextEncoding eCharset)
    1694             : {
    1695             :     return insertName(rTheName, false, bAppendFinalSlash, nIndex,
    1696           0 :                       bIgnoreFinalSlash, eMechanism, eCharset);
    1697             : }
    1698             : 
    1699             : inline bool INetURLObject::SetParam(const rtl::OString& rTheQuery,
    1700             :                                     EncodeMechanism eMechanism,
    1701             :                                     rtl_TextEncoding eCharset)
    1702             : {
    1703             :     return rTheQuery.isEmpty() ?
    1704             :                clearQuery() :
    1705             :                setQuery(extend(rTheQuery), true, eMechanism, eCharset);
    1706             : }
    1707             : 
    1708             : inline bool INetURLObject::SetParam(rtl::OUString const & rTheQuery,
    1709             :                                     EncodeMechanism eMechanism,
    1710             :                                     rtl_TextEncoding eCharset)
    1711             : {
    1712             :     return rTheQuery.isEmpty() ?
    1713             :                clearQuery() :
    1714             :                setQuery(rTheQuery, false, eMechanism, eCharset);
    1715             : }
    1716             : 
    1717             : inline bool INetURLObject::SetMark(const rtl::OString& rTheFragment,
    1718             :                                    EncodeMechanism eMechanism,
    1719             :                                    rtl_TextEncoding eCharset)
    1720             : {
    1721             :     return rTheFragment.isEmpty() ?
    1722             :                clearFragment() :
    1723             :                setFragment(extend(rTheFragment), true, eMechanism, eCharset);
    1724             : }
    1725             : 
    1726             : inline bool INetURLObject::SetMark(rtl::OUString const & rTheFragment,
    1727             :                                    EncodeMechanism eMechanism,
    1728             :                                    rtl_TextEncoding eCharset)
    1729             : {
    1730             :     return rTheFragment.isEmpty() ?
    1731             :                clearFragment() :
    1732             :                setFragment(rTheFragment, false, eMechanism, eCharset);
    1733             : }
    1734             : 
    1735             : inline INetURLObject::INetURLObject(rtl::OUString const & rFSysPath,
    1736             :                                     FSysStyle eStyle):
    1737             :     m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP)
    1738             : {
    1739             :     setFSysPath(rFSysPath, eStyle);
    1740             : }
    1741             : 
    1742             : // static
    1743             : inline rtl::OUString INetURLObject::encode(const rtl::OString& rText, Part ePart,
    1744             :                                        sal_Char cEscapePrefix,
    1745             :                                        EncodeMechanism eMechanism,
    1746             :                                        rtl_TextEncoding eCharset)
    1747             : {
    1748             :     return encodeText(extend(rText), true, ePart, cEscapePrefix, eMechanism,
    1749             :                       eCharset, false);
    1750             : }
    1751             : 
    1752             : // static
    1753             : inline rtl::OUString INetURLObject::encode(rtl::OUString const & rText, Part ePart,
    1754             :                                        sal_Char cEscapePrefix,
    1755             :                                        EncodeMechanism eMechanism,
    1756             :                                        rtl_TextEncoding eCharset)
    1757             : {
    1758             :     return encodeText(rText, false, ePart, cEscapePrefix, eMechanism,
    1759             :                       eCharset, false);
    1760             : }
    1761             : 
    1762             : // static
    1763           0 : inline rtl::OUString INetURLObject::decode(rtl::OUString const & rText,
    1764             :                                        sal_Char cEscapePrefix,
    1765             :                                        DecodeMechanism eMechanism,
    1766             :                                        rtl_TextEncoding eCharset)
    1767             : {
    1768           0 :     return decode(rText.getStr(), rText.getStr() + rText.getLength(),
    1769           0 :                   cEscapePrefix, eMechanism, eCharset);
    1770             : }
    1771             : 
    1772         667 : inline rtl::OUString INetURLObject::decode(rtl::OUStringBuffer const & rText,
    1773             :                                        sal_Char cEscapePrefix,
    1774             :                                        DecodeMechanism eMechanism,
    1775             :                                        rtl_TextEncoding eCharset)
    1776             : {
    1777         667 :     return decode(rText.getStr(), rText.getStr() + rText.getLength(),
    1778        1334 :                   cEscapePrefix, eMechanism, eCharset);
    1779             : }
    1780             : 
    1781             : #endif
    1782             : 
    1783             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10