using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::Sequence; using ::com::sun::star::ucb::XContentIdentifier; using ::com::sun::star::ucb::IllegalIdentifierException; using ::com::sun::star::ucb::XContent; using ::com::sun::star::uno::XComponentContext;
// normalize the identifier const OUString sIdentifier( i_rIdentifier->getContentIdentifier() );
// the scheme needs to be lower-case
OUStringBuffer aComposer( sIdentifier.copy( 0, sScheme.getLength() ).toAsciiLowerCase() );
// one : is required after the scheme
std::u16string_view sRemaining( sIdentifier.subView( sScheme.getLength() ) );
lcl_ensureAndTransfer( sRemaining, aComposer, ':' );
// and at least one /
lcl_ensureAndTransfer( sRemaining, aComposer, '/' );
// the normalized form requires one additional /, but we also accept identifiers which don't have it if ( sRemaining.empty() )
{ // the root content is a special case, it requires /
aComposer.append( "//" );
} else
{ if ( sRemaining[0] != '/' )
{
aComposer.append( OUString::Concat("/") + sRemaining );
} else
{
lcl_ensureAndTransfer( sRemaining, aComposer, '/' ); // by now, we moved "vnd.sun.star.extension://" from the URL to aComposer if ( sRemaining.empty() )
{ // again, it's the root content, but one / is missing
aComposer.append( '/' );
} else
{
aComposer.append( sRemaining );
}
}
} const Reference< XContentIdentifier > xNormalizedIdentifier( new ::ucbhelper::ContentIdentifier( aComposer.makeStringAndClear() ) );
::osl::MutexGuard aGuard( m_aMutex );
// check if a content with given id already exists...
Reference< XContent > xContent( queryExistingContent( xNormalizedIdentifier ) ); if ( xContent.is() ) return xContent;
// create a new content
xContent = new Content( m_xContext, this, xNormalizedIdentifier ); if ( !xContent->getIdentifier().is() ) throw IllegalIdentifierException();
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.