24 #include <tqvaluelist.h>
25 #include "tdelibs_export.h"
29 template <
typename K,
typename V>
class TQMap;
34 #define KURL_TRIPLE_SLASH_FILE_PROT
146 StripFileProtocol = 1
187 class TDECORE_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(); }
596 void setInternalReferenceURL(
const TQString& url );
601 TQString internalReferenceURL(
void )
const;
616 void cleanPath(
bool cleanDirSeparator =
true);
640 void adjustPath(
int _trailing);
657 void setEncodedPathAndQuery(
const TQString& _txt,
int encoding_hint = 0 );
669 void setEncodedPath(
const TQString& _txt,
int encoding_hint = 0 );
701 TQString encodedPathAndQuery(
int _trailing = 0,
bool _no_empty_path =
false,
int encoding_hint = 0)
const;
716 void setQuery(
const TQString& _txt,
int encoding_hint = 0);
730 TQString query()
const;
743 TQString
ref()
const {
return m_strRef_encoded; }
756 void setRef(
const TQString& _txt ) { m_strRef_encoded = _txt; }
768 bool hasRef()
const {
return !m_strRef_encoded.isNull(); }
783 TQString htmlRef()
const;
795 TQString encodedHtmlRef()
const;
806 void setHTMLRef(
const TQString& _ref );
818 bool hasHTMLRef()
const;
826 bool isValid()
const {
return !m_bIsMalformed; }
845 bool isLocalFile()
const;
859 void setFileEncoding(
const TQString &encoding);
869 TQString fileEncoding()
const;
880 bool hasSubURL()
const;
896 void addPath(
const TQString& txt );
911 TQString queryItem(
const TQString& item )
const;
928 TQString queryItem(
const TQString& item,
int encoding_hint )
const;
940 CaseInsensitiveKeys = 1
946 TQMap< TQString, TQString > queryItems(
int options=0 )
const;
965 TQMap< TQString, TQString > queryItems(
int options,
int encoding_hint )
const;
982 void addQueryItem(
const TQString& _item,
const TQString& _value,
int encoding_hint = 0 );
994 void removeQueryItem(
const TQString& _item );
1016 void setFileName(
const TQString&_txt );
1035 TQString fileName(
bool _ignore_trailing_slash_in_path =
true )
const;
1063 TQString directory(
bool _strip_trailing_slash_from_result =
true,
1064 bool _ignore_trailing_slash_in_path =
true )
const;
1075 void setDirectory(
const TQString &dir);
1095 bool cd(
const TQString& _dir );
1132 TQString url(
int _trailing = 0,
int encoding_hint = 0)
const;
1166 TQString prettyURL(
int _trailing = 0)
const;
1203 TQString prettyURL(
int _trailing, AdjustementFlags _flags)
const;
1225 TQString pathOrURL()
const;
1238 TQString htmlURL()
const;
1252 bool isEmpty()
const;
1273 KURL upURL( )
const;
1326 bool operator<(
const KURL& _u)
const;
1354 KURL& operator=(
const TQString& _url );
1369 KURL& operator=(
const char * _url );
1383 KURL& operator=(
const TQUrl & u );
1404 bool operator==(
const KURL& _u )
const;
1426 bool operator==(
const TQString& _u )
const;
1454 bool operator!=(
const TQString& _u )
const {
return !( *
this == _u ); }
1471 bool cmp(
const KURL &u,
bool ignore_trailing =
false ) const TDE_DEPRECATED;
1486 bool equals( const
KURL &u,
bool ignore_trailing = false ) const;
1502 bool equals( const
KURL &u,
bool ignore_trailing,
bool ignore_internalReferenceURLS ) const;
1515 bool isParentOf( const
KURL& u ) const;
1543 static List split( const TQString& _url );
1570 static List split( const
KURL& _url );
1585 static
KURL join( const List& _list );
1608 static
KURL fromPathOrURL( const TQString& text );
1627 static TQString encode_string(const TQString &str,
int encoding_hint = 0);
1645 static TQString encode_string_no_slash(const TQString &str,
int encoding_hint = 0);
1665 static TQString decode_string(const TQString &str,
int encoding_hint = 0);
1681 static
bool isRelativeURL(const TQString &_url);
1706 static TQString relativeURL(const
KURL &base_url, const
KURL &url,
int encoding_hint = 0);
1722 static TQString relativePath(const TQString &base_dir, const TQString &path,
bool *isParent=0);
1736 static URIMode uriModeForProtocol(const TQString& protocol);
1738 #ifdef KDE_NO_COMPAT
1744 TQString
filename(
bool _ignore_trailing_slash_in_path =
true )
const
1746 return fileName(_ignore_trailing_slash_in_path);
1776 void parseURL(
const TQString& _url,
int encoding_hint = 0 );
1786 void parseRawURI(
const TQString& _url,
int encoding_hint = 0 );
1796 void parseMailto(
const TQString& _url,
int encoding_hint = 0 );
1804 void parse(
const TQString& _url,
int encoding_hint = 0 );
1807 void _setQuery(
const TQString& _txt,
int encoding_hint = 0);
1809 TQString m_strProtocol;
1814 TQString m_strRef_encoded;
1815 TQString m_strQuery_encoded;
1816 bool m_bIsMalformed : 1;
1817 enum URIMode m_iUriMode : 3;
1818 uint freeForUse : 4;
1819 unsigned short int m_iPort;
1820 TQString m_strPath_encoded;
1822 friend TDECORE_EXPORT TQDataStream & operator<< (TQDataStream & s,
const KURL & a);
1823 friend TDECORE_EXPORT TQDataStream & operator>> (TQDataStream & s,
KURL & a);
1835 TDECORE_EXPORT
bool urlcmp(
const TQString& _url1,
const TQString& _url2 );
1849 TDECORE_EXPORT
bool urlcmp(
const TQString& _url1,
const TQString& _url2,
bool _ignore_trailing,
bool _ignore_ref );
1851 TDECORE_EXPORT TQDataStream & operator<< (TQDataStream & s,
const KURL & a);
1852 TDECORE_EXPORT TQDataStream & operator>> (TQDataStream & s,
KURL & a);
KURL::List is a TQValueList that contains KURLs with a few convenience methods.
List()
Creates an empty List.
Represents and parses a URL.
TQString path() const
Returns the current decoded path.
bool urlcmp(const TQString &_url1, const TQString &_url2)
Compares URLs.
TQString user() const
Returns the decoded user name (login, user id, etc) included in the URL.
bool operator!=(const TQString &_u) const
Tests if this URL is different from the one given as a string.
unsigned short int port() const
Returns the port number included in the URL.
AdjustementFlags
Flags to choose how file: URLs are treated when creating their TQString representation with prettyURL...
void setRef(const TQString &_txt)
Sets the encoded reference part (everything after '#')
TQString protocol() const
Returns the protocol for the URL.
bool hasHost() const
Tests if this URL has a hostname included in it.
bool hasPass() const
Tests if this URL has a password included in it.
bool hasUser() const
Tests if this URL has a user name included in it.
bool hasPath() const
Tests if this URL has a path included in it.
TDE_DEPRECATED bool isMalformed() const
Tests if the URL is malformed.
QueryItemsOptions
Options for queryItems()
TQString host() const
Returns the decoded hostname included in the URL.
TQString pass() const
Returns the decoded password (corresponding to user()) included in the URL.
TQString filename(bool _ignore_trailing_slash_in_path=true) const
TQString ref() const
Returns the encoded reference of the URL.
URIMode
Defines the type of URI we are processing.
@ URL
Standards compliant URL.
@ Auto
Automatically detected.
bool operator!=(const KURL &_u) const
Tests if this URL is different from the given one.
bool isValid() const
Tests if the URL is well formed.
bool hasRef() const
Tests if the URL has a reference part.