1 #ifndef __HTTP_URL_HPP__ 2 #define __HTTP_URL_HPP__ 17 urlPathMatrixParams = 4 | urlPathComp,
19 urlDefault = urlQueryVars | urlCanRelative,
20 urlAll = urlPathComp | urlPathMatrixParams | urlQueryVars | urlCanRelative,
24 explicit Url(
int flags = urlDefault ) : _flags(flags), _isRelative(false)
28 explicit Url(
winux::String const & url,
int flags = urlDefault ) : _flags(flags), _isRelative(false)
84 winux::Mixed const & getPathMatrixParams(
int iPathComp )
const;
118 _rawQueryStr.
clear();
129 bool assembleSchemeSegment(
winux::String * urlSegment )
const;
132 bool assembleHostSegment(
winux::String * urlSegment,
bool hasSchemeSegment )
const;
135 bool assemblePathSegment(
winux::String * urlSegment,
bool hasHostSegment,
bool hasQuerySegment,
bool hasFragmentSegment )
const;
138 bool assembleQuerySegment(
winux::String * urlSegment,
bool incStartChar )
const;
141 bool assembleFragmentSegment(
winux::String * urlSegment,
bool incStartChar )
const;
147 Url & parse(
winux::String const & url,
bool hasSchemeSegment =
true,
bool hasHostSegment =
true,
bool hasPathSegment =
true,
bool hasQuerySegment =
true,
bool hasFragmentSegment =
true );
220 void parse(
winux::String const & url,
bool hasSchemeSegment =
true,
bool hasHostSegment =
true,
bool hasPathSegment =
true,
bool hasQuerySegment =
true,
bool hasFragmentSegment =
true );
226 void parseQuerySegment(
winux::String const & querySegment );
238 #endif // __HTTP_URL_HPP__
Url & setUser(winux::String const &user)
设置URL主机段的用户名(可选).
Url & setRelative(bool relative)
设置URL是否为相对.
Url & setScheme(winux::String const &scheme)
设置URL方案.
bool isRelative() const
是否为相对URL.
Url & setPort(winux::String const &port)
设置URL主机段的端口号(可选).
Url(int flags=urlDefault)
winux::uint getFlags() const
获取URL解析和使用标志.
Url & setFragment(winux::String const &fragment)
设置URL Fragment段.
winux::String const & getRawQueryStr() const
获取未解析的查询段字符串.不以'?'开头.
winux::Mixed const & getQueryParam(winux::String const &name) const
获取指定的查询参数.
Url & setPwd(winux::String const &pwd)
设置URL主机段的密码(可选).
winux::String const & getScheme() const
获取URL方案.
size_t getPathCompsCount() const
获取路径部件数.
winux::String const & getRawPathStr() const
获取未解析的路径段字符串.不以'/'开头.
winux::String const & getPort() const
获取端口号,如果不指定则为scheme默认决定的端口.
winux::String const & getHost() const
获取主机名(域名).
Url(winux::String const &url, int flags=urlDefault)
winux::String const & getPwd() const
获取密码.
winux::String const & getUser() const
获取用户名.
Url & setHost(winux::String const &host)
设置URL主机段的主机名.
UrlSegmentFlags
URL段解析/使用标记
Url & setFlags(winux::uint flags)
设置URL解析和使用标志.
winux::String const & getFragment() const
获取文章分段名.
winux::Mixed const & getQueryParams() const
获取查询参数集合的常引用.