LibreOffice Module framework (master) 1
configaccess.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
20#pragma once
21
22#include <com/sun/star/uno/XComponentContext.hpp>
23#include <rtl/ustring.hxx>
24#include <mutex>
25
26namespace framework{
27
34class ConfigAccess final
35{
36
37 public:
38
41 {
48 };
49
50 // member
51
52 private:
53 mutable std::mutex m_mutex;
54
59 css::uno::Reference< css::uno::XComponentContext > m_xContext;
60
62 css::uno::Reference< css::uno::XInterface > m_xConfig;
63
65 OUString m_sRoot;
66
69
70 // native interface methods
71
72 void closeImpl();
73 public:
74
75 ConfigAccess( css::uno::Reference< css::uno::XComponentContext > xContext,
76 OUString sRoot );
78
79 void open ( EOpenMode eMode );
80 void close ( );
81 EOpenMode getMode( ) const;
82
83 const css::uno::Reference< css::uno::XInterface >& cfg();
84};
85
86} // namespace framework
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
implements a simple configuration access @descr Sometimes it's better to have direct config access in...
void open(EOpenMode eMode)
open the configuration access in the specified mode @descr We set the opened configuration access as ...
css::uno::Reference< css::uno::XInterface > m_xConfig
hold an opened configuration alive
EOpenMode m_eMode
represent the current open mode
css::uno::Reference< css::uno::XComponentContext > m_xContext
reference to the uno service manager It's necessary to instantiate own needed services.
EOpenMode getMode() const
return the internal mode of this instance @descr May be the outside user need any information about s...
void close()
close the internal opened configuration access and flush all changes @descr It checks,...
~ConfigAccess()
last chance to close an open configuration access point @descr In case our user forgot to close this ...
OUString m_sRoot
knows the root of the opened config access point
const css::uno::Reference< css::uno::XInterface > & cfg()
provides an access to the internal wrapped configuration access @descr It's not allowed to safe this ...
EOpenMode
represent the possible modes of the internal wrapped configuration access
@ E_READONLY
config access is open for reading only
@ E_CLOSED
config isn't used yet
@ E_READWRITE
config access is open for reading/writing data
ConfigAccess(css::uno::Reference< css::uno::XComponentContext > xContext, OUString sRoot)
open the configuration of this job @descr We open the configuration of this job only.