Branch libreoffice-5-0-4
[LibreOffice.git] / include / tools / config.hxx
blobd4b503064a1b17baad6490d1f2c3bb273bc06091
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 .
19 #ifndef INCLUDED_TOOLS_CONFIG_HXX
20 #define INCLUDED_TOOLS_CONFIG_HXX
22 #include <tools/toolsdllapi.h>
23 #include <rtl/ustring.hxx>
25 struct ImplConfigData;
26 struct ImplGroupData;
28 class TOOLS_DLLPUBLIC Config
30 private:
31 OUString maFileName;
32 OString maGroupName;
33 ImplConfigData* mpData;
34 ImplGroupData* mpActGroup;
35 sal_uIntPtr mnDataUpdateId;
36 sal_uInt16 mnLockCount;
37 bool mbPersistence;
39 TOOLS_DLLPRIVATE bool ImplUpdateConfig() const;
40 TOOLS_DLLPRIVATE ImplGroupData* ImplGetGroup() const;
42 public:
43 Config( const OUString& rFileName );
44 ~Config();
46 const OUString& GetPathName() const { return maFileName; }
48 void SetGroup(const OString& rGroup);
49 const OString& GetGroup() const { return maGroupName; }
50 void DeleteGroup(const OString& rGroup);
51 OString GetGroupName(sal_uInt16 nGroup) const;
52 sal_uInt16 GetGroupCount() const;
53 bool HasGroup(const OString& rGroup) const;
55 OString ReadKey(const OString& rKey) const;
56 OString ReadKey(const OString& rKey, const OString& rDefault) const;
57 void WriteKey(const OString& rKey, const OString& rValue);
58 void DeleteKey(const OString& rKey);
59 OString GetKeyName(sal_uInt16 nKey) const;
60 OString ReadKey(sal_uInt16 nKey) const;
61 sal_uInt16 GetKeyCount() const;
63 bool IsLocked() const { return (mnLockCount != 0); }
64 void Flush();
66 void EnablePersistence( bool bPersistence = true )
67 { mbPersistence = bPersistence; }
68 bool IsPersistenceEnabled() const { return mbPersistence; }
70 private:
71 Config( const Config& rConfig ) SAL_DELETED_FUNCTION;
72 Config& operator = ( const Config& rConfig ) SAL_DELETED_FUNCTION;
75 #endif
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */