From 1fc902ac7eb5791158f3757b10bd9424fe1d395f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 20 Sep 2012 16:05:30 +0200 Subject: Move QUrlPrivate to qurl.cpp and mark all methods as inline They're never accessed outside of qurl.cpp anyway, so let the compiler know that it doesn't need to generate a full out-of-line copy for them in case it does inlining. Change-Id: I2be069b3fd2658eff9ad3023c21c8ae653c389ab Reviewed-by: Shane Kearns Reviewed-by: David Faure --- src/corelib/io/qurl_p.h | 117 ------------------------------------------------ 1 file changed, 117 deletions(-) (limited to 'src/corelib/io/qurl_p.h') diff --git a/src/corelib/io/qurl_p.h b/src/corelib/io/qurl_p.h index 780fb387d9..b31a74570a 100644 --- a/src/corelib/io/qurl_p.h +++ b/src/corelib/io/qurl_p.h @@ -58,123 +58,6 @@ QT_BEGIN_NAMESPACE -class QUrlPrivate -{ -public: - enum Section { - Scheme = 0x01, - UserName = 0x02, - Password = 0x04, - UserInfo = UserName | Password, - Host = 0x08, - Port = 0x10, - Authority = UserInfo | Host | Port, - Path = 0x20, - Hierarchy = Authority | Path, - Query = 0x40, - Fragment = 0x80, - FullUrl = 0xff - }; - - enum ErrorCode { - // the high byte of the error code matches the Section - InvalidSchemeError = Scheme << 8, - - InvalidUserNameError = UserName << 8, - - InvalidPasswordError = Password << 8, - - InvalidRegNameError = Host << 8, - InvalidIPv4AddressError, - InvalidIPv6AddressError, - InvalidIPvFutureError, - HostMissingEndBracket, - - InvalidPortError = Port << 8, - PortEmptyError, - - InvalidPathError = Path << 8, - - InvalidQueryError = Query << 8, - - InvalidFragmentError = Fragment << 8, - - // the following two cases are only possible in combination - // with presence/absence of the authority and scheme. See validityError(). - AuthorityPresentAndPathIsRelative = Authority << 8 | Path << 8 | 0x10000, - RelativeUrlPathContainsColonBeforeSlash = Scheme << 8 | Authority << 8 | Path << 8 | 0x10000, - - NoError = 0 - }; - - QUrlPrivate(); - QUrlPrivate(const QUrlPrivate ©); - - void parse(const QString &url, QUrl::ParsingMode parsingMode); - bool isEmpty() const - { return sectionIsPresent == 0 && port == -1 && path.isEmpty(); } - ErrorCode validityError() const; - - // no QString scheme() const; - void appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const; - void appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const; - void appendUserName(QString &appendTo, QUrl::FormattingOptions options) const; - void appendPassword(QString &appendTo, QUrl::FormattingOptions options) const; - void appendHost(QString &appendTo, QUrl::FormattingOptions options) const; - void appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const; - void appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const; - void appendFragment(QString &appendTo, QUrl::FormattingOptions options) const; - - // the "end" parameters are like STL iterators: they point to one past the last valid element - bool setScheme(const QString &value, int len); - void setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode); - void setUserInfo(const QString &userInfo, int from, int end); - void setUserName(const QString &value, int from, int end); - void setPassword(const QString &value, int from, int end); - bool setHost(const QString &value, int from, int end, QUrl::ParsingMode mode); - void setPath(const QString &value, int from, int end); - void setQuery(const QString &value, int from, int end); - void setFragment(const QString &value, int from, int end); - - inline bool hasScheme() const { return sectionIsPresent & Scheme; } - inline bool hasAuthority() const { return sectionIsPresent & Authority; } - inline bool hasUserInfo() const { return sectionIsPresent & UserInfo; } - inline bool hasUserName() const { return sectionIsPresent & UserName; } - inline bool hasPassword() const { return sectionIsPresent & Password; } - inline bool hasHost() const { return sectionIsPresent & Host; } - inline bool hasPort() const { return port != -1; } - inline bool hasPath() const { return !path.isEmpty(); } - inline bool hasQuery() const { return sectionIsPresent & Query; } - inline bool hasFragment() const { return sectionIsPresent & Fragment; } - - QString mergePaths(const QString &relativePath) const; - - QAtomicInt ref; - int port; - - QString scheme; - QString userName; - QString password; - QString host; - QString path; - QString query; - QString fragment; - - ushort errorCode; - ushort errorSupplement; - - // not used for: - // - Port (port == -1 means absence) - // - Path (there's no path delimiter, so we optimize its use out of existence) - // Schemes are never supposed to be empty, but we keep the flag anyway - uchar sectionIsPresent; - - // UserName, Password, Path, Query, and Fragment never contain errors in TolerantMode. - // Those flags are set only by the strict parser. - uchar sectionHasError; -}; - - // in qurlrecode.cpp extern Q_AUTOTEST_EXPORT int qt_urlRecode(QString &appendTo, const QChar *begin, const QChar *end, QUrl::ComponentFormattingOptions encoding, const ushort *tableModifications = 0); -- cgit v1.2.3