LibreOffice Module ucb (master)  1
ftpurl.hxx
Go to the documentation of this file.
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/file.h>
35 #include <vector>
36 
37 #include "ftpdirp.hxx"
38 #include "ftpcfunc.hxx"
39 
40 namespace ftp {
41 
45  class FTPContentProvider;
46 
47 
50 
51  class malformed_exception : public std::exception { };
52 
53  class curl_exception : public std::exception
54  {
55  public:
56 
57  explicit curl_exception(sal_Int32 err)
58  : n_err(err) { }
59 
60  sal_Int32 code() const { return n_err; }
61 
62 
63  private:
64 
65  sal_Int32 const n_err;
66  };
67 
68  class CurlInput {
69  public:
70  // returns the number of bytes actually read
71  virtual sal_Int32 read(sal_Int8 *dest,sal_Int32 nBytesRequested) = 0;
72 
73  protected:
75  };
76 
77 
78  class FTPURL
79  {
80  public:
82  FTPURL(
83  const OUString& aIdent,
84  FTPContentProvider* pFCP
85  );
86 
87  FTPURL(const FTPURL& r);
88 
89  ~FTPURL();
90 
91  const OUString& host() const { return m_aHost; }
92 
93  const OUString& port() const { return m_aPort; }
94 
95  const OUString& username() const { return m_aUsername; }
96 
101  OUString ident(bool withslash,bool internal) const;
102 
106  OUString parent(bool internal = false) const;
107 
109  void child(const OUString& title);
110 
112  OUString child() const;
113 
115  std::vector<FTPDirentry> list(sal_Int16 nMode) const;
116 
117  // returns a pointer to an open tempfile,
118  // sought to the beginning of.
120  oslFileHandle open();
121 
124  FTPDirentry direntry() const;
125 
127  void insert(bool ReplaceExisting,void* stream) const;
128 
131  void mkdir(bool ReplaceExisting) const;
132 
134  OUString ren(const OUString& NewTitle);
135 
138  void del() const;
139 
140 
141  private:
142 
144 
145  mutable OUString m_aUsername;
147  mutable OUString m_aHost;
148  mutable OUString m_aPort;
149  mutable OUString m_aType;
150 
153  std::vector<OUString> m_aPathSegmentVec;
154 
156  void parse(const OUString& url);
157 
159  OUString net_title() const;
160  };
161 
162 }
163 
164 
165 #endif
166 
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & host() const
Definition: ftpurl.hxx:91
void parse(const OUString &url)
Definition: ftpurl.cxx:148
FTPURL(const OUString &aIdent, FTPContentProvider *pFCP)
Definition: ftpurl.cxx:132
signed char sal_Int8
sal_Int32 const n_err
Definition: ftpurl.hxx:65
sal_Int32 code() const
Definition: ftpurl.hxx:60
OUString net_title() const
Definition: ftpurl.cxx:510
const OUString & username() const
Definition: ftpurl.hxx:95
FTPErrors
Definition: ftpurl.hxx:48
OUString child() const
returns the unencoded title
Definition: ftpurl.cxx:347
void mkdir(bool ReplaceExisting) const
Definition: ftpurl.cxx:665
OUString parent(bool internal=false) const
returns the parent url.
Definition: ftpurl.cxx:289
std::vector< FTPDirentry > list(sal_Int16 nMode) const
Definition: ftpurl.cxx:424
FTPContentProvider * m_pFCP
Definition: ftpurl.hxx:143
FTPDirentry direntry() const
Definition: ftpurl.cxx:589
OUString m_aHost
Definition: ftpurl.hxx:147
OUString ren(const OUString &NewTitle)
Definition: ftpurl.cxx:714
void del() const
Definition: ftpurl.cxx:756
void insert(bool ReplaceExisting, void *stream) const
Definition: ftpurl.cxx:634
bool m_bShowPassword
Definition: ftpurl.hxx:146
Definition of ftpcontentprovider.
const OUString & port() const
Definition: ftpurl.hxx:93
virtual sal_Int32 read(sal_Int8 *dest, sal_Int32 nBytesRequested)=0
OUString m_aUsername
Definition: ftpurl.hxx:145
OUString m_aPort
Definition: ftpurl.hxx:148
oslFileHandle open()
Definition: ftpurl.cxx:387
OUString m_aType
Definition: ftpurl.hxx:149
curl_exception(sal_Int32 err)
Definition: ftpurl.hxx:57
OUString ident(bool withslash, bool internal) const
This returns the URL, but cleaned from unnessary ellipses.
Definition: ftpurl.cxx:240
std::vector< OUString > m_aPathSegmentVec
Contains the encoded pathsegments of the url.
Definition: ftpurl.hxx:153