author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kurl.h | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | microkde/kurl.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/microkde/kurl.h b/microkde/kurl.h index cd65a1c..016eb24 100644 --- a/microkde/kurl.h +++ b/microkde/kurl.h | |||
@@ -8,35 +8,37 @@ | |||
8 | * | 8 | * |
9 | * This library is distributed in the hope that it will be useful, | 9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. | 12 | * Library General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU Library General Public License | 14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this library; see the file COPYING.LIB. If not, write to | 15 | * along with this library; see the file COPYING.LIB. If not, write to |
16 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | * Boston, MA 02111-1307, USA. | 17 | * Boston, MA 02111-1307, USA. |
18 | **/ | 18 | **/ |
19 | 19 | ||
20 | #ifndef __kurl_h__ | 20 | #ifndef __kurl_h__ |
21 | #define __kurl_h__ "$Id$" | 21 | #define __kurl_h__ "$Id$" |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qvaluelist.h> | 24 | #include <q3valuelist.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3CString> | ||
25 | 27 | ||
26 | class QUrl; | 28 | class Q3Url; |
27 | class QStringList; | 29 | class QStringList; |
28 | template <typename K, typename V> class QMap; | 30 | template <typename K, typename V> class QMap; |
29 | 31 | ||
30 | class KURLPrivate; | 32 | class KURLPrivate; |
31 | /** | 33 | /** |
32 | * Represents and parses a URL. | 34 | * Represents and parses a URL. |
33 | * | 35 | * |
34 | * A prototypical URL looks like: | 36 | * A prototypical URL looks like: |
35 | * <pre> | 37 | * <pre> |
36 | * protocol:/user:password\@hostname:port/path/to/file.ext#reference | 38 | * protocol:/user:password\@hostname:port/path/to/file.ext#reference |
37 | * </pre> | 39 | * </pre> |
38 | * | 40 | * |
39 | * KURL has some restrictions regarding the path | 41 | * KURL has some restrictions regarding the path |
40 | * encoding. KURL works internally with the decoded path and | 42 | * encoding. KURL works internally with the decoded path and |
41 | * and encoded query. For example, | 43 | * and encoded query. For example, |
42 | * <pre> | 44 | * <pre> |
@@ -51,33 +53,33 @@ class KURLPrivate; | |||
51 | */ | 53 | */ |
52 | class KURL | 54 | class KURL |
53 | { | 55 | { |
54 | public: | 56 | public: |
55 | enum AdjustementFlags | 57 | enum AdjustementFlags |
56 | { | 58 | { |
57 | NoAdjustements = 0, | 59 | NoAdjustements = 0, |
58 | StripFileProtocol = 1 | 60 | StripFileProtocol = 1 |
59 | }; | 61 | }; |
60 | 62 | ||
61 | /** | 63 | /** |
62 | * KURL::List is a QValueList that contains KURLs with a few | 64 | * KURL::List is a QValueList that contains KURLs with a few |
63 | * convenience methods. | 65 | * convenience methods. |
64 | * @see KURL | 66 | * @see KURL |
65 | * @see QValueList | 67 | * @see QValueList |
66 | */ | 68 | */ |
67 | class List : public QValueList<KURL> | 69 | class List : public Q3ValueList<KURL> |
68 | { | 70 | { |
69 | public: | 71 | public: |
70 | /** | 72 | /** |
71 | * Creates an empty List. | 73 | * Creates an empty List. |
72 | */ | 74 | */ |
73 | List() { } | 75 | List() { } |
74 | /** | 76 | /** |
75 | * Creates a list that contains the given URL as only | 77 | * Creates a list that contains the given URL as only |
76 | * item. | 78 | * item. |
77 | * @param url the url to add. | 79 | * @param url the url to add. |
78 | */ | 80 | */ |
79 | List(const KURL &url); | 81 | List(const KURL &url); |
80 | /** | 82 | /** |
81 | * Creates a list that contains the URLs from the given | 83 | * Creates a list that contains the URLs from the given |
82 | * list. | 84 | * list. |
83 | * @param list the list containing the URLs as strings | 85 | * @param list the list containing the URLs as strings |
@@ -122,43 +124,43 @@ public: | |||
122 | * then URL, in its encoded form, is strictly ascii. | 124 | * then URL, in its encoded form, is strictly ascii. |
123 | * @param url A encoded URL. If the URL does not have a protocol part, | 125 | * @param url A encoded URL. If the URL does not have a protocol part, |
124 | * "file:" is assumed. | 126 | * "file:" is assumed. |
125 | * @param encoding_hint MIB of original encoding of URL. | 127 | * @param encoding_hint MIB of original encoding of URL. |
126 | * @see QTextCodec::mibEnum() | 128 | * @see QTextCodec::mibEnum() |
127 | */ | 129 | */ |
128 | KURL( const char * url, int encoding_hint = 0 ); | 130 | KURL( const char * url, int encoding_hint = 0 ); |
129 | /** | 131 | /** |
130 | * Constructor taking a QCString @p url, which is an _encoded_ representation | 132 | * Constructor taking a QCString @p url, which is an _encoded_ representation |
131 | * of the URL, exactly like the usual constructor. This is useful when | 133 | * of the URL, exactly like the usual constructor. This is useful when |
132 | * then URL, in its encoded form, is strictly ascii. | 134 | * then URL, in its encoded form, is strictly ascii. |
133 | * @param url A encoded URL. If the URL does not have a protocol part, | 135 | * @param url A encoded URL. If the URL does not have a protocol part, |
134 | * "file:" is assumed. | 136 | * "file:" is assumed. |
135 | * @param encoding_hint MIB of original encoding of URL. | 137 | * @param encoding_hint MIB of original encoding of URL. |
136 | * @see QTextCodec::mibEnum() | 138 | * @see QTextCodec::mibEnum() |
137 | */ | 139 | */ |
138 | KURL( const QCString& url, int encoding_hint = 0 ); | 140 | KURL( const Q3CString& url, int encoding_hint = 0 ); |
139 | /** | 141 | /** |
140 | * Copy constructor. | 142 | * Copy constructor. |
141 | * @param u the KURL to copy | 143 | * @param u the KURL to copy |
142 | */ | 144 | */ |
143 | KURL( const KURL& u ); | 145 | KURL( const KURL& u ); |
144 | /** | 146 | /** |
145 | * Converts from a @ref QUrl. | 147 | * Converts from a @ref QUrl. |
146 | * @param u the QUrl | 148 | * @param u the QUrl |
147 | */ | 149 | */ |
148 | KURL( const QUrl &u ); | 150 | KURL( const Q3Url &u ); |
149 | /** | 151 | /** |
150 | * Constructor allowing relative URLs. | 152 | * Constructor allowing relative URLs. |
151 | * | 153 | * |
152 | * @param _baseurl The base url. | 154 | * @param _baseurl The base url. |
153 | * @param _rel_url A relative or absolute URL. | 155 | * @param _rel_url A relative or absolute URL. |
154 | * If this is an absolute URL then @p _baseurl will be ignored. | 156 | * If this is an absolute URL then @p _baseurl will be ignored. |
155 | * If this is a relative URL it will be combined with @p _baseurl. | 157 | * If this is a relative URL it will be combined with @p _baseurl. |
156 | * Note that _rel_url should be encoded too, in any case. | 158 | * Note that _rel_url should be encoded too, in any case. |
157 | * So do NOT pass a path here (use setPath or addPath instead). | 159 | * So do NOT pass a path here (use setPath or addPath instead). |
158 | * @param encoding_hint MIB of original encoding of URL. | 160 | * @param encoding_hint MIB of original encoding of URL. |
159 | * @see QTextCodec::mibEnum() | 161 | * @see QTextCodec::mibEnum() |
160 | */ | 162 | */ |
161 | KURL( const KURL& _baseurl, const QString& _rel_url, int encoding_hint=0 ); | 163 | KURL( const KURL& _baseurl, const QString& _rel_url, int encoding_hint=0 ); |
162 | 164 | ||
163 | /** | 165 | /** |
164 | * Returns the protocol for the URL (i.e., file, http, etc.). | 166 | * Returns the protocol for the URL (i.e., file, http, etc.). |
@@ -645,33 +647,33 @@ public: | |||
645 | **/ | 647 | **/ |
646 | bool isEmpty() const; | 648 | bool isEmpty() const; |
647 | 649 | ||
648 | /** | 650 | /** |
649 | * This function is useful to implement the "Up" button in a file manager for example. | 651 | * This function is useful to implement the "Up" button in a file manager for example. |
650 | * @ref cd() never strips a sub-protocol. That means that if you are in | 652 | * @ref cd() never strips a sub-protocol. That means that if you are in |
651 | * file:/home/x.tgz#gzip:/#tar:/ and hit the up button you expect to see | 653 | * file:/home/x.tgz#gzip:/#tar:/ and hit the up button you expect to see |
652 | * file:/home. The algorithm tries to go up on the right-most URL. If that is not | 654 | * file:/home. The algorithm tries to go up on the right-most URL. If that is not |
653 | * possible it strips the right most URL. It continues stripping URLs. | 655 | * possible it strips the right most URL. It continues stripping URLs. |
654 | * @return a URL that is a level higher | 656 | * @return a URL that is a level higher |
655 | */ | 657 | */ |
656 | KURL upURL( ) const; | 658 | KURL upURL( ) const; |
657 | 659 | ||
658 | KURL& operator=( const KURL& _u ); | 660 | KURL& operator=( const KURL& _u ); |
659 | KURL& operator=( const QString& _url ); | 661 | KURL& operator=( const QString& _url ); |
660 | KURL& operator=( const char * _url ); | 662 | KURL& operator=( const char * _url ); |
661 | KURL& operator=( const QUrl & u ); | 663 | KURL& operator=( const Q3Url & u ); |
662 | 664 | ||
663 | bool operator==( const KURL& _u ) const; | 665 | bool operator==( const KURL& _u ) const; |
664 | bool operator==( const QString& _u ) const; | 666 | bool operator==( const QString& _u ) const; |
665 | bool operator!=( const KURL& _u ) const { return !( *this == _u ); } | 667 | bool operator!=( const KURL& _u ) const { return !( *this == _u ); } |
666 | bool operator!=( const QString& _u ) const { return !( *this == _u ); } | 668 | bool operator!=( const QString& _u ) const { return !( *this == _u ); } |
667 | 669 | ||
668 | /** | 670 | /** |
669 | * The same as equals(), just with a less obvious name. | 671 | * The same as equals(), just with a less obvious name. |
670 | * Compares this url with @p u. | 672 | * Compares this url with @p u. |
671 | * @param ignore_trailing set to true to ignore trailing '/' characters. | 673 | * @param ignore_trailing set to true to ignore trailing '/' characters. |
672 | * @return true if both urls are the same | 674 | * @return true if both urls are the same |
673 | * @see operator==. This function should be used if you want to | 675 | * @see operator==. This function should be used if you want to |
674 | * ignore trailing '/' characters. | 676 | * ignore trailing '/' characters. |
675 | * @deprecated | 677 | * @deprecated |
676 | */ | 678 | */ |
677 | bool cmp( const KURL &u, bool ignore_trailing = false ) const; | 679 | bool cmp( const KURL &u, bool ignore_trailing = false ) const; |