bump product version to 4.1.6.2
[LibreOffice.git] / ucb / source / ucp / ftp / ftpurl.hxx
blob76603d2d9d8285765ae66942d5a66a3252e52f9a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 /**************************************************************************
21 TODO
22 **************************************************************************
24 *************************************************************************/
26 #ifndef _FTP_FTPURL_HXX_
27 #define _FTP_FTPURL_HXX_
29 #include "curl.hxx"
30 #include <curl/easy.h>
31 #include <com/sun/star/io/XOutputStream.hpp>
33 #include <stdio.h>
34 #include <rtl/ustring.hxx>
35 #include <osl/mutex.hxx>
36 #include <vector>
38 #include "ftpdirp.hxx"
39 #include "ftpcfunc.hxx"
41 namespace ftp {
43 /** Forward declarations.
46 class FTPHandleProvider;
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 };
55 class malformed_exception { };
58 class curl_exception
60 public:
62 curl_exception(sal_Int32 err)
63 : n_err(err) { }
65 sal_Int32 code() const { return n_err; }
68 private:
70 sal_Int32 n_err;
73 class CurlInput {
74 public:
75 // returns the number of bytes actually read
76 virtual sal_Int32 read(sal_Int8 *dest,sal_Int32 nBytesRequested) = 0;
78 protected:
79 ~CurlInput() {}
83 class FTPURL
85 public:
87 FTPURL(
88 const OUString& aIdent,
89 FTPHandleProvider* pFCP = 0
91 throw(
92 malformed_exception
95 FTPURL(const FTPURL& r);
97 ~FTPURL();
99 OUString host() const { return m_aHost; }
101 OUString port() const { return m_aPort; }
103 OUString username() const { return m_aUsername; }
105 /** This returns the URL, but cleaned from
106 * unnessary ellipses.
109 OUString ident(bool withslash,bool internal) const;
111 /** returns the parent url.
114 OUString parent(bool internal = false) const;
116 /** sets the unencoded title */
117 void child(const OUString& title);
119 /** returns the unencoded title */
120 OUString child(void) const;
122 std::vector<FTPDirentry> list(sal_Int16 nMode) const
123 throw(curl_exception);
125 // returns a pointer to an open tempfile,
126 // seeked to the beginning of.
127 FILE* open() throw(curl_exception);
129 FTPDirentry direntry() const throw(curl_exception);
131 void insert(bool ReplaceExisting,void* stream) const
132 throw(curl_exception);
134 void mkdir(bool ReplaceExisting) const
135 throw(curl_exception);
137 OUString ren(const OUString& NewTitle)
138 throw(curl_exception);
140 void del() const
141 throw(curl_exception);
144 private:
146 osl::Mutex m_mutex;
148 FTPHandleProvider *m_pFCP;
150 mutable OUString m_aUsername;
151 bool m_bShowPassword;
152 mutable OUString m_aHost;
153 mutable OUString m_aPort;
154 mutable OUString m_aType;
156 /** Contains the encoded pathsegments of the url.
158 std::vector<OUString> m_aPathSegmentVec;
160 void parse(const OUString& url)
161 throw(
162 malformed_exception
165 OUString net_title() const throw(curl_exception);
171 #endif
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */