LibreOffice Module ucb (master) 1
ftpcontentprovider.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#pragma once
21
22#include <vector>
25#include <com/sun/star/lang/XSingleServiceFactory.hpp>
26#include <com/sun/star/lang/XMultiServiceFactory.hpp>
27#include "curl.hxx"
28
29// UNO service name for the provider. This name will be used by the UCB to
30// create instances of the provider.
31
32inline constexpr OUStringLiteral FTP_CONTENT_PROVIDER_SERVICE_NAME = u"com.sun.star.ucb.FTPContentProvider";
33inline constexpr OUStringLiteral FTP_CONTENT_TYPE = u"application/ftp-content";
34
38namespace ftp
39{
40 class FTPLoaderThread;
41
44 {
45 public:
46
47 explicit FTPContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
48
49 virtual ~FTPContentProvider() override;
50
51 // XInterface
52 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
53 virtual void SAL_CALL acquire()
54 noexcept override;
55 virtual void SAL_CALL release()
56 noexcept override;
57
58 // XTypeProvider
59 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
60 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
61
62 // XServiceInfo
63 virtual OUString SAL_CALL getImplementationName() override;
64 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
65 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
66
67 // XContentProvider
68 virtual css::uno::Reference< css::ucb::XContent > SAL_CALL
69 queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
70
71 CURL* handle();
72
76 void forHost(std::u16string_view host,
77 std::u16string_view port,
78 std::u16string_view username,
79 OUString& password,
80 OUString& account);
81
82 bool setHost(const OUString& host,
83 const OUString& port,
84 const OUString& username,
85 const OUString& password,
86 const OUString& account);
87
89 {
90 OUString host;
91 OUString port;
92 OUString username;
93 OUString password;
94 OUString account;
95 };
96
97 private:
98 std::unique_ptr<FTPLoaderThread> m_ftpLoaderThread;
99 std::unique_ptr<ucbhelper::InternetProxyDecider> m_pProxyDecider;
100 std::vector<ServerInfo> m_ServerInfo;
101
102 void init();
103 }; // end class FTPContentProvider
104
105} // end namespace ftp
106
107/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void forHost(std::u16string_view host, std::u16string_view port, std::u16string_view username, OUString &password, OUString &account)
host is in the form host:port.
FTPContentProvider(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual ~FTPContentProvider() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
bool setHost(const OUString &host, const OUString &port, const OUString &username, const OUString &password, const OUString &account)
std::unique_ptr< FTPLoaderThread > m_ftpLoaderThread
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent(const css::uno::Reference< css::ucb::XContentIdentifier > &Identifier) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
std::vector< ServerInfo > m_ServerInfo
virtual OUString SAL_CALL getImplementationName() override
std::unique_ptr< ucbhelper::InternetProxyDecider > m_pProxyDecider
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
float u
constexpr OUStringLiteral FTP_CONTENT_TYPE
constexpr OUStringLiteral FTP_CONTENT_PROVIDER_SERVICE_NAME
Definition of ftpcontentprovider.
unsigned char sal_Bool