LCOV - code coverage report
Current view: top level - libreoffice/sot/source/base - filelist.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 47 0.0 %
Date: 2012-12-27 Functions: 0 17 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             : #include <tools/stream.hxx>
      22             : #include <tools/string.hxx>
      23             : #include <tools/rtti.hxx>
      24             : #include <sot/exchange.hxx>
      25             : #include<sot/filelist.hxx>
      26             : #include <osl/thread.h>
      27             : 
      28           0 : TYPEINIT1_AUTOFACTORY( FileList, SvDataCopyStream );
      29             : 
      30             : /*************************************************************************
      31             : |*
      32             : |*    FileList - Ctor/Dtor
      33             : |*
      34             : \*************************************************************************/
      35             : 
      36           0 : FileList::~FileList()
      37             : {
      38           0 :     ClearAll();
      39           0 : }
      40             : 
      41           0 : void FileList::ClearAll( void )
      42             : {
      43           0 :     for ( size_t i = 0, n = aStrList.size(); i < n; ++i )
      44           0 :         delete aStrList[ i ];
      45           0 :     aStrList.clear();
      46           0 : }
      47             : 
      48             : /*************************************************************************
      49             : |*
      50             : |*    FileList - Zuweisungsoperator
      51             : |*
      52             : \*************************************************************************/
      53             : 
      54           0 : FileList& FileList::operator=( const FileList& rFileList )
      55             : {
      56           0 :     for ( size_t i = 0, n = rFileList.aStrList.size(); i < n; ++i )
      57           0 :         aStrList.push_back( new String( *rFileList.aStrList[ i ] ) );
      58           0 :     return *this;
      59             : }
      60             : 
      61             : /******************************************************************************
      62             : |*
      63             : |*  virtuelle SvData-Methoden
      64             : |*
      65             : \******************************************************************************/
      66             : 
      67           0 : void FileList::Load( SvStream& rIStm )
      68             : {
      69           0 :     rIStm >> *this;
      70           0 : }
      71             : 
      72           0 : void FileList::Save( SvStream& rOStm )
      73             : {
      74           0 :     rOStm << *this;
      75           0 : }
      76             : 
      77           0 : void FileList::Assign( const SvDataCopyStream& rCopyStream )
      78             : {
      79           0 :     *this = (const FileList&)rCopyStream;
      80           0 : }
      81             : 
      82             : /******************************************************************************
      83             : |*
      84             : |*  Stream-Operatoren
      85             : |*
      86             : \******************************************************************************/
      87             : 
      88             : /*
      89             :  * NOTE: to correctly handle this Protocol with Unicode, native Win32 must be called:
      90             :  * e.g. DropQueryFile
      91             :  */
      92             : 
      93           0 : SvStream& operator<<( SvStream& rOStm, SAL_UNUSED_PARAMETER const FileList& )
      94             : {
      95             :     OSL_FAIL("TODO: Not implemented!");
      96           0 :     return rOStm;
      97             : }
      98             : 
      99             : /* #i28176#
     100             :    The Windows clipboard bridge now provides a double '\0'
     101             :    terminated list of file names for format SOT_FORMAT_FILE_LIST
     102             :    instead of the original Windows Sv_DROPFILES structure. All strings
     103             :    in this list are UTF16 strings. Shell link files will be already
     104             :    resolved by the Windows clipboard bridge.*/
     105           0 : SvStream& operator>>( SvStream& rIStm, FileList& rFileList )
     106             : {
     107           0 :     rFileList.ClearAll();
     108             : 
     109           0 :     String aStr;
     110             :     sal_uInt16 c;
     111             : 
     112           0 :     while (!rIStm.IsEof())
     113             :     {
     114           0 :         aStr.Erase();
     115             : 
     116             :         // read first character of filepath; c==0 > reach end of stream
     117           0 :         rIStm >> c;
     118           0 :         if (!c)
     119           0 :             break;
     120             : 
     121             :         // read string till c==0
     122           0 :         while (c && !rIStm.IsEof())
     123             :         {
     124           0 :             aStr += (sal_Unicode)c;
     125           0 :             rIStm >> c;
     126             :         }
     127             : 
     128             :         // append the filepath
     129           0 :         rFileList.AppendFile(aStr);
     130             :     }
     131           0 :     return rIStm;
     132             : }
     133             : 
     134             : /******************************************************************************
     135             : |*
     136             : |*  Liste fuellen/abfragen
     137             : |*
     138             : \******************************************************************************/
     139             : 
     140           0 : void FileList::AppendFile( const String& rStr )
     141             : {
     142           0 :     aStrList.push_back( new String( rStr ) );
     143           0 : }
     144             : 
     145           0 : String FileList::GetFile( size_t i ) const
     146             : {
     147           0 :     String aStr;
     148           0 :     if( i < aStrList.size() )
     149           0 :         aStr = *aStrList[ i ];
     150           0 :     return aStr;
     151             : }
     152             : 
     153           0 : size_t FileList::Count( void ) const
     154             : {
     155           0 :     return aStrList.size();
     156             : }
     157             : 
     158             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10