fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / webdav / SerfLockStore.hxx
blob82f1a7717a2861272e81d2e42024ed02a2c10e99
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 .
21 #ifndef INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFLOCKSTORE_HXX
22 #define INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFLOCKSTORE_HXX
24 #include <map>
25 #include <osl/mutex.hxx>
26 #include <rtl/ref.hxx>
27 #include <rtl/ustring.hxx>
28 #include <SerfSession.hxx>
30 namespace http_dav_ucp
33 class TickerThread;
35 struct LockInfo
37 OUString m_sToken;
38 rtl::Reference< SerfSession > m_xSession;
39 sal_Int32 m_nLastChanceToSendRefreshRequest;
41 LockInfo()
42 : m_nLastChanceToSendRefreshRequest( -1 ) {}
44 LockInfo( const OUString& sToken,
45 rtl::Reference< SerfSession > const & xSession,
46 sal_Int32 nLastChanceToSendRefreshRequest )
47 : m_sToken( sToken ),
48 m_xSession( xSession ),
49 m_nLastChanceToSendRefreshRequest( nLastChanceToSendRefreshRequest ) {}
52 typedef std::map< OUString, LockInfo > LockInfoMap;
54 class SerfLockStore
56 osl::Mutex m_aMutex;
57 TickerThread * m_pTickerThread;
58 bool m_bFinishing;
59 LockInfoMap m_aLockInfoMap;
61 public:
62 SerfLockStore();
63 ~SerfLockStore();
65 bool finishing() const;
66 OUString getLockToken( const OUString& rLock );
68 void addLock( const OUString& rLock,
69 const OUString& sToken,
70 rtl::Reference< SerfSession > const & xSession,
71 // time in seconds since Jan 1 1970
72 // -1: infinite lock, no refresh
73 sal_Int32 nLastChanceToSendRefreshRequest );
75 void updateLock( const OUString& rLock,
76 sal_Int32 nLastChanceToSendRefreshRequest );
78 void removeLock( const OUString& rLock );
80 void refreshLocks();
82 private:
83 void startTicker();
84 void stopTicker();
87 } // namespace http_dav_ucp
89 #endif // INCLUDED_UCB_SOURCE_UCP_WEBDAV_SERFLOCKSTORE_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */