| 1 | /**************************************************************************** | 
|---|
| 2 | ** $Id: qurl.h 2 2005-11-16 15:49:26Z dmik $ | 
|---|
| 3 | ** | 
|---|
| 4 | ** Definition of QUrl class | 
|---|
| 5 | ** | 
|---|
| 6 | ** Created : 950429 | 
|---|
| 7 | ** | 
|---|
| 8 | ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved. | 
|---|
| 9 | ** | 
|---|
| 10 | ** This file is part of the kernel module of the Qt GUI Toolkit. | 
|---|
| 11 | ** | 
|---|
| 12 | ** This file may be distributed under the terms of the Q Public License | 
|---|
| 13 | ** as defined by Trolltech AS of Norway and appearing in the file | 
|---|
| 14 | ** LICENSE.QPL included in the packaging of this file. | 
|---|
| 15 | ** | 
|---|
| 16 | ** This file may be distributed and/or modified under the terms of the | 
|---|
| 17 | ** GNU General Public License version 2 as published by the Free Software | 
|---|
| 18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 
|---|
| 19 | ** packaging of this file. | 
|---|
| 20 | ** | 
|---|
| 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 
|---|
| 22 | ** licenses may use this file in accordance with the Qt Commercial License | 
|---|
| 23 | ** Agreement provided with the Software. | 
|---|
| 24 | ** | 
|---|
| 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 
|---|
| 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 
|---|
| 27 | ** | 
|---|
| 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 
|---|
| 29 | **   information about Qt Commercial License Agreements. | 
|---|
| 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 
|---|
| 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 
|---|
| 32 | ** | 
|---|
| 33 | ** Contact info@trolltech.com if any conditions of this licensing are | 
|---|
| 34 | ** not clear to you. | 
|---|
| 35 | ** | 
|---|
| 36 | **********************************************************************/ | 
|---|
| 37 |  | 
|---|
| 38 | #ifndef QURL_H | 
|---|
| 39 | #define QURL_H | 
|---|
| 40 |  | 
|---|
| 41 | #ifndef QT_H | 
|---|
| 42 | #include "qstring.h" | 
|---|
| 43 | #endif // QT_H | 
|---|
| 44 |  | 
|---|
| 45 | #ifndef QT_NO_URL | 
|---|
| 46 |  | 
|---|
| 47 | class QUrlPrivate; | 
|---|
| 48 |  | 
|---|
| 49 | class Q_EXPORT QUrl | 
|---|
| 50 | { | 
|---|
| 51 | public: | 
|---|
| 52 | QUrl(); | 
|---|
| 53 | QUrl( const QString& url ); | 
|---|
| 54 | QUrl( const QUrl& url ); | 
|---|
| 55 | QUrl( const QUrl& url, const QString& relUrl, bool checkSlash = FALSE ); | 
|---|
| 56 | virtual ~QUrl(); | 
|---|
| 57 |  | 
|---|
| 58 | QString protocol() const; | 
|---|
| 59 | virtual void setProtocol( const QString& protocol ); | 
|---|
| 60 |  | 
|---|
| 61 | QString user() const; | 
|---|
| 62 | virtual void setUser( const QString& user ); | 
|---|
| 63 | bool hasUser() const; | 
|---|
| 64 |  | 
|---|
| 65 | QString password() const; | 
|---|
| 66 | virtual void setPassword( const QString& pass ); | 
|---|
| 67 | bool hasPassword() const; | 
|---|
| 68 |  | 
|---|
| 69 | QString host() const; | 
|---|
| 70 | virtual void setHost( const QString& user ); | 
|---|
| 71 | bool hasHost() const; | 
|---|
| 72 |  | 
|---|
| 73 | int port() const; | 
|---|
| 74 | virtual void setPort( int port ); | 
|---|
| 75 | bool hasPort() const; | 
|---|
| 76 |  | 
|---|
| 77 | QString path( bool correct = TRUE ) const; | 
|---|
| 78 | virtual void setPath( const QString& path ); | 
|---|
| 79 | bool hasPath() const; | 
|---|
| 80 |  | 
|---|
| 81 | virtual void setEncodedPathAndQuery( const QString& enc ); | 
|---|
| 82 | QString encodedPathAndQuery(); | 
|---|
| 83 |  | 
|---|
| 84 | virtual void setQuery( const QString& txt ); | 
|---|
| 85 | QString query() const; | 
|---|
| 86 |  | 
|---|
| 87 | QString ref() const; | 
|---|
| 88 | virtual void setRef( const QString& txt ); | 
|---|
| 89 | bool hasRef() const; | 
|---|
| 90 |  | 
|---|
| 91 | bool isValid() const; | 
|---|
| 92 | bool isLocalFile() const; | 
|---|
| 93 |  | 
|---|
| 94 | virtual void addPath( const QString& path ); | 
|---|
| 95 | virtual void setFileName( const QString& txt ); | 
|---|
| 96 |  | 
|---|
| 97 | QString fileName() const; | 
|---|
| 98 | QString dirPath() const; | 
|---|
| 99 |  | 
|---|
| 100 | QUrl& operator=( const QUrl& url ); | 
|---|
| 101 | QUrl& operator=( const QString& url ); | 
|---|
| 102 |  | 
|---|
| 103 | bool operator==( const QUrl& url ) const; | 
|---|
| 104 | bool operator==( const QString& url ) const; | 
|---|
| 105 |  | 
|---|
| 106 | static void decode( QString& url ); | 
|---|
| 107 | static void encode( QString& url ); | 
|---|
| 108 |  | 
|---|
| 109 | operator QString() const; | 
|---|
| 110 | virtual QString toString( bool encodedPath = FALSE, bool forcePrependProtocol = TRUE ) const; | 
|---|
| 111 |  | 
|---|
| 112 | virtual bool cdUp(); | 
|---|
| 113 |  | 
|---|
| 114 | static bool isRelativeUrl( const QString &url ); | 
|---|
| 115 |  | 
|---|
| 116 | protected: | 
|---|
| 117 | virtual void reset(); | 
|---|
| 118 | virtual bool parse( const QString& url ); | 
|---|
| 119 |  | 
|---|
| 120 | private: | 
|---|
| 121 | QUrlPrivate *d; | 
|---|
| 122 |  | 
|---|
| 123 | }; | 
|---|
| 124 |  | 
|---|
| 125 | #endif //QT_NO_URL | 
|---|
| 126 |  | 
|---|
| 127 | #endif | 
|---|