summaryrefslogtreecommitdiff
path: root/include/svl/lockfilecommon.hxx
blob: f94e41b6cb20241e828906e6b0bb08f1034c1e1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef INCLUDED_SVL_LOCKFILECOMMON_HXX
#define INCLUDED_SVL_LOCKFILECOMMON_HXX

#include <svl/svldllapi.h>

#include <com/sun/star/uno/Sequence.hxx>

#include <osl/mutex.hxx>
#include <tools/urlobj.hxx>
#include <o3tl/enumarray.hxx>

#include <string_view>
#include <vector>

enum class LockFileComponent
{
    OOOUSERNAME, SYSUSERNAME, LOCALHOST, EDITTIME, USERURL, LAST=USERURL
};

typedef o3tl::enumarray<LockFileComponent,OUString> LockFileEntry;

namespace svt {

/// This is a general implementation that is used in document lock file implementation and in sharing control file implementation
class SVL_DLLPUBLIC LockFileCommon
{
private:
    OUString m_aURL;

protected:
    ::osl::Mutex m_aMutex;

    /// This method generates the URL of the lock file based on the document URL and the specified prefix.
    static OUString GenerateOwnLockFileURL(const OUString& aOrigURL, std::u16string_view aPrefix);

public:
    LockFileCommon(const OUString& aLockFileURL);
    virtual ~LockFileCommon();

    const OUString& GetURL() const;
    void SetURL(const OUString& aURL);

    static void ParseList( const css::uno::Sequence< sal_Int8 >& aBuffer, std::vector< LockFileEntry > &rOutput );
    static LockFileEntry ParseEntry( const css::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos );
    static OUString ParseName( const css::uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& o_nCurPos );
    static OUString EscapeCharacters( const OUString& aSource );
    static OUString GetOOOUserName();
    static OUString GetCurrentLocalTime();
    static LockFileEntry GenerateOwnEntry();

    static INetURLObject ResolveLinks( const INetURLObject& aDocURL );
};

}

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
prj?id=0bc90764bbd727ad6e054f2bcda9f867550cdeb1'>#i83647# For now disable build type OPENSSL. Bring back when really ↵Rüdiger Timm supported in configure. 2007-11-07INTEGRATION: CWS tkr05_SRC680 (1.26.22); FILE MERGEDRüdiger Timm 2007/10/04 07:16:00 tkr 1.26.22.1: #31053# https webdav support 2007-06-19INTEGRATION: CWS ucbfixes02 (1.24.2); FILE MERGEDKurt Zenker 2007/06/12 08:08:31 kso 1.24.2.2: RESYNC: (1.24-1.25); FILE MERGED 2007/05/31 14:08:22 kso 1.24.2.1: #i77995# - GVFS Content Provider does no longer use solar libs. 2007-06-05INTEGRATION: CWS bgdlremove (1.23.32); FILE MERGEDIvo Hinkelmann 2007/05/21 12:17:20 kso 1.23.32.2: RESYNC: (1.23-1.24); FILE MERGED 2007/05/11 14:09:42 kso 1.23.32.1: #i76911# - no longer uses VOS. 2007-05-10INTEGRATION: CWS ucbfixes01 (1.23.30); FILE MERGEDKurt Zenker 2007/04/20 14:17:57 kso 1.23.30.1: #i74980# - Upon redict on POST, do a GET. 2006-10-30INTEGRATION: CWS ause060 (1.22.28); FILE MERGEDRüdiger Timm 2006/09/22 18:08:52 hjs 1.22.28.1: #i69234# call required makefile 2006-10-24INTEGRATION: CWS pj59 (1.17.34); FILE MERGEDJens-Heiner Rechtien 2006/09/19 07:49:36 pjanik 1.17.34.1: #i69025#: Remove extraneous macosx-create-bundle call. 2006-05-24INTEGRATION: CWS ause043 (1.20.4); FILE MERGEDVladimir Glazounov 2006/05/15 15:51:21 hjs 1.20.4.2: RESYNC: (1.20-1.21); FILE MERGED 2005/10/31 16:56:04 hjs 1.20.4.1: #i56702# remove unneeded UNOTYPE definition 2006-04-20INTEGRATION: CWS pj53 (1.16.90); FILE MERGEDJens-Heiner Rechtien 2006/04/13 15:12:49 pjanik 1.16.90.1: #i61798#: Rename create-bundle to macosx-create-bundle. 2006-04-04INTEGRATION: CWS cmcfixes24 (1.20.38); FILE MERGEDVladimir Glazounov 2006/03/16 10:39:26 cmc 1.20.38.1: i63249# libxml2 -> LIBXML2:libxml2 2005-10-18INTEGRATION: CWS kso201bugs01 (1.19.26); FILE MERGEDRüdiger Timm 2005/08/24 11:39:24 kso 1.19.26.1: #122205# - libxml2 must be initialized before it can be used safely by multithreaded applications.