LCOV - code coverage report
Current view: top level - ucbhelper/source/provider - contentidentifier.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 38 0.0 %
Date: 2014-04-14 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : /**************************************************************************
      22             :                                 TODO
      23             :  **************************************************************************
      24             : 
      25             :  *************************************************************************/
      26             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      27             : #include <ucbhelper/contentidentifier.hxx>
      28             : #include <cppuhelper/typeprovider.hxx>
      29             : #include <osl/mutex.hxx>
      30             : 
      31             : using namespace com::sun::star::uno;
      32             : using namespace com::sun::star::lang;
      33             : using namespace com::sun::star::ucb;
      34             : 
      35             : 
      36             : namespace ucbhelper
      37             : {
      38             : 
      39             : 
      40             : 
      41             : 
      42             : // struct ContentIdentifier_Impl.
      43             : 
      44             : 
      45             : 
      46             : 
      47           0 : struct ContentIdentifier_Impl
      48             : {
      49             :     OUString                          m_aContentId;
      50             :     OUString                          m_aProviderScheme;
      51             :     osl::Mutex                        m_aMutex;
      52             : 
      53             :     ContentIdentifier_Impl( const OUString& rURL );
      54             : };
      55             : 
      56             : 
      57             : 
      58             : // ContentIdentifier_Impl Implementation.
      59             : 
      60             : 
      61             : 
      62           0 : ContentIdentifier_Impl::ContentIdentifier_Impl(const OUString& rURL )
      63             : {
      64             :     // Normalize URL scheme ( it's case insensitive ).
      65             : 
      66             :     // The content provider scheme is the part before the first ':'
      67             :     // within the content id.
      68           0 :     sal_Int32 nPos = rURL.indexOf( ':', 0 );
      69           0 :     if ( nPos != -1 )
      70             :     {
      71           0 :         OUString aScheme( rURL.copy( 0, nPos ) );
      72           0 :         m_aProviderScheme = aScheme.toAsciiLowerCase();
      73           0 :         m_aContentId = rURL.replaceAt( 0, nPos, aScheme );
      74             :     }
      75           0 : }
      76             : 
      77             : 
      78             : 
      79             : // ContentIdentifier Implementation.
      80             : 
      81             : 
      82             : 
      83           0 : ContentIdentifier::ContentIdentifier( const OUString& rURL )
      84             : {
      85           0 :     m_pImpl = new ContentIdentifier_Impl( rURL );
      86           0 : }
      87             : 
      88             : 
      89             : // virtual
      90           0 : ContentIdentifier::~ContentIdentifier()
      91             : {
      92           0 :     delete m_pImpl;
      93           0 : }
      94             : 
      95             : 
      96             : 
      97             : // XInterface methods.
      98             : 
      99             : 
     100             : 
     101             : 
     102             : // virtual
     103           0 : void SAL_CALL ContentIdentifier::acquire() throw()
     104             : {
     105           0 :     OWeakObject::acquire();
     106           0 : }
     107             : 
     108             : 
     109             : // virtual
     110           0 : void SAL_CALL ContentIdentifier::release() throw()
     111             : {
     112           0 :     OWeakObject::release();
     113           0 : }
     114             : 
     115             : 
     116             : // virtual
     117             : Any SAL_CALL
     118           0 : ContentIdentifier::queryInterface( const Type & rType )
     119             :     throw ( RuntimeException, std::exception )
     120             : {
     121             :     Any aRet = cppu::queryInterface( rType,
     122             :                 static_cast< XTypeProvider * >( this ),
     123           0 :                 static_cast< XContentIdentifier * >( this ) );
     124             : 
     125           0 :     return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
     126             : }
     127             : 
     128             : 
     129             : 
     130             : // XTypeProvider methods.
     131             : 
     132             : 
     133             : 
     134             : // virtual
     135             : Sequence< sal_Int8 > SAL_CALL
     136           0 : ContentIdentifier::getImplementationId()
     137             :     throw( RuntimeException, std::exception )
     138             : {
     139           0 :     return css::uno::Sequence<sal_Int8>();
     140             : }
     141             : 
     142             : 
     143             : // virtual
     144             : Sequence< com::sun::star::uno::Type > SAL_CALL
     145           0 : ContentIdentifier::getTypes()
     146             :     throw( RuntimeException, std::exception )
     147             : {
     148             :     static cppu::OTypeCollection* pCollection = NULL;
     149           0 :       if ( !pCollection )
     150             :       {
     151           0 :         osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
     152           0 :         if ( !pCollection )
     153             :         {
     154             :             static cppu::OTypeCollection collection(
     155             :                     getCppuType( static_cast<
     156           0 :                         Reference < XTypeProvider > * >( 0 ) ),
     157             :                     getCppuType( static_cast<
     158           0 :                         Reference< XContentIdentifier > * >( 0 ) ) );
     159           0 :             pCollection = &collection;
     160           0 :         }
     161             :     }
     162           0 :     return (*pCollection).getTypes();
     163             : }
     164             : 
     165             : 
     166             : 
     167             : // XContentIdentifier methods.
     168             : 
     169             : 
     170             : 
     171             : // virtual
     172           0 : OUString SAL_CALL ContentIdentifier::getContentIdentifier()
     173             :     throw( RuntimeException, std::exception )
     174             : {
     175           0 :     return m_pImpl->m_aContentId;
     176             : }
     177             : 
     178             : 
     179             : // virtual
     180           0 : OUString SAL_CALL ContentIdentifier::getContentProviderScheme()
     181             :     throw( RuntimeException, std::exception )
     182             : {
     183           0 :     return m_pImpl->m_aProviderScheme;
     184             : }
     185             : 
     186             : } /* namespace ucbhelper */
     187             : 
     188             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10