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

Generated by: LCOV version 1.10