cid#1607171 Data race condition
[LibreOffice.git] / ucb / source / ucp / gio / gio_datasupplier.hxx
blob86037d1660524ab70b7af7ec3c32a6fc1224f349
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <ucbhelper/resultset.hxx>
23 #include "gio_content.hxx"
24 #include <memory>
25 #include <vector>
27 namespace gio
30 class Content;
32 struct ResultListEntry
34 OUString aId;
35 css::uno::Reference< css::ucb::XContentIdentifier > xId;
36 css::uno::Reference< css::ucb::XContent > xContent;
37 css::uno::Reference< css::sdbc::XRow > xRow;
38 GFileInfo *pInfo;
40 explicit ResultListEntry( GFileInfo *pInInfo ) : pInfo(pInInfo)
42 g_object_ref( pInfo );
45 ~ResultListEntry()
47 g_object_unref( pInfo );
51 typedef std::vector< std::unique_ptr<ResultListEntry> > ResultList;
53 class DataSupplier : public ucbhelper::ResultSetDataSupplier
55 private:
56 rtl::Reference< ::gio::Content > mxContent;
57 sal_Int32 mnOpenMode;
58 bool mbCountFinal;
59 bool getData();
60 ResultList maResults;
61 public:
62 DataSupplier( rtl::Reference< Content > xContent, sal_Int32 nOpenMode );
63 virtual ~DataSupplier() override;
65 virtual OUString queryContentIdentifierString( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
66 virtual css::uno::Reference< css::ucb::XContentIdentifier >
67 queryContentIdentifier( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
68 virtual css::uno::Reference< css::ucb::XContent >
69 queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
71 virtual bool getResult( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
73 virtual sal_uInt32 totalCount(std::unique_lock<std::mutex>& rResultSetGuard) override;
74 virtual sal_uInt32 currentCount() override;
75 virtual bool isCountFinal() override;
77 virtual css::uno::Reference< css::sdbc::XRow >
78 queryPropertyValues( std::unique_lock<std::mutex>& rResultSetGuard, sal_uInt32 nIndex ) override;
79 virtual void releasePropertyValues( sal_uInt32 nIndex ) override;
81 virtual void close() override;
83 virtual void validate() override;
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */