QtCore/qurl.h Source File
Go to the documentation of this file.
74 RemoveUserInfo = RemovePassword | 0x4,
76 RemoveAuthority = RemoveUserInfo | RemovePort | 0x10,
79 RemoveFragment = 0x80,
82 StripTrailingSlash = 0x10000
84 Q_DECLARE_FLAGS(FormattingOptions, FormattingOption)
87 #ifdef QT_NO_URL_CAST_FROM_STRING
93 QUrl(
const QUrl ©);
94 QUrl &operator =(
const QUrl ©);
95 #ifndef QT_NO_URL_CAST_FROM_STRING
96 QUrl &operator =(
const QString &url);
98 #ifdef Q_COMPILER_RVALUE_REFS
99 inline QUrl &operator=(QUrl &&other)
100 {
qSwap(d, other.d);
return *
this; }
106 void setUrl(
const QString &url);
113 bool isValid()
const;
115 bool isEmpty()
const;
119 void setScheme(
const QString &scheme);
122 void setAuthority(
const QString &authority);
125 void setUserInfo(
const QString &userInfo);
128 void setUserName(
const QString &userName);
130 void setEncodedUserName(
const QByteArray &userName);
133 void setPassword(
const QString &password);
135 void setEncodedPassword(
const QByteArray &password);
138 void setHost(
const QString &host);
143 void setPort(
int port);
145 int port(
int defaultPort)
const;
148 void setPath(
const QString &path);
153 bool hasQuery()
const;
155 void setEncodedQuery(
const QByteArray &query);
158 void setQueryDelimiters(
char valueDelimiter,
char pairDelimiter);
159 char queryValueDelimiter()
const;
160 char queryPairDelimiter()
const;
165 bool hasQueryItem(
const QString &key)
const;
168 void removeQueryItem(
const QString &key);
169 void removeAllQueryItems(
const QString &key);
174 bool hasEncodedQueryItem(
const QByteArray &key)
const;
177 void removeEncodedQueryItem(
const QByteArray &key);
178 void removeAllEncodedQueryItems(
const QByteArray &key);
180 void setFragment(
const QString &fragment);
182 void setEncodedFragment(
const QByteArray &fragment);
184 bool hasFragment()
const;
185 #ifndef QT_BOOTSTRAPPED
186 QString topLevelDomain()
const;
189 QUrl resolved(
const QUrl &relative)
const;
191 bool isRelative()
const;
192 bool isParentOf(
const QUrl &url)
const;
194 static QUrl fromLocalFile(
const QString &localfile);
196 bool isLocalFile()
const;
198 QString toString(FormattingOptions options = None)
const;
200 QByteArray toEncoded(FormattingOptions options = None)
const;
201 static QUrl fromEncoded(
const QByteArray &url);
205 static QUrl fromUserInput(
const QString &userInput);
208 bool isDetached()
const;
225 #if defined QT3_SUPPORT
226 inline QT3_SUPPORT
QString protocol()
const {
return scheme(); }
227 inline QT3_SUPPORT
void setProtocol(
const QString &
s) { setScheme(s); }
228 inline QT3_SUPPORT
void setUser(
const QString &
s) { setUserName(s); }
229 inline QT3_SUPPORT
QString user()
const {
return userName(); }
230 inline QT3_SUPPORT
bool hasUser()
const {
return !userName().isEmpty(); }
231 inline QT3_SUPPORT
bool hasPassword()
const {
return !password().isEmpty(); }
232 inline QT3_SUPPORT
bool hasHost()
const {
return !host().isEmpty(); }
233 inline QT3_SUPPORT
bool hasPort()
const {
return port() != -1; }
234 inline QT3_SUPPORT
bool hasPath()
const {
return !path().isEmpty(); }
235 inline QT3_SUPPORT
void setQuery(
const QString &txt)
239 inline QT3_SUPPORT
QString query()
const
243 inline QT3_SUPPORT
QString ref()
const {
return fragment(); }
244 inline QT3_SUPPORT
void setRef(
const QString &txt) { setFragment(txt); }
245 inline QT3_SUPPORT
bool hasRef()
const {
return !fragment().isEmpty(); }
246 inline QT3_SUPPORT
void addPath(
const QString &
p) { setPath(path() +
QLatin1Char(
'/') + p); }
247 QT3_SUPPORT
void setFileName(
const QString &txt);
248 QT3_SUPPORT
QString fileName()
const;
249 QT3_SUPPORT
QString dirPath()
const;
250 static inline QT3_SUPPORT
void decode(
QString &url)
254 static inline QT3_SUPPORT
void encode(
QString &url)
258 inline QT3_SUPPORT
operator QString()
const {
return toString(); }
259 inline QT3_SUPPORT
bool cdUp()
264 static inline QT3_SUPPORT
bool isRelativeUrl(
const QString &url)
266 return QUrl(url).isRelative();
273 #if defined (QT3_SUPPORT)
274 inline QT3_SUPPORT
void reset() { clear(); }
278 void detach(QMutexLocker &locker);
291 Q_DECLARE_SHARED(QUrl)
292 Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions)
294 #ifndef QT_NO_DATASTREAM
295 Q_CORE_EXPORT QDataStream &
operator<<(QDataStream &,
const QUrl &);
296 Q_CORE_EXPORT QDataStream &
operator>>(QDataStream &, QUrl &);
299 #ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &, const QUrl &)
static QString fromPercentEncoding(const QByteArray &)
uint qHash(const QUrl &url)
QByteArray toEncoded(FormattingOptions options=None) const
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QUrl &)
bool operator==(const Attribute &cA, const AttributeInstance< type > &cB)
This operator compares the two attributes and NOT their values.
static QString fromLatin1(const char *, int size=-1)
#define QT_BEGIN_NAMESPACE
static QByteArray toPercentEncoding(const QString &, const QByteArray &exclude=QByteArray(), const QByteArray &include=QByteArray())
Q_INLINE_TEMPLATE void qSwap(QScopedPointer< T, Cleanup > &p1, QScopedPointer< T, Cleanup > &p2)
bool operator!=(const QByteArray &a1, const QByteArray &a2)
GLsizei const GLfloat * value
Q_DECLARE_TYPEINFO(QUrl, Q_MOVABLE_TYPE)
bool operator<(const QByteArray &a1, const QByteArray &a2)
QByteArray toLatin1() const Q_REQUIRED_RESULT