Line data Source code
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 :
21 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNALIAS_HXX
22 : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNALIAS_HXX
23 :
24 : #include <unotools/confignode.hxx>
25 :
26 : #include <osl/mutex.hxx>
27 : #include <unordered_map>
28 : #include <vector>
29 :
30 : namespace connectivity
31 : {
32 : namespace mork
33 : {
34 7 : class SAL_DLLPUBLIC_EXPORT OColumnAlias
35 : {
36 : public:
37 925 : struct AliasEntry
38 : {
39 : OString programmaticAsciiName;
40 : size_t columnPosition;
41 :
42 222 : AliasEntry()
43 : :programmaticAsciiName()
44 222 : ,columnPosition( 0 )
45 : {
46 222 : }
47 111 : AliasEntry( const sal_Char* _programmaticAsciiName, size_t _columnPosition )
48 : :programmaticAsciiName( _programmaticAsciiName )
49 111 : ,columnPosition( _columnPosition )
50 : {
51 111 : }
52 : };
53 : typedef std::unordered_map< OUString, AliasEntry, OUStringHash > AliasMap;
54 :
55 : private:
56 : AliasMap m_aAliasMap;
57 :
58 : public:
59 : OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
60 :
61 : inline bool hasAlias( const OUString& _rAlias ) const
62 : {
63 : return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
64 : }
65 : OString getProgrammaticNameOrFallbackToUTF8Alias( const OUString& _rAlias ) const;
66 :
67 76 : inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
68 2888 : inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
69 :
70 :
71 : private:
72 : void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
73 : };
74 : }
75 : }
76 : #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MORK_MCOLUMNALIAS_HXX
77 :
78 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|