LCOV - code coverage report
Current view: top level - ucb/source/ucp/ftp - ftpurl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 8 62.5 %
Date: 2012-08-25 Functions: 4 7 57.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : /**************************************************************************
      30                 :            :                                 TODO
      31                 :            :  **************************************************************************
      32                 :            : 
      33                 :            :  *************************************************************************/
      34                 :            : 
      35                 :            : #ifndef _FTP_FTPURL_HXX_
      36                 :            : #define _FTP_FTPURL_HXX_
      37                 :            : 
      38                 :            : #include "curl.hxx"
      39                 :            : #include <curl/easy.h>
      40                 :            : #include <com/sun/star/io/XOutputStream.hpp>
      41                 :            : 
      42                 :            : #include <stdio.h>
      43                 :            : #include <rtl/ustring.hxx>
      44                 :            : #include <osl/mutex.hxx>
      45                 :            : #include <vector>
      46                 :            : 
      47                 :            : #include "ftpdirp.hxx"
      48                 :            : #include "ftpcfunc.hxx"
      49                 :            : 
      50                 :            : namespace ftp {
      51                 :            : 
      52                 :            :     /** Forward declarations.
      53                 :            :      */
      54                 :            : 
      55                 :            :     class FTPHandleProvider;
      56                 :            : 
      57                 :            : 
      58                 :            :     enum FTPErrors { FILE_EXIST_DURING_INSERT = CURL_LAST +1,
      59                 :            :                      FOLDER_EXIST_DURING_INSERT,
      60                 :            :                      FOLDER_MIGHT_EXIST_DURING_INSERT,
      61                 :            :                      FILE_MIGHT_EXIST_DURING_INSERT };
      62                 :            : 
      63                 :            : 
      64                 :            :     class malformed_exception { };
      65                 :            : 
      66                 :            : 
      67                 :            :     class curl_exception
      68                 :            :     {
      69                 :            :     public:
      70                 :            : 
      71                 :          2 :         curl_exception(sal_Int32 err)
      72                 :          2 :             : n_err(err) { }
      73                 :            : 
      74                 :          4 :         sal_Int32 code() const { return n_err; }
      75                 :            : 
      76                 :            : 
      77                 :            :     private:
      78                 :            : 
      79                 :            :         sal_Int32 n_err;
      80                 :            :     };
      81                 :            : 
      82                 :          0 :     class CurlInput {
      83                 :            :     public:
      84                 :            :         // returns the number of bytes actually read
      85                 :            :         virtual sal_Int32 read(sal_Int8 *dest,sal_Int32 nBytesRequested) = 0;
      86                 :            : 
      87                 :            :     protected:
      88                 :          0 :         ~CurlInput() {}
      89                 :            :     };
      90                 :            : 
      91                 :            : 
      92                 :            :     class FTPURL
      93                 :            :     {
      94                 :            :     public:
      95                 :            : 
      96                 :            :         FTPURL(
      97                 :            :             const rtl::OUString& aIdent,
      98                 :            :             FTPHandleProvider* pFCP = 0
      99                 :            :         )
     100                 :            :             throw(
     101                 :            :                 malformed_exception
     102                 :            :             );
     103                 :            : 
     104                 :            :         FTPURL(const FTPURL& r);
     105                 :            : 
     106                 :            :         ~FTPURL();
     107                 :            : 
     108                 :          6 :         rtl::OUString host() const { return m_aHost; }
     109                 :            : 
     110                 :          4 :         rtl::OUString port() const { return m_aPort; }
     111                 :            : 
     112                 :          0 :         rtl::OUString username() const { return m_aUsername; }
     113                 :            : 
     114                 :            :         /** This returns the URL, but cleaned from
     115                 :            :          *  unnessary ellipses.
     116                 :            :          */
     117                 :            : 
     118                 :            :         rtl::OUString ident(bool withslash,bool internal) const;
     119                 :            : 
     120                 :            :         /** returns the parent url.
     121                 :            :          */
     122                 :            : 
     123                 :            :         rtl::OUString parent(bool internal = false) const;
     124                 :            : 
     125                 :            :         /** sets the unencoded title */
     126                 :            :         void child(const rtl::OUString& title);
     127                 :            : 
     128                 :            :         /** returns the unencoded title */
     129                 :            :         rtl::OUString child(void) const;
     130                 :            : 
     131                 :            :         std::vector<FTPDirentry> list(sal_Int16 nMode) const
     132                 :            :             throw(curl_exception);
     133                 :            : 
     134                 :            :         // returns a pointer to an open tempfile,
     135                 :            :         // seeked to the beginning of.
     136                 :            :         FILE* open() throw(curl_exception);
     137                 :            : 
     138                 :            :         FTPDirentry direntry() const throw(curl_exception);
     139                 :            : 
     140                 :            :         void insert(bool ReplaceExisting,void* stream) const
     141                 :            :             throw(curl_exception);
     142                 :            : 
     143                 :            :         void mkdir(bool ReplaceExisting) const
     144                 :            :             throw(curl_exception);
     145                 :            : 
     146                 :            :         rtl::OUString ren(const rtl::OUString& NewTitle)
     147                 :            :             throw(curl_exception);
     148                 :            : 
     149                 :            :         void del() const
     150                 :            :             throw(curl_exception);
     151                 :            : 
     152                 :            : 
     153                 :            :     private:
     154                 :            : 
     155                 :            :         osl::Mutex m_mutex;
     156                 :            : 
     157                 :            :         FTPHandleProvider *m_pFCP;
     158                 :            : 
     159                 :            :         mutable rtl::OUString m_aUsername;
     160                 :            :         bool m_bShowPassword;
     161                 :            :         mutable rtl::OUString m_aHost;
     162                 :            :         mutable rtl::OUString m_aPort;
     163                 :            :         mutable rtl::OUString m_aType;
     164                 :            : 
     165                 :            :         /** Contains the encoded pathsegments of the url.
     166                 :            :          */
     167                 :            :         std::vector<rtl::OUString> m_aPathSegmentVec;
     168                 :            : 
     169                 :            :         void parse(const rtl::OUString& url)
     170                 :            :             throw(
     171                 :            :                 malformed_exception
     172                 :            :             );
     173                 :            : 
     174                 :            :         rtl::OUString net_title() const throw(curl_exception);
     175                 :            :     };
     176                 :            : 
     177                 :            : }
     178                 :            : 
     179                 :            : 
     180                 :            : #endif
     181                 :            : 
     182                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10