LibreOffice Module desktop (master) 1
dp_persmap.h
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 <rtl/ustring.hxx>
23#include <osl/file.hxx>
24#include <unordered_map>
25
26namespace dp_misc
27{
28typedef std::unordered_map<OString, OString> t_string2string_map;
29
30// Class to read obsolete registered extensions
31// should be removed for LibreOffice 4.0
32class PersistentMap final
33{
34 ::osl::File m_MapFile;
39
40public:
42 PersistentMap(OUString const& url);
45
46 bool has(OString const& key) const;
47 bool get(OString* value, OString const& key) const;
48 const t_string2string_map& getEntries() const { return m_entries; }
49 void put(OString const& key, OString const& value);
50 bool erase(OString const& key);
51
52private:
53 void open();
54 void readAll();
55 void add(OString const& key, OString const& value);
56 void flush();
57};
58}
59
60/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool get(OString *value, OString const &key) const
Definition: dp_persmap.cxx:274
void put(OString const &key, OString const &value)
Definition: dp_persmap.cxx:291
bool has(OString const &key) const
Definition: dp_persmap.cxx:269
PersistentMap()
in mem db
Definition: dp_persmap.cxx:54
bool erase(OString const &key)
Definition: dp_persmap.cxx:300
void add(OString const &key, OString const &value)
Definition: dp_persmap.cxx:284
const t_string2string_map & getEntries() const
Definition: dp_persmap.h:48
t_string2string_map m_entries
Definition: dp_persmap.h:35
::osl::File m_MapFile
Definition: dp_persmap.h:34
std::unordered_map< OString, OString > t_string2string_map
Definition: dp_persmap.h:28