CppunitTest_sc_tiledrendering2: move to tiledrendering folder
[LibreOffice.git] / xmloff / inc / StyleMap.hxx
blob0e7fe1b40b06d9d043e0af27b319d2bc985e56c9
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 .
20 #pragma once
22 #include <cppuhelper/implbase.hxx>
23 #include <o3tl/hash_combine.hxx>
24 #include <unordered_map>
25 #include <utility>
27 enum class XmlStyleFamily;
29 struct StyleNameKey_Impl
31 XmlStyleFamily m_nFamily;
32 OUString m_aName;
34 StyleNameKey_Impl( XmlStyleFamily nFamily,
35 OUString sName ) :
36 m_nFamily( nFamily ),
37 m_aName(std::move( sName ))
42 struct StyleNameHash_Impl
44 inline size_t operator()( const StyleNameKey_Impl& r ) const;
45 inline bool operator()( const StyleNameKey_Impl& r1,
46 const StyleNameKey_Impl& r2 ) const;
49 inline size_t StyleNameHash_Impl::operator()( const StyleNameKey_Impl& r ) const
51 std::size_t seed = 0;
52 o3tl::hash_combine(seed, r.m_nFamily);
53 o3tl::hash_combine(seed, r.m_aName.hashCode());
54 return seed;
57 inline bool StyleNameHash_Impl::operator()(
58 const StyleNameKey_Impl& r1,
59 const StyleNameKey_Impl& r2 ) const
61 return r1.m_nFamily == r2.m_nFamily && r1.m_aName == r2.m_aName;
64 class StyleMap final :
65 public ::cppu::WeakImplHelper<>,
66 public std::unordered_map< StyleNameKey_Impl, OUString,
67 StyleNameHash_Impl, StyleNameHash_Impl >
70 public:
72 StyleMap();
73 virtual ~StyleMap() override;
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */