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#pragma once
27
28#include "curl.hxx"
29
30#include <rtl/ustring.hxx>
31#include <osl/file.h>
32#include <vector>
33
34#include "ftpdirp.hxx"
35
36namespace ftp {
37
41 class FTPContentProvider;
42
43
46
47 class malformed_exception : public std::exception { };
48
49 class curl_exception : public std::exception
50 {
51 public:
52
53 explicit curl_exception(sal_Int32 err)
54 : n_err(err) { }
55
56 sal_Int32 code() const { return n_err; }
57
58
59 private:
60
61 sal_Int32 n_err;
62 };
63
64 class CurlInput {
65 public:
66 // returns the number of bytes actually read
67 virtual sal_Int32 read(sal_Int8 *dest,sal_Int32 nBytesRequested) = 0;
68
69 protected:
71 };
72
73
74 class FTPURL
75 {
76 public:
78 FTPURL(
79 const OUString& aIdent,
81 );
82
83 FTPURL(const FTPURL& r);
84
85 ~FTPURL();
86
87 const OUString& host() const { return m_aHost; }
88
89 const OUString& port() const { return m_aPort; }
90
91 const OUString& username() const { return m_aUsername; }
92
97 OUString ident(bool withslash,bool internal) const;
98
102 OUString parent(bool internal = false) const;
103
105 void child(const OUString& title);
106
108 OUString child() const;
109
111 std::vector<FTPDirentry> list(sal_Int16 nMode) const;
112
113 // returns a pointer to an open tempfile,
114 // sought to the beginning of.
116 oslFileHandle open();
117
120 FTPDirentry direntry() const;
121
123 void insert(bool ReplaceExisting,void* stream) const;
124
127 void mkdir(bool ReplaceExisting) const;
128
130 OUString ren(const OUString& NewTitle);
131
134 void del() const;
135
136
137 private:
138
140
141 mutable OUString m_aUsername;
143 mutable OUString m_aHost;
144 mutable OUString m_aPort;
145 mutable OUString m_aType;
146
149 std::vector<OUString> m_aPathSegmentVec;
150
152 void parse(const OUString& url);
153
155 OUString net_title() const;
156 };
157
158}
159
160
161/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int32 read(sal_Int8 *dest, sal_Int32 nBytesRequested)=0
OUString m_aUsername
Definition: ftpurl.hxx:141
OUString net_title() const
Definition: ftpurl.cxx:514
void insert(bool ReplaceExisting, void *stream) const
Definition: ftpurl.cxx:638
oslFileHandle open()
Definition: ftpurl.cxx:391
const OUString & port() const
Definition: ftpurl.hxx:89
void parse(const OUString &url)
Definition: ftpurl.cxx:144
OUString parent(bool internal=false) const
returns the parent url.
Definition: ftpurl.cxx:289
OUString m_aType
Definition: ftpurl.hxx:145
FTPDirentry direntry() const
Definition: ftpurl.cxx:593
OUString child() const
returns the unencoded title
Definition: ftpurl.cxx:347
std::vector< FTPDirentry > list(sal_Int16 nMode) const
Definition: ftpurl.cxx:428
const OUString & username() const
Definition: ftpurl.hxx:91
bool m_bShowPassword
Definition: ftpurl.hxx:142
std::vector< OUString > m_aPathSegmentVec
Contains the encoded pathsegments of the url.
Definition: ftpurl.hxx:149
OUString ren(const OUString &NewTitle)
Definition: ftpurl.cxx:718
const OUString & host() const
Definition: ftpurl.hxx:87
OUString ident(bool withslash, bool internal) const
This returns the URL, but cleaned from unnecessary ellipses.
Definition: ftpurl.cxx:240
OUString m_aPort
Definition: ftpurl.hxx:144
void mkdir(bool ReplaceExisting) const
Definition: ftpurl.cxx:669
FTPURL(const OUString &aIdent, FTPContentProvider *pFCP)
Definition: ftpurl.cxx:128
void del() const
Definition: ftpurl.cxx:758
FTPContentProvider * m_pFCP
Definition: ftpurl.hxx:139
OUString m_aHost
Definition: ftpurl.hxx:143
sal_Int32 n_err
Definition: ftpurl.hxx:61
sal_Int32 code() const
Definition: ftpurl.hxx:56
curl_exception(sal_Int32 err)
Definition: ftpurl.hxx:53
err
Definition of ftpcontentprovider.
FTPErrors
Definition: ftpurl.hxx:44
@ FOLDER_MIGHT_EXIST_DURING_INSERT
Definition: ftpurl.hxx:44
@ FILE_MIGHT_EXIST_DURING_INSERT
Definition: ftpurl.hxx:45
signed char sal_Int8