LCOV - code coverage report
Current view: top level - ucb/source/ucp/ftp - ftpurl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 6 10 60.0 %
Date: 2015-06-13 12:38:46 Functions: 5 12 41.7 %
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             :                                 TODO
      22             :  **************************************************************************
      23             : 
      24             :  *************************************************************************/
      25             : 
      26             : #ifndef INCLUDED_UCB_SOURCE_UCP_FTP_FTPURL_HXX
      27             : #define INCLUDED_UCB_SOURCE_UCP_FTP_FTPURL_HXX
      28             : 
      29             : #include "curl.hxx"
      30             : #include <curl/easy.h>
      31             : #include <com/sun/star/io/XOutputStream.hpp>
      32             : 
      33             : #include <rtl/ustring.hxx>
      34             : #include <osl/mutex.hxx>
      35             : #include <osl/file.h>
      36             : #include <vector>
      37             : 
      38             : #include "ftpdirp.hxx"
      39             : #include "ftpcfunc.hxx"
      40             : 
      41             : namespace ftp {
      42             : 
      43             :     /** Forward declarations.
      44             :      */
      45             : 
      46             :     class FTPHandleProvider;
      47             : 
      48             : 
      49             :     enum FTPErrors { FILE_EXIST_DURING_INSERT = CURL_LAST +1,
      50             :                      FOLDER_EXIST_DURING_INSERT,
      51             :                      FOLDER_MIGHT_EXIST_DURING_INSERT,
      52             :                      FILE_MIGHT_EXIST_DURING_INSERT };
      53             : 
      54           0 :     class malformed_exception : public std::exception { };
      55             : 
      56           1 :     class curl_exception : public std::exception
      57             :     {
      58             :     public:
      59             : 
      60           1 :         explicit curl_exception(sal_Int32 err)
      61           1 :             : n_err(err) { }
      62             : 
      63           2 :         sal_Int32 code() const { return n_err; }
      64             : 
      65             : 
      66             :     private:
      67             : 
      68             :         sal_Int32 n_err;
      69             :     };
      70             : 
      71           0 :     class CurlInput {
      72             :     public:
      73             :         // returns the number of bytes actually read
      74             :         virtual sal_Int32 read(sal_Int8 *dest,sal_Int32 nBytesRequested) = 0;
      75             : 
      76             :     protected:
      77           0 :         ~CurlInput() {}
      78             :     };
      79             : 
      80             : 
      81             :     class FTPURL
      82             :     {
      83             :     public:
      84             : 
      85             :         FTPURL(
      86             :             const OUString& aIdent,
      87             :             FTPHandleProvider* pFCP = 0
      88             :         )
      89             :             throw(
      90             :                 malformed_exception
      91             :             );
      92             : 
      93             :         FTPURL(const FTPURL& r);
      94             : 
      95             :         ~FTPURL();
      96             : 
      97           3 :         OUString host() const { return m_aHost; }
      98             : 
      99           2 :         OUString port() const { return m_aPort; }
     100             : 
     101           0 :         OUString username() const { return m_aUsername; }
     102             : 
     103             :         /** This returns the URL, but cleaned from
     104             :          *  unnessary ellipses.
     105             :          */
     106             : 
     107             :         OUString ident(bool withslash,bool internal) const;
     108             : 
     109             :         /** returns the parent url.
     110             :          */
     111             : 
     112             :         OUString parent(bool internal = false) const;
     113             : 
     114             :         /** sets the unencoded title */
     115             :         void child(const OUString& title);
     116             : 
     117             :         /** returns the unencoded title */
     118             :         OUString child() const;
     119             : 
     120             :         std::vector<FTPDirentry> list(sal_Int16 nMode) const
     121             :             throw(curl_exception);
     122             : 
     123             :         // returns a pointer to an open tempfile,
     124             :         // sought to the beginning of.
     125             :         oslFileHandle open() throw(curl_exception);
     126             : 
     127             :         FTPDirentry direntry() const
     128             :             throw(curl_exception, malformed_exception);
     129             : 
     130             :         void insert(bool ReplaceExisting,void* stream) const
     131             :             throw(curl_exception);
     132             : 
     133             :         void mkdir(bool ReplaceExisting) const
     134             :             throw(curl_exception, malformed_exception);
     135             : 
     136             :         OUString ren(const OUString& NewTitle)
     137             :             throw(curl_exception);
     138             : 
     139             :         void del() const
     140             :             throw(curl_exception, malformed_exception);
     141             : 
     142             : 
     143             :     private:
     144             : 
     145             :         FTPHandleProvider *m_pFCP;
     146             : 
     147             :         mutable OUString m_aUsername;
     148             :         bool m_bShowPassword;
     149             :         mutable OUString m_aHost;
     150             :         mutable OUString m_aPort;
     151             :         mutable OUString m_aType;
     152             : 
     153             :         /** Contains the encoded pathsegments of the url.
     154             :          */
     155             :         std::vector<OUString> m_aPathSegmentVec;
     156             : 
     157             :         void parse(const OUString& url)
     158             :             throw(
     159             :                 malformed_exception
     160             :             );
     161             : 
     162             :         OUString net_title() const throw(curl_exception);
     163             :     };
     164             : 
     165             : }
     166             : 
     167             : 
     168             : #endif
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11