24 #include <tqvaluelist.h>
25 #include "kdelibs_export.h"
29 template <
typename K,
typename V>
class TQMap;
34 #define KURL_TRIPLE_SLASH_FILE_PROT
146 StripFileProtocol = 1
187 class KDECORE_EXPORT
List :
public TQValueList<KURL>
212 List(
const TQStringList &list);
226 TQStringList toStringList()
const;
260 KURL(
const TQString& url,
int encoding_hint = 0 );
286 KURL(
const char * url,
int encoding_hint = 0 );
312 KURL(
const TQCString& url,
int encoding_hint = 0 );
327 KURL(
const TQUrl &u );
353 KURL(
const KURL& _baseurl,
const TQString& _rel_url,
int encoding_hint=0 );
367 TQString
protocol()
const {
return m_bIsMalformed ? TQString::null : m_strProtocol; }
378 void setProtocol(
const TQString& _txt );
401 TQString
user()
const {
return m_strUser; }
415 void setUser(
const TQString& _txt );
425 bool hasUser()
const {
return !m_strUser.isEmpty(); }
440 TQString
pass()
const {
return m_strPass; }
454 void setPass(
const TQString& _txt );
467 bool hasPass()
const {
return !m_strPass.isEmpty(); }
477 TQString
host()
const {
return m_strHost; }
489 void setHost(
const TQString& _txt );
498 bool hasHost()
const {
return !m_strHost.isEmpty(); }
509 unsigned short int port()
const {
return m_iPort; }
518 void setPort(
unsigned short int _p );
532 TQString
path()
const {
return m_strPath; }
563 TQString path(
int _trailing )
const;
581 void setPath(
const TQString& path );
591 bool hasPath()
const {
return !m_strPath.isEmpty(); }
606 void cleanPath(
bool cleanDirSeparator =
true);
630 void adjustPath(
int _trailing);
647 void setEncodedPathAndQuery(
const TQString& _txt,
int encoding_hint = 0 );
659 void setEncodedPath(
const TQString& _txt,
int encoding_hint = 0 );
691 TQString encodedPathAndQuery(
int _trailing = 0,
bool _no_empty_path =
false,
int encoding_hint = 0)
const;
706 void setQuery(
const TQString& _txt,
int encoding_hint = 0);
720 TQString query()
const;
733 TQString
ref()
const {
return m_strRef_encoded; }
746 void setRef(
const TQString& _txt ) { m_strRef_encoded = _txt; }
758 bool hasRef()
const {
return !m_strRef_encoded.isNull(); }
773 TQString htmlRef()
const;
785 TQString encodedHtmlRef()
const;
796 void setHTMLRef(
const TQString& _ref );
808 bool hasHTMLRef()
const;
816 bool isValid()
const {
return !m_bIsMalformed; }
835 bool isLocalFile()
const;
849 void setFileEncoding(
const TQString &encoding);
859 TQString fileEncoding()
const;
870 bool hasSubURL()
const;
886 void addPath(
const TQString& txt );
901 TQString queryItem(
const TQString& item )
const;
918 TQString queryItem(
const TQString& item,
int encoding_hint )
const;
930 CaseInsensitiveKeys = 1
936 TQMap< TQString, TQString > queryItems(
int options=0 )
const;
955 TQMap< TQString, TQString > queryItems(
int options,
int encoding_hint )
const;
972 void addQueryItem(
const TQString& _item,
const TQString& _value,
int encoding_hint = 0 );
984 void removeQueryItem(
const TQString& _item );
1006 void setFileName(
const TQString&_txt );
1025 TQString fileName(
bool _ignore_trailing_slash_in_path =
true )
const;
1053 TQString directory(
bool _strip_trailing_slash_from_result =
true,
1054 bool _ignore_trailing_slash_in_path =
true )
const;
1065 void setDirectory(
const TQString &dir);
1085 bool cd(
const TQString& _dir );
1122 TQString url(
int _trailing = 0,
int encoding_hint = 0)
const;
1156 TQString prettyURL(
int _trailing = 0)
const;
1193 TQString prettyURL(
int _trailing, AdjustementFlags _flags)
const;
1215 TQString pathOrURL()
const;
1228 TQString htmlURL()
const;
1242 bool isEmpty()
const;
1263 KURL upURL( )
const;
1316 bool operator<(
const KURL& _u)
const;
1344 KURL& operator=(
const TQString& _url );
1359 KURL& operator=(
const char * _url );
1373 KURL& operator=(
const TQUrl & u );
1394 bool operator==(
const KURL& _u )
const;
1416 bool operator==(
const TQString& _u )
const;
1444 bool operator!=(
const TQString& _u )
const {
return !( *
this == _u ); }
1461 bool cmp(
const KURL &u,
bool ignore_trailing =
false ) const KDE_DEPRECATED;
1476 bool equals( const
KURL &u,
bool ignore_trailing = false ) const;
1489 bool isParentOf( const
KURL& u ) const;
1517 static List split( const TQString& _url );
1544 static List split( const
KURL& _url );
1559 static
KURL join( const List& _list );
1582 static
KURL fromPathOrURL( const TQString& text );
1601 static TQString encode_string(const TQString &str,
int encoding_hint = 0);
1619 static TQString encode_string_no_slash(const TQString &str,
int encoding_hint = 0);
1639 static TQString decode_string(const TQString &str,
int encoding_hint = 0);
1655 static
bool isRelativeURL(const TQString &_url);
1680 static TQString relativeURL(const
KURL &base_url, const
KURL &url,
int encoding_hint = 0);
1696 static TQString relativePath(const TQString &base_dir, const TQString &path,
bool *isParent=0);
1710 static URIMode uriModeForProtocol(const TQString& protocol);
1712 #ifdef KDE_NO_COMPAT
1718 TQString
filename(
bool _ignore_trailing_slash_in_path =
true )
const
1720 return fileName(_ignore_trailing_slash_in_path);
1750 void parseURL(
const TQString& _url,
int encoding_hint = 0 );
1760 void parseRawURI(
const TQString& _url,
int encoding_hint = 0 );
1770 void parseMailto(
const TQString& _url,
int encoding_hint = 0 );
1778 void parse(
const TQString& _url,
int encoding_hint = 0 );
1781 void _setQuery(
const TQString& _txt,
int encoding_hint = 0);
1783 TQString m_strProtocol;
1788 TQString m_strRef_encoded;
1789 TQString m_strQuery_encoded;
1790 bool m_bIsMalformed : 1;
1791 enum URIMode m_iUriMode : 3;
1792 uint freeForUse : 4;
1793 unsigned short int m_iPort;
1794 TQString m_strPath_encoded;
1796 friend KDECORE_EXPORT TQDataStream & operator<< (TQDataStream & s,
const KURL & a);
1797 friend KDECORE_EXPORT TQDataStream & operator>> (TQDataStream & s,
KURL & a);
1809 KDECORE_EXPORT
bool urlcmp(
const TQString& _url1,
const TQString& _url2 );
1823 KDECORE_EXPORT
bool urlcmp(
const TQString& _url1,
const TQString& _url2,
bool _ignore_trailing,
bool _ignore_ref );
1825 KDECORE_EXPORT TQDataStream & operator<< (TQDataStream & s,
const KURL & a);
1826 KDECORE_EXPORT TQDataStream & operator>> (TQDataStream & s,
KURL & a);
Represents and parses a URL.
void setRef(const TQString &_txt)
Sets the encoded reference part (everything after '#')
bool hasRef() const
Tests if the URL has a reference part.
TQString ref() const
Returns the encoded reference of the URL.
URIMode
Defines the type of URI we are processing.
TQString protocol() const
Returns the protocol for the URL.
bool hasPass() const
Tests if this URL has a password included in it.
QueryItemsOptions
Options for queryItems()
TQString filename(bool _ignore_trailing_slash_in_path=true) const
KDE_DEPRECATED bool isMalformed() const
Tests if the URL is malformed.
unsigned short int port() const
Returns the port number included in the URL.
bool hasHost() const
Tests if this URL has a hostname included in it.
AdjustementFlags
Flags to choose how file: URLs are treated when creating their QString representation with prettyURL(...
TQString host() const
Returns the decoded hostname included in the URL.
bool hasPath() const
Tests if this URL has a path included in it.
TQString user() const
Returns the decoded user name (login, user id, etc) included in the URL.
bool hasUser() const
Tests if this URL has a user name included in it.
bool urlcmp(const TQString &_url1, const TQString &_url2)
bool operator!=(const KURL &_u) const
Tests if this URL is different from the given one.
bool operator!=(const TQString &_u) const
Tests if this URL is different from the one given as a string.
TQString path() const
Returns the current decoded path.
KURL::List is a TQValueList that contains KURLs with a few convenience methods.
List()
Creates an empty List.
TQString pass() const
Returns the decoded password (corresponding to user()) included in the URL.
bool isValid() const
Tests if the URL is well formed.