// INetURLObject supports only an intelligent method of parsing URL's. So write // back Complete to have a valid encoded URL in all cases!
_rURL.Complete = _rParser.GetMainURL( INetURLObject::DecodeMechanism::NONE );
// If INetURLObject knows this protocol let it parse if ( INetURLObject::CompareProtocolScheme( aProtocol ) != INetProtocol::NotValid )
{ // Initialize parser with given URL.
INetURLObject aParser( aURL.Complete );
// Get all information about this URL.
INetProtocol eINetProt = aParser.GetProtocol(); if ( eINetProt == INetProtocol::NotValid )
{ returnfalse;
} elseif ( !aParser.HasError() )
{
lcl_ParserHelper(aParser,aURL); // Return "URL is parsed". returntrue;
}
} else
{ // Minimal support for unknown protocols. This is mandatory to support the "Protocol Handlers" implemented // in framework!
aURL.Protocol = aProtocol;
aURL.Main = aURL.Complete;
aURL.Path = aURL.Complete.copy( nURLIndex+1 );
// Initialize parser with given URL.
INetURLObject aParser;
aParser.SetSmartProtocol( INetURLObject::CompareProtocolScheme( sSmartProtocol )); bool bOk = aParser.SetSmartURL( aURL.Complete ); if ( bOk )
{
lcl_ParserHelper(aParser,aURL); // Return "URL is parsed". returntrue;
} else
{ // Minimal support for unknown protocols. This is mandatory to support the "Protocol Handlers" implemented // in framework! if ( INetURLObject::CompareProtocolScheme( sSmartProtocol ) == INetProtocol::NotValid )
{ // Try to extract the protocol
sal_Int32 nIndex = aURL.Complete.indexOf( ':' ); if ( nIndex > 1 )
{
OUString aProtocol = aURL.Complete.copy( 0, nIndex+1 );
// If INetURLObject knows this protocol something is wrong as detected before => // give up and return false! if ( INetURLObject::CompareProtocolScheme( aProtocol ) != INetProtocol::NotValid ) returnfalse; else
aURL.Protocol = aProtocol;
} else returnfalse;
// Concat the name if it is provided, just support a final slash if ( !aURL.Name.isEmpty() )
{
sal_Int32 nIndex = aURL.Path.lastIndexOf( '/' ); if ( nIndex == ( aURL.Path.getLength() -1 ))
aCompletePath.append( aURL.Name ); else
{
aCompletePath.append( "/" + aURL.Name );
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.