LibreOffice Module tools (master) 1
config.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_TOOLS_CONFIG_HXX
20#define INCLUDED_TOOLS_CONFIG_HXX
21
22#include <tools/toolsdllapi.h>
23#include <rtl/ustring.hxx>
24#include <memory>
25
26struct ImplConfigData;
27struct ImplGroupData;
28
30{
31private:
32 OUString maFileName;
33 OString maGroupName;
34 std::unique_ptr<ImplConfigData> mpData;
36 sal_uInt32 mnDataUpdateId;
37
38 TOOLS_DLLPRIVATE bool ImplUpdateConfig() const;
39 TOOLS_DLLPRIVATE ImplGroupData* ImplGetGroup() const;
40
41public:
42 Config( const OUString& rFileName );
43 ~Config();
44
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;
51
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;
59
60 void Flush();
61
62private:
63 Config( const Config& rConfig ) = delete;
64 Config& operator = ( const Config& rConfig ) = delete;
65};
66
67#endif
68
69/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OString & GetGroup() const
Definition: config.hxx:46
OUString maFileName
Definition: config.hxx:32
Config(const Config &rConfig)=delete
OString maGroupName
Definition: config.hxx:33
sal_uInt32 mnDataUpdateId
Definition: config.hxx:36
std::unique_ptr< ImplConfigData > mpData
Definition: config.hxx:34
ImplGroupData * mpActGroup
Definition: config.hxx:35
#define TOOLS_DLLPRIVATE
Definition: toolsdllapi.h:30
#define TOOLS_DLLPUBLIC
Definition: toolsdllapi.h:28
#define SAL_WARN_UNUSED