1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ftpurl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 /**************************************************************************
33 **************************************************************************
35 *************************************************************************/
37 #ifndef _FTP_FTPURL_HXX_
38 #define _FTP_FTPURL_HXX_
41 #include <curl/easy.h>
42 #include <com/sun/star/io/XOutputStream.hpp>
45 #include <rtl/ustring.hxx>
46 #include <osl/mutex.hxx>
49 #include "ftpdirp.hxx"
50 #include "ftpcfunc.hxx"
54 /** Forward declarations.
57 class FTPHandleProvider
;
60 enum FTPErrors
{ FILE_EXIST_DURING_INSERT
= CURL_LAST
+1,
61 FOLDER_EXIST_DURING_INSERT
,
62 FOLDER_MIGHT_EXIST_DURING_INSERT
,
63 FILE_MIGHT_EXIST_DURING_INSERT
};
66 class malformed_exception
{ };
73 curl_exception(sal_Int32 err
)
76 sal_Int32
code() const { return n_err
; }
88 // returns the number of bytes actually read
89 virtual sal_Int32
read(sal_Int8
*dest
,sal_Int32 nBytesRequested
) = 0;
98 const rtl::OUString
& aIdent
,
99 FTPHandleProvider
* pFCP
= 0
105 FTPURL(const FTPURL
& r
);
109 rtl::OUString
host() const { return m_aHost
; }
111 rtl::OUString
port() const { return m_aPort
; }
113 rtl::OUString
username() const { return m_aUsername
; }
115 /** This returns the URL, but cleaned from
116 * unnessary ellipses.
119 rtl::OUString
ident(bool withslash
,bool internal
) const;
121 /** returns the parent url.
124 rtl::OUString
parent(bool internal
= false) const;
126 /** sets the unencoded title */
127 void child(const rtl::OUString
& title
);
129 /** returns the unencoded title */
130 rtl::OUString
child(void) const;
132 std::vector
<FTPDirentry
> list(sal_Int16 nMode
) const
133 throw(curl_exception
);
135 // returns a pointer to an open tempfile,
136 // seeked to the beginning of.
137 FILE* open() throw(curl_exception
);
139 FTPDirentry
direntry() const throw(curl_exception
);
141 void insert(bool ReplaceExisting
,void* stream
) const
142 throw(curl_exception
);
144 void mkdir(bool ReplaceExisting
) const
145 throw(curl_exception
);
147 rtl::OUString
ren(const rtl::OUString
& NewTitle
)
148 throw(curl_exception
);
151 throw(curl_exception
);
158 FTPHandleProvider
*m_pFCP
;
160 mutable rtl::OUString m_aUsername
;
161 bool m_bShowPassword
;
162 mutable rtl::OUString m_aHost
;
163 mutable rtl::OUString m_aPort
;
164 mutable rtl::OUString m_aType
;
166 /** Contains the encoded pathsegments of the url.
168 std::vector
<rtl::OUString
> m_aPathSegmentVec
;
170 void parse(const rtl::OUString
& url
)
175 rtl::OUString
net_title() const throw(curl_exception
);