Debian Codegraph @

ucb/source/ucp/webdav-curl/webdavdatasupplier.hxx

raw
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 #pragma once
22
23 #include <sal/config.h>
24
25 #include "ContentProperties.hxx"
26 #include <memory>
27 #include <rtl/ref.hxx>
28 #include <ucbhelper/resultset.hxx>
29
30 namespace http_dav_ucp {
31
32 class Content;
33
34 class DataSupplier : public ucbhelper::ResultSetDataSupplier
35 {
36 bool getData(std::unique_lock<std::mutex>& rResultSetGuard);
37
38 public:
39 DataSupplier( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
40 const rtl::Reference< Content >& rContent,
41 sal_Int32 nOpenMode);
42
43 virtual ~DataSupplier() override;
44
45 virtual OUString queryContentIdentifierString( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
46 virtual css::uno::Reference< css::ucb::XContentIdentifier >
47 queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
48 virtual css::uno::Reference< css::ucb::XContent >
49 queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
50
51 virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
52
53 virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& rResultSetGuard) override;
54 virtual sal_uInt32 currentCount() override;
55 virtual bool isCountFinal() override;
56
57 virtual css::uno::Reference< css::sdbc::XRow >
58 queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
59 virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
60
61 virtual void close() override;
62
63 virtual void validate() override;
64
65 private:
66 struct ResultListEntry
67 {
68 OUString aId;
69 css::uno::Reference< css::ucb::XContentIdentifier > xId;
70 css::uno::Reference< css::ucb::XContent > xContent;
71 css::uno::Reference< css::sdbc::XRow > xRow;
72 std::unique_ptr<ContentProperties> pData;
73
74 explicit ResultListEntry( std::unique_ptr<ContentProperties> && pEntry ) : pData( std::move(pEntry) ) {}
75 };
76
77 typedef std::vector<std::unique_ptr<ResultListEntry>> ResultList;
78
79 osl::Mutex m_aMutex;
80 ResultList m_Results;
81 rtl::Reference< Content > m_xContent;
82 css::uno::Reference< css::uno::XComponentContext > m_xContext;
83 sal_Int32 m_nOpenMode;
84 bool m_bCountFinal;
85 bool m_bThrowException;
86 };
87
88 }
89
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */