Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / webdav / NeonLockStore.hxx
blobc8f0f0fcba991a0b7d533195af87249f77ebae0d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef INCLUDED_NEONLOCKSTORE_HXX
29 #define INCLUDED_NEONLOCKSTORE_HXX
31 #include <map>
32 #include "warnings_guard_ne_locks.h"
33 #include "osl/mutex.hxx"
34 #include "rtl/ref.hxx"
35 #include "NeonTypes.hxx"
37 namespace webdav_ucp
40 class TickerThread;
41 class NeonSession;
43 struct ltptr
45 bool operator()( const NeonLock * p1, const NeonLock * p2 ) const
47 return p1 < p2;
51 typedef struct _LockInfo
53 rtl::Reference< NeonSession > xSession;
54 sal_Int32 nLastChanceToSendRefreshRequest;
56 _LockInfo()
57 : nLastChanceToSendRefreshRequest( -1 ) {}
59 _LockInfo( rtl::Reference< NeonSession > const & _xSession,
60 sal_Int32 _nLastChanceToSendRefreshRequest )
61 : xSession( _xSession ),
62 nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {}
64 } LockInfo;
66 typedef std::map< NeonLock *, LockInfo, ltptr > LockInfoMap;
68 class NeonLockStore
70 osl::Mutex m_aMutex;
71 ne_lock_store * m_pNeonLockStore;
72 rtl::Reference< TickerThread > m_pTickerThread;
73 LockInfoMap m_aLockInfoMap;
75 public:
76 NeonLockStore();
77 ~NeonLockStore();
79 void registerSession( HttpSession * pHttpSession );
81 NeonLock * findByUri( rtl::OUString const & rUri );
83 void addLock( NeonLock * pLock,
84 rtl::Reference< NeonSession > const & xSession,
85 // time in seconds since Jan 1 1970
86 // -1: infinite lock, no refresh
87 sal_Int32 nLastChanceToSendRefreshRequest );
89 void updateLock( NeonLock * pLock,
90 sal_Int32 nLastChanceToSendRefreshRequest );
92 void removeLock( NeonLock * pLock );
94 void refreshLocks();
96 private:
97 void startTicker();
98 void stopTicker();
101 } // namespace webdav_ucp
103 #endif // INCLUDED_NEONLOCKSTORE_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */