LibreOffice Module configmgr (master) 1
config_map.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#pragma once
10
11#include <map>
12#include <rtl/ustring.hxx>
13
14// The realisation here is that while a map is a reasonably compact
15// representation, there is often no need to have it completely
16// sorted, so we can use a fast in-line length comparison as the
17// initial compare, rather than sorting of sub string contents.
18
20{
21 bool operator()(std::u16string_view a, std::u16string_view b) const
22 {
23 if (a.size() == b.size())
24 return a < b;
25 else
26 return a.size() < b.size();
27 }
28};
29
30template <class T> struct config_map : public std::map<OUString, T, LengthContentsCompare>
31{
32};
33
34/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
uno_Any a
bool operator()(std::u16string_view a, std::u16string_view b) const
Definition: config_map.hxx:21