1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 /**************************************************************************
31 **************************************************************************
33 *************************************************************************/
35 #ifndef _FTP_FTPURL_HXX_
36 #define _FTP_FTPURL_HXX_
39 #include <curl/easy.h>
40 #include <com/sun/star/io/XOutputStream.hpp>
43 #include <rtl/ustring.hxx>
44 #include <osl/mutex.hxx>
47 #include "ftpdirp.hxx"
48 #include "ftpcfunc.hxx"
52 /** Forward declarations.
55 class FTPHandleProvider
;
58 enum FTPErrors
{ FILE_EXIST_DURING_INSERT
= CURL_LAST
+1,
59 FOLDER_EXIST_DURING_INSERT
,
60 FOLDER_MIGHT_EXIST_DURING_INSERT
,
61 FILE_MIGHT_EXIST_DURING_INSERT
};
64 class malformed_exception
{ };
71 curl_exception(sal_Int32 err
)
74 sal_Int32
code() const { return n_err
; }
84 // returns the number of bytes actually read
85 virtual sal_Int32
read(sal_Int8
*dest
,sal_Int32 nBytesRequested
) = 0;
97 const rtl::OUString
& aIdent
,
98 FTPHandleProvider
* pFCP
= 0
104 FTPURL(const FTPURL
& r
);
108 rtl::OUString
host() const { return m_aHost
; }
110 rtl::OUString
port() const { return m_aPort
; }
112 rtl::OUString
username() const { return m_aUsername
; }
114 /** This returns the URL, but cleaned from
115 * unnessary ellipses.
118 rtl::OUString
ident(bool withslash
,bool internal
) const;
120 /** returns the parent url.
123 rtl::OUString
parent(bool internal
= false) const;
125 /** sets the unencoded title */
126 void child(const rtl::OUString
& title
);
128 /** returns the unencoded title */
129 rtl::OUString
child(void) const;
131 std::vector
<FTPDirentry
> list(sal_Int16 nMode
) const
132 throw(curl_exception
);
134 // returns a pointer to an open tempfile,
135 // seeked to the beginning of.
136 FILE* open() throw(curl_exception
);
138 FTPDirentry
direntry() const throw(curl_exception
);
140 void insert(bool ReplaceExisting
,void* stream
) const
141 throw(curl_exception
);
143 void mkdir(bool ReplaceExisting
) const
144 throw(curl_exception
);
146 rtl::OUString
ren(const rtl::OUString
& NewTitle
)
147 throw(curl_exception
);
150 throw(curl_exception
);
157 FTPHandleProvider
*m_pFCP
;
159 mutable rtl::OUString m_aUsername
;
160 bool m_bShowPassword
;
161 mutable rtl::OUString m_aHost
;
162 mutable rtl::OUString m_aPort
;
163 mutable rtl::OUString m_aType
;
165 /** Contains the encoded pathsegments of the url.
167 std::vector
<rtl::OUString
> m_aPathSegmentVec
;
169 void parse(const rtl::OUString
& url
)
174 rtl::OUString
net_title() const throw(curl_exception
);
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */