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 
31 #include <rtl/ustring.hxx>
32 #include <osl/file.h>
33 #include <vector>
34 
35 #include "ftpdirp.hxx"
36 
37 namespace ftp {
38 
42  class FTPContentProvider;
43 
44 
47 
48  class malformed_exception : public std::exception { };
49 
50  class curl_exception : public std::exception
51  {
52  public:
53 
54  explicit curl_exception(sal_Int32 err)
55  : n_err(err) { }
56 
57  sal_Int32 code() const { return n_err; }
58 
59 
60  private:
61 
62  sal_Int32 const n_err;
63  };
64 
65  class CurlInput {
66  public:
67  // returns the number of bytes actually read
68  virtual sal_Int32 read(sal_Int8 *dest,sal_Int32 nBytesRequested) = 0;
69 
70  protected:
72  };
73 
74 
75  class FTPURL
76  {
77  public:
79  FTPURL(
80  const OUString& aIdent,
81  FTPContentProvider* pFCP
82  );
83 
84  FTPURL(const FTPURL& r);
85 
86  ~FTPURL();
87 
88  const OUString& host() const { return m_aHost; }
89 
90  const OUString& port() const { return m_aPort; }
91 
92  const OUString& username() const { return m_aUsername; }
93 
98  OUString ident(bool withslash,bool internal) const;
99 
103  OUString parent(bool internal = false) const;
104 
106  void child(const OUString& title);
107 
109  OUString child() const;
110 
112  std::vector<FTPDirentry> list(sal_Int16 nMode) const;
113 
114  // returns a pointer to an open tempfile,
115  // sought to the beginning of.
117  oslFileHandle open();
118 
121  FTPDirentry direntry() const;
122 
124  void insert(bool ReplaceExisting,void* stream) const;
125 
128  void mkdir(bool ReplaceExisting) const;
129 
131  OUString ren(const OUString& NewTitle);
132 
135  void del() const;
136 
137 
138  private:
139 
141 
142  mutable OUString m_aUsername;
144  mutable OUString m_aHost;
145  mutable OUString m_aPort;
146  mutable OUString m_aType;
147 
150  std::vector<OUString> m_aPathSegmentVec;
151 
153  void parse(const OUString& url);
154 
156  OUString net_title() const;
157  };
158 
159 }
160 
161 
162 #endif
163 
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & host() const
Definition: ftpurl.hxx:88
void parse(const OUString &url)
Definition: ftpurl.cxx:145
FTPURL(const OUString &aIdent, FTPContentProvider *pFCP)
Definition: ftpurl.cxx:129
signed char sal_Int8
sal_Int32 const n_err
Definition: ftpurl.hxx:62
sal_Int32 code() const
Definition: ftpurl.hxx:57
OUString net_title() const
Definition: ftpurl.cxx:511
const OUString & username() const
Definition: ftpurl.hxx:92
FTPErrors
Definition: ftpurl.hxx:45
OUString child() const
returns the unencoded title
Definition: ftpurl.cxx:344
void mkdir(bool ReplaceExisting) const
Definition: ftpurl.cxx:666
OUString parent(bool internal=false) const
returns the parent url.
Definition: ftpurl.cxx:286
std::vector< FTPDirentry > list(sal_Int16 nMode) const
Definition: ftpurl.cxx:425
FTPContentProvider * m_pFCP
Definition: ftpurl.hxx:140
FTPDirentry direntry() const
Definition: ftpurl.cxx:590
OUString m_aHost
Definition: ftpurl.hxx:144
OUString ren(const OUString &NewTitle)
Definition: ftpurl.cxx:715
void del() const
Definition: ftpurl.cxx:755
void insert(bool ReplaceExisting, void *stream) const
Definition: ftpurl.cxx:635
bool m_bShowPassword
Definition: ftpurl.hxx:143
Definition of ftpcontentprovider.
const OUString & port() const
Definition: ftpurl.hxx:90
virtual sal_Int32 read(sal_Int8 *dest, sal_Int32 nBytesRequested)=0
OUString m_aUsername
Definition: ftpurl.hxx:142
OUString m_aPort
Definition: ftpurl.hxx:145
oslFileHandle open()
Definition: ftpurl.cxx:388
OUString m_aType
Definition: ftpurl.hxx:146
curl_exception(sal_Int32 err)
Definition: ftpurl.hxx:54
OUString ident(bool withslash, bool internal) const
This returns the URL, but cleaned from unnessary ellipses.
Definition: ftpurl.cxx:237
std::vector< OUString > m_aPathSegmentVec
Contains the encoded pathsegments of the url.
Definition: ftpurl.hxx:150