Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / tools / config.hxx
blob3616d087cfb97e60e9ae49ce0885564a9bbb3c1b
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>
24 #include <memory>
26 struct ImplConfigData;
27 struct ImplGroupData;
29 class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Config
31 private:
32 OUString maFileName;
33 OString maGroupName;
34 std::unique_ptr<ImplConfigData> mpData;
35 ImplGroupData* mpActGroup;
36 sal_uInt32 mnDataUpdateId;
38 TOOLS_DLLPRIVATE bool ImplUpdateConfig() const;
39 TOOLS_DLLPRIVATE ImplGroupData* ImplGetGroup() const;
41 public:
42 Config( const OUString& rFileName );
43 ~Config();
45 void SetGroup(const OString& rGroup);
46 const OString& GetGroup() const { return maGroupName; }
47 void DeleteGroup(std::string_view rGroup);
48 OString GetGroupName(sal_uInt16 nGroup) const;
49 sal_uInt16 GetGroupCount() const;
50 bool HasGroup(std::string_view rGroup) const;
52 OString ReadKey(const OString& rKey) const;
53 OString ReadKey(const OString& rKey, const OString& rDefault) const;
54 void WriteKey(const OString& rKey, const OString& rValue);
55 void DeleteKey(std::string_view rKey);
56 OString GetKeyName(sal_uInt16 nKey) const;
57 OString ReadKey(sal_uInt16 nKey) const;
58 sal_uInt16 GetKeyCount() const;
60 void Flush();
62 private:
63 Config( const Config& rConfig ) = delete;
64 Config& operator = ( const Config& rConfig ) = delete;
67 #endif
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */