本文整理汇总了C++中URI类的典型用法代码示例。如果您正苦于以下问题:C++ URI类的具体用法?C++ URI怎么用?C++ URI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了URI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: poco_assert
std::istream* HTTPStreamFactory::open(const URI& uri)
{
poco_assert (uri.getScheme() == "http");
URI resolvedURI(uri);
URI proxyUri;
HTTPClientSession* pSession = 0;
HTTPResponse res;
bool retry = false;
bool authorize = false;
std::string username;
std::string password;
try
{
do
{
if (!pSession)
{
pSession = new HTTPClientSession(resolvedURI.getHost(), resolvedURI.getPort());
if (proxyUri.empty())
pSession->setProxy(_proxyHost, _proxyPort);
else
pSession->setProxy(proxyUri.getHost(), proxyUri.getPort());
pSession->setProxyCredentials(_proxyUsername, _proxyPassword);
}
std::string path = resolvedURI.getPathAndQuery();
if (path.empty()) path = "/";
HTTPRequest req(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1);
if (authorize)
{
HTTPCredentials::extractCredentials(uri, username, password);
HTTPCredentials cred(username, password);
cred.authenticate(req, res);
}
pSession->sendRequest(req);
std::istream& rs = pSession->receiveResponse(res);
bool moved = (res.getStatus() == HTTPResponse::HTTP_MOVED_PERMANENTLY ||
res.getStatus() == HTTPResponse::HTTP_FOUND ||
res.getStatus() == HTTPResponse::HTTP_SEE_OTHER ||
res.getStatus() == HTTPResponse::HTTP_TEMPORARY_REDIRECT);
if (moved)
{
resolvedURI.resolve(res.get("Location"));
if (!username.empty())
{
resolvedURI.setUserInfo(username + ":" + password);
}
throw URIRedirection(resolvedURI.toString());
}
else if (res.getStatus() == HTTPResponse::HTTP_OK)
{
return new HTTPResponseStream(rs, pSession);
}
else if (res.getStatus() == HTTPResponse::HTTP_USEPROXY && !retry)
{
// The requested resource MUST be accessed through the proxy
// given by the Location field. The Location field gives the
// URI of the proxy. The recipient is expected to repeat this
// single request via the proxy. 305 responses MUST only be generated by origin servers.
// only use for one single request!
proxyUri.resolve(res.get("Location"));
delete pSession; pSession = 0;
retry = true; // only allow useproxy once
}
else if (res.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED && !authorize)
{
authorize = true;
retry = true;
Poco::NullOutputStream null;
Poco::StreamCopier::copyStream(rs, null);
}
else throw HTTPException(res.getReason(), uri.toString());
}
while (retry);
throw HTTPException("Too many redirects", uri.toString());
}
catch (...)
{
delete pSession;
throw;
}
}
示例2: if
void
KML_Placemark::build( const Config& conf, KMLContext& cx )
{
Style style;
if ( conf.hasValue("styleurl") )
{
// process a "stylesheet" style
const Style* ref_style = cx._sheet->getStyle( conf.value("styleurl"), false );
if ( ref_style )
style = *ref_style;
}
else if ( conf.hasChild("style") )
{
// process an "inline" style
KML_Style kmlStyle;
kmlStyle.scan( conf.child("style"), cx );
style = cx._activeStyle;
}
// parse the geometry. the placemark must have geometry to be valid. The
// geometry parse may optionally specify an altitude mode as well.
KML_Geometry geometry;
geometry.build(conf, cx, style);
// KML's default altitude mode is clampToGround.
AltitudeMode altMode = ALTMODE_RELATIVE;
AltitudeSymbol* altSym = style.get<AltitudeSymbol>();
if ( !altSym )
{
altSym = style.getOrCreate<AltitudeSymbol>();
altSym->clamping() = AltitudeSymbol::CLAMP_RELATIVE_TO_TERRAIN;
}
else if ( !altSym->clamping().isSetTo(AltitudeSymbol::CLAMP_RELATIVE_TO_TERRAIN) )
{
altMode = ALTMODE_ABSOLUTE;
}
if ( geometry._geom.valid() && geometry._geom->getTotalPointCount() > 0 )
{
Geometry* geom = geometry._geom.get();
GeoPoint position(cx._srs.get(), geom->getBounds().center(), altMode);
bool isPoly = geom->getComponentType() == Geometry::TYPE_POLYGON;
bool isPoint = geom->getComponentType() == Geometry::TYPE_POINTSET;
// read in the Marker if there is one.
URI markerURI;
osg::ref_ptr<osg::Image> markerImage;
osg::ref_ptr<osg::Node> markerModel;
MarkerSymbol* marker = style.get<MarkerSymbol>();
if ( marker && marker->url().isSet() )
{
if ( marker->isModel() == false )
{
markerImage = marker->getImage( *cx._options->iconMaxSize() );
}
else
{
markerURI = URI( marker->url()->eval(), marker->url()->uriContext() );
markerModel = markerURI.getNode();
// We can't leave the marker symbol in the style, or the GeometryCompiler will
// think we want to do Point-model substitution. So remove it. A bit of a hack
if ( marker )
style.removeSymbol(marker);
}
}
std::string text = conf.hasValue("name") ? conf.value("name") : "";
AnnotationNode* fNode = 0L;
AnnotationNode* pNode = 0L;
// place a 3D model:
if ( markerModel.valid() )
{
LocalGeometryNode* lg = new LocalGeometryNode(cx._mapNode, markerModel.get(), style, false);
lg->setPosition( position );
if ( marker )
{
if ( marker->scale().isSet() )
{
float scale = marker->scale()->eval();
lg->setScale( osg::Vec3f(scale,scale,scale) );
}
if ( marker->orientation().isSet() )
{
// lg->setRotation( );
}
}
fNode = lg;
//Feature* feature = new Feature(geometry._geom.get(), cx._srs.get(), style);
//fNode = new FeatureNode( cx._mapNode, feature, false );
}
//.........这里部分代码省略.........
示例3: while
// This function will take a resolved URI and create a version of it that is relative to
// another existing URI. The new URI is stored in the "originalURI"
bool URI::makeRelativeTo ( const URI& relativeToURI, bool ignoreCase)
{
// Can only do this function if both URIs have the same scheme and authority
if (mScheme != relativeToURI.mScheme || mAuthority != relativeToURI.mAuthority)
return false;
// advance till we find a segment that doesn't match
WideString thisPathWideSring = StringUtils::utf8String2WideString(getPath());
WideString relativeToPathWideSring = StringUtils::utf8String2WideString(relativeToURI.getPath());
const wchar_t *this_path = thisPathWideSring.c_str();
const wchar_t *relativeTo_path = relativeToPathWideSring.c_str();
const wchar_t *this_slash = this_path;
const wchar_t *relativeTo_slash = relativeTo_path;
/* const char *this_path = getPath().c_str();
const char *relativeTo_path = relativeToURI.getPath().c_str();
const char *this_slash = this_path;
const char *relativeTo_slash = relativeTo_path;
*/
while( *this_path )
{
if ( ignoreCase )
{
wchar_t characters[3];
characters[0] = *this_path;
characters[1] = *relativeTo_path;
characters[2] = 0;
boost::to_lower(characters);
if ( characters[0] != characters[1] )
break;
}
else
{
if (*this_path != *relativeTo_path)
break;
}
if(*this_path == '/')
{
this_slash = this_path;
relativeTo_slash = relativeTo_path;
}
this_path++;
relativeTo_path++;
}
// Decide how many ../ segments are needed (Filepath should always end in a /)
int segment_count = 0;
relativeTo_slash++;
while(*relativeTo_slash != 0)
{
if(*relativeTo_slash == '/')
segment_count ++;
relativeTo_slash++;
}
this_slash++;
String newPath;
if ( segment_count == 0 )
{
newPath = "./";
}
else
{
for (int i = 0; i < segment_count; i++)
newPath += "../";
}
WideString thisSlashWideString(this_slash);
newPath += StringUtils::wideString2utf8String(thisSlashWideString);
set("", "", newPath, mQuery, mFragment, 0/*relativeToURI*/);
return true;
}
示例4: THROWCS
bool OAuth2SessionLogin::handlePage(HTTP::WebContext &ctx, ostream &stream,
const URI &uri) {
HTTP::Connection &con = ctx.getConnection();
HTTP::Request &request = con.getRequest();
HTTP::Response &response = con.getResponse();
ctx.setDynamic(); // Don't cache
// Force secure
if (!con.isSecure())
THROWCS("Cannot logon via insecure port",
HTTP::StatusCode::HTTP_UNAUTHORIZED);
// Get session ID
string sid = request.findCookie(sessionManager->getSessionCookie());
if (sid.empty() && uri.has("state")) sid = uri.get("state");
HTTP::SessionPtr session = sessionManager->findSession(ctx, sid);
try {
if (session.isNull() ||
(uri.has("state") && uri.get("state") != session->getID()) ||
(!uri.has("state") && session->getUser().empty())) {
session = sessionManager->openSession(ctx);
sid = session->getID();
URI redirectURL = auth->getRedirectURL(uri.getPath(), sid);
response.redirect(redirectURL);
} else if (session->getUser().empty()) {
// TODO Make sure session is not very old
URI postURI = auth->getVerifyURL(uri, sid);
LOG_DEBUG(5, "Token URI: " << postURI);
// Extract query data
string data = postURI.getQuery();
postURI.setQuery("");
// Verify authorization with OAuth2 server
HTTP::Transaction tran(sslCtx);
tran.post(postURI, data.data(), data.length(),
"application/x-www-form-urlencoded", 1.0);
// Read response
tran.receiveHeader();
JSON::ValuePtr token = JSON::Reader(tran).parse();
LOG_DEBUG(5, "Token Response: \n" << tran.getResponse() << *token);
// Verify token
string accessToken = auth->verifyToken(token);
// Get profile
URI profileURL = auth->getProfileURL(accessToken);
HTTP::Transaction tran2(sslCtx);
tran2.get(profileURL);
// Read response
tran2.receiveHeader();
JSON::ValuePtr profile = JSON::Reader(tran2).parse();
// Process profile
string email = profile->getString("email");
if (!profile->getBoolean("email_verified"))
THROWCS("Email not verified", HTTP::StatusCode::HTTP_UNAUTHORIZED);
session->setUser(email);
LOG_INFO(1, "Authorized: " << email);
// Final redirect to remove auth parameters
response.redirect(uri.getPath());
} else return false; // Already authorized
// Make sure session cookie is set
sessionManager->setSessionCookie(ctx);
} catch (...) {
// Close session on error
if (!sid.empty()) sessionManager->closeSession(ctx, sid);
throw;
}
return true;
}
示例5: initialize
/** override */
Status initialize( const osgDB::Options* dbOptions )
{
osg::ref_ptr<const Profile> result;
char sep = _options.url()->full().find_first_of('?') == std::string::npos? '?' : '&';
URI capUrl = _options.capabilitiesUrl().value();
if ( capUrl.empty() )
{
capUrl = URI(
_options.url()->full() +
sep +
std::string("SERVICE=WMS") +
std::string("&VERSION=") + _options.wmsVersion().value() +
std::string("&REQUEST=GetCapabilities") );
}
//Try to read the WMS capabilities
osg::ref_ptr<WMSCapabilities> capabilities = WMSCapabilitiesReader::read( capUrl.full(), dbOptions );
if ( !capabilities.valid() )
{
return Status::Error( "Unable to read WMS GetCapabilities." );
}
else
{
OE_INFO << LC << "Got capabilities from " << capUrl.full() << std::endl;
}
if ( _formatToUse.empty() && capabilities.valid() )
{
_formatToUse = capabilities->suggestExtension();
OE_INFO << LC << "No format specified, capabilities suggested extension " << _formatToUse << std::endl;
}
if ( _formatToUse.empty() )
_formatToUse = "png";
if ( _srsToUse.empty() )
_srsToUse = "EPSG:4326";
std::string wmsFormatToUse = _options.wmsFormat().value();
//Initialize the WMS request prototype
std::stringstream buf;
// first the mandatory keys:
buf
<< std::fixed << _options.url()->full() << sep
<< "SERVICE=WMS"
<< "&VERSION=" << _options.wmsVersion().value()
<< "&REQUEST=GetMap"
<< "&LAYERS=" << _options.layers().value()
<< "&FORMAT=" << ( wmsFormatToUse.empty() ? std::string("image/") + _formatToUse : wmsFormatToUse )
<< "&STYLES=" << _options.style().value()
<< (_options.wmsVersion().value() == "1.3.0" ? "&CRS=" : "&SRS=") << _srsToUse
<< "&WIDTH="<< _options.tileSize().value()
<< "&HEIGHT="<< _options.tileSize().value()
<< "&BBOX=%lf,%lf,%lf,%lf";
// then the optional keys:
if ( _options.transparent().isSet() )
buf << "&TRANSPARENT=" << (_options.transparent() == true ? "TRUE" : "FALSE");
_prototype = "";
_prototype = buf.str();
//OE_NOTICE << "Prototype " << _prototype << std::endl;
osg::ref_ptr<SpatialReference> wms_srs = SpatialReference::create( _srsToUse );
// check for spherical mercator:
if ( wms_srs.valid() && wms_srs->isEquivalentTo( osgEarth::Registry::instance()->getGlobalMercatorProfile()->getSRS() ) )
{
result = osgEarth::Registry::instance()->getGlobalMercatorProfile();
}
else if (wms_srs.valid() && wms_srs->isEquivalentTo( osgEarth::Registry::instance()->getGlobalGeodeticProfile()->getSRS()))
{
result = osgEarth::Registry::instance()->getGlobalGeodeticProfile();
}
// Next, try to glean the extents from the layer list
if ( capabilities.valid() )
{
//TODO: "layers" mights be a comma-separated list. need to loop through and
//combine the extents?? yes
WMSLayer* layer = capabilities->getLayerByName( _options.layers().value() );
if ( layer )
{
double minx, miny, maxx, maxy;
minx = miny = maxx = maxy = 0;
//Check to see if the profile is equivalent to global-geodetic
if (wms_srs->isGeographic())
{
//Try to get the lat lon extents if they are provided
layer->getLatLonExtents(minx, miny, maxx, maxy);
//If we still don't have any extents, just default to global geodetic.
//.........这里部分代码省略.........
示例6: initialize
/** override */
Status initialize( const osgDB::Options* dbOptions )
{
osg::ref_ptr<const Profile> result;
char sep = _options.url()->full().find_first_of('?') == std::string::npos? '?' : '&';
URI capUrl = _options.capabilitiesUrl().value();
if ( capUrl.empty() )
{
capUrl = URI(
_options.url()->full() +
sep +
std::string("SERVICE=WMS") +
std::string("&VERSION=") + _options.wmsVersion().value() +
std::string("&REQUEST=GetCapabilities") );
}
//Try to read the WMS capabilities
osg::ref_ptr<WMSCapabilities> capabilities = WMSCapabilitiesReader::read( capUrl, dbOptions );
if ( !capabilities.valid() )
{
return Status::Error( Status::ResourceUnavailable, "Unable to read WMS GetCapabilities." );
}
else
{
OE_INFO << LC << "Got capabilities from " << capUrl.full() << std::endl;
}
if ( _formatToUse.empty() && capabilities.valid() )
{
_formatToUse = capabilities->suggestExtension();
OE_INFO << LC << "No format specified, capabilities suggested extension " << _formatToUse << std::endl;
}
if ( _formatToUse.empty() )
_formatToUse = "png";
if ( _srsToUse.empty() )
_srsToUse = "EPSG:4326";
std::string wmsFormatToUse = _options.wmsFormat().value();
//Initialize the WMS request prototype
std::stringstream buf;
// first the mandatory keys:
buf
<< std::fixed << _options.url()->full() << sep
<< "SERVICE=WMS"
<< "&VERSION=" << _options.wmsVersion().value()
<< "&REQUEST=GetMap"
<< "&LAYERS=" << _options.layers().value()
<< "&FORMAT=" << ( wmsFormatToUse.empty() ? std::string("image/") + _formatToUse : wmsFormatToUse )
<< "&STYLES=" << _options.style().value()
<< (_options.wmsVersion().value() == "1.3.0" ? "&CRS=" : "&SRS=") << _srsToUse
<< "&WIDTH="<< getPixelsPerTile()
<< "&HEIGHT=" << getPixelsPerTile()
<< "&BBOX=%lf,%lf,%lf,%lf";
// then the optional keys:
if ( _options.transparent().isSet() )
buf << "&TRANSPARENT=" << (_options.transparent() == true ? "TRUE" : "FALSE");
_prototype = "";
_prototype = buf.str();
//OE_NOTICE << "Prototype " << _prototype << std::endl;
osg::ref_ptr<SpatialReference> wms_srs = SpatialReference::create( _srsToUse );
// check for spherical mercator:
if ( wms_srs.valid() && wms_srs->isEquivalentTo( osgEarth::Registry::instance()->getSphericalMercatorProfile()->getSRS() ) )
{
result = osgEarth::Registry::instance()->getSphericalMercatorProfile();
}
else if (wms_srs.valid() && wms_srs->isEquivalentTo( osgEarth::Registry::instance()->getGlobalGeodeticProfile()->getSRS()))
{
result = osgEarth::Registry::instance()->getGlobalGeodeticProfile();
}
// Next, try to glean the extents from the layer list
if ( capabilities.valid() )
{
StringTokenizer tok(",");
StringVector tized;
tok.tokenize(_options.layers().value(), tized);
for (StringVector::const_iterator itr = tized.begin(); itr != tized.end(); ++itr)
{
std::string layerName = *itr;
WMSLayer* layer = capabilities->getLayerByName(layerName);
if (layer)
{
// Get the lat/lon extents
double minLon, minLat, maxLon, maxLat;
layer->getLatLonExtents(minLon, minLat, maxLon, maxLat);
GeoExtent wgs84Extent(SpatialReference::create("wgs84"), minLon, minLat, maxLon, maxLat);
getDataExtents().push_back(DataExtent(wgs84Extent, 0));
//.........这里部分代码省略.........
示例7: getPositionAttitudeTransform
void
PlaceNode::init()
{
Decluttering::setEnabled( this->getOrCreateStateSet(), true );
//reset.
//this->clearDecoration();
getPositionAttitudeTransform()->removeChildren(0, getPositionAttitudeTransform()->getNumChildren());
_geode = new osg::Geode();
// ensure that (0,0,0) is the bounding sphere control/center point.
// useful for things like horizon culling.
_geode->setComputeBoundingSphereCallback(new ControlPointCallback());
osg::Drawable* text = 0L;
// If there's no explicit text, look to the text symbol for content.
if ( _text.empty() && _style.has<TextSymbol>() )
{
_text = _style.get<TextSymbol>()->content()->eval();
}
osg::ref_ptr<const InstanceSymbol> instance = _style.get<InstanceSymbol>();
// backwards compability, support for deprecated MarkerSymbol
if ( !instance.valid() && _style.has<MarkerSymbol>() )
{
instance = _style.get<MarkerSymbol>()->convertToInstanceSymbol();
}
const IconSymbol* icon = instance->asIcon();
if ( !_image.valid() )
{
URI imageURI;
if ( icon )
{
if ( icon->url().isSet() )
{
imageURI = icon->url()->evalURI();
}
else if (icon->getImage())
{
_image = icon->getImage();
}
}
if ( !imageURI.empty() )
{
_image = imageURI.getImage( _dbOptions.get() );
}
}
osg::BoundingBox imageBox(0,0,0,0,0,0);
// found an image; now format it:
if ( _image.get() )
{
// Scale the icon if necessary
double scale = 1.0;
if ( icon && icon->scale().isSet() )
{
scale = icon->scale()->eval();
}
double s = scale * _image->s();
double t = scale * _image->t();
// this offset anchors the image at the bottom
osg::Vec2s offset;
if ( !icon || !icon->alignment().isSet() )
{
// default to bottom center
offset.set(0.0, t / 2.0);
}
else
{ // default to bottom center
switch (icon->alignment().value())
{
case IconSymbol::ALIGN_LEFT_TOP:
offset.set((s / 2.0), -(t / 2.0));
break;
case IconSymbol::ALIGN_LEFT_CENTER:
offset.set((s / 2.0), 0.0);
break;
case IconSymbol::ALIGN_LEFT_BOTTOM:
offset.set((s / 2.0), (t / 2.0));
break;
case IconSymbol::ALIGN_CENTER_TOP:
offset.set(0.0, -(t / 2.0));
break;
case IconSymbol::ALIGN_CENTER_CENTER:
offset.set(0.0, 0.0);
break;
case IconSymbol::ALIGN_CENTER_BOTTOM:
default:
offset.set(0.0, (t / 2.0));
break;
//.........这里部分代码省略.........
示例8: loadDomainCookies
void CookieJar::cookiesForRequest(
const URI &request,
std::string &headers,
time_t now)
{
loadDomainCookies(request.server());
loadDomainCookies(topLevel(request.server()));
// printf("cookiesForRequest: %s \n",request.asString().c_str());
string domain(request.server());
// find a cookie in the jar that corresponds to the requested domain...
string tmp("Cookie: ");
bool needSep(false);
const static string sep("; ");
bool haveExpired(false);
std::vector<Cookie *>::const_iterator it(m_cookies.begin());
for (; it != m_cookies.end(); ++it)
{
Cookie *c(*it);
if (c->name() == DOMAIN_STR)
continue;
if (c->matchesDomain(domain)) {
if (c->expired(now)) {
haveExpired = true;
continue;
}
if (not c->path().empty())
{
// check to see if the requested path is a sub dir of path
string value = c->path();
string file = request.fileName();
size_t pos = file.find(value);
if (pos != 0)
{
continue;
}
}
// do not send secure cookies to unsecure domains
if (c->secure() and request.protocol() != URI::HTTPS_PROTOCOL)
{
continue;
}
if (needSep)
{
tmp += sep;
}
string value(c->value());
bool needQuotes = value.find_first_of(" ")!=string::npos;
tmp += c->name();
tmp += "=";
if (needQuotes) {
tmp += "\"";
}
tmp += c->value();
if (needQuotes) {
tmp += "\"";
}
needSep = true;
}
}
if (needSep) {
tmp += "\r\n";
headers = tmp;
}
if (haveExpired) {
gcExpiredCookies(now);
}
}
示例9: readStats
bool VFSFile::readStats( const URI& uri, FileStat &s )
{
return Sys::fal_stats( uri.path(), s );
}
示例10: AddQueryStringParameters
void SearchRequest::AddQueryStringParameters(URI& uri) const
{
Aws::StringStream ss;
if(m_cursorHasBeenSet)
{
ss << m_cursor;
uri.AddQueryStringParameter("cursor", ss.str());
ss.str("");
}
if(m_exprHasBeenSet)
{
ss << m_expr;
uri.AddQueryStringParameter("expr", ss.str());
ss.str("");
}
if(m_facetHasBeenSet)
{
ss << m_facet;
uri.AddQueryStringParameter("facet", ss.str());
ss.str("");
}
if(m_filterQueryHasBeenSet)
{
ss << m_filterQuery;
uri.AddQueryStringParameter("fq", ss.str());
ss.str("");
}
if(m_highlightHasBeenSet)
{
ss << m_highlight;
uri.AddQueryStringParameter("highlight", ss.str());
ss.str("");
}
if(m_partialHasBeenSet)
{
ss << m_partial;
uri.AddQueryStringParameter("partial", ss.str());
ss.str("");
}
if(m_queryHasBeenSet)
{
ss << m_query;
uri.AddQueryStringParameter("q", ss.str());
ss.str("");
}
if(m_queryOptionsHasBeenSet)
{
ss << m_queryOptions;
uri.AddQueryStringParameter("q.options", ss.str());
ss.str("");
}
if(m_queryParserHasBeenSet)
{
ss << QueryParserMapper::GetNameForQueryParser(m_queryParser);
uri.AddQueryStringParameter("q.parser", ss.str());
ss.str("");
}
if(m_returnHasBeenSet)
{
ss << m_return;
uri.AddQueryStringParameter("return", ss.str());
ss.str("");
}
if(m_sizeHasBeenSet)
{
ss << m_size;
uri.AddQueryStringParameter("size", ss.str());
ss.str("");
}
if(m_sortHasBeenSet)
{
ss << m_sort;
uri.AddQueryStringParameter("sort", ss.str());
ss.str("");
}
if(m_startHasBeenSet)
{
ss << m_start;
uri.AddQueryStringParameter("start", ss.str());
ss.str("");
}
if(m_statsHasBeenSet)
{
ss << m_stats;
uri.AddQueryStringParameter("stats", ss.str());
ss.str("");
}
//.........这里部分代码省略.........
示例11: parse
///Extract the hostname, port and attributes
void URIPrivate::parseHostname()
{
if (!m_Parsed)
parse();
const QByteArray extHn = q_ptr->hostname().toLatin1();
int length(extHn.size()), start(0);
bool inAttributes = false;
URI::Section section = URI::Section::HOSTNAME;
// in case no port, attributes, etc are provided
m_Hostname2 = q_ptr->hostname();
for (int i = 0; i < length; i++) {
const char c = extHn[i];
switch (c) {
case ':': //Begin port
switch(section) {
case URI::Section::HOSTNAME:
m_Hostname2 = extHn.mid(start,i);
start = i;
section = URI::Section::PORT;
break;
case URI::Section::USER_INFO:
case URI::Section::CHEVRONS :
case URI::Section::SCHEME :
case URI::Section::TRANSPORT:
case URI::Section::TAG :
case URI::Section::PORT :
break;
}
break;
case ';': //Begin attributes
if (inAttributes) {
parseAttribute(extHn, start, i);
}
else {
switch(section) {
case URI::Section::HOSTNAME:
m_Hostname2 = extHn.mid(start+1,i-start);
break;
case URI::Section::PORT:
m_Port = extHn.mid(start+1,i-start-1).toInt();
break;
case URI::Section::USER_INFO:
case URI::Section::CHEVRONS :
case URI::Section::SCHEME :
case URI::Section::TRANSPORT:
case URI::Section::TAG :
break;
}
inAttributes = true;
}
start = i;
break;
case '#': //Begin fragments
//TODO handle fragments to comply to the RFC
break;
default:
break;
}
}
///Get the remaining attribute
parseAttribute(extHn, start, length-1);
m_IsHNParsed = true;
}
示例12: newImpl
Circuit::Circuit( const URI& source )
: _impl( newImpl( brion::BlueConfig( source.getPath( ))))
{
}
示例13: icase_equal
bool operator == (const URI& lhs, const URI& rhs) noexcept {
return icase_equal(lhs.scheme(), rhs.scheme())
and (lhs.userinfo() == rhs.userinfo())
and icase_equal(lhs.host(), rhs.host())
and lhs.port() == rhs.port()
and lhs.path() == rhs.path()
and lhs.query() == rhs.query()
and lhs.fragment() == rhs.fragment();
}
示例14:
bool operator < (const URI& lhs, const URI& rhs) noexcept {
return lhs.to_string() < rhs.to_string();
}
示例15: URIBuilderImpl
URIBuilderImpl(const URI& uri) {
uri_stream.fill('0');
uri_stream << uri.toString();
}