update dev300-m58
[ooovba.git] / connectivity / source / drivers / mozab / MColumnAlias.hxx
blobe98a398a95b09ec7b2f74e4039c255df95aef4f1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: MColumnAlias.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
33 #define _CONNECTIVITY_MAB_COLUMNALIAS_HXX_
35 #include <unotools/confignode.hxx>
37 #include <osl/mutex.hxx>
38 #include <vector>
39 #include <hash_map>
41 namespace connectivity
43 namespace mozab
45 class OColumnAlias
47 public:
48 struct AliasEntry
50 ::rtl::OString programmaticAsciiName;
51 sal_Int32 columnPosition;
53 AliasEntry()
54 :programmaticAsciiName()
55 ,columnPosition( 0 )
58 AliasEntry( const sal_Char* _programmaticAsciiName, sal_Int32 _columnPosition )
59 :programmaticAsciiName( _programmaticAsciiName )
60 ,columnPosition( _columnPosition )
64 typedef ::std::hash_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap;
66 private:
67 AliasMap m_aAliasMap;
69 public:
70 OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
72 inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
74 return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
76 ::rtl::OString getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const;
78 inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
79 inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
81 bool isColumnSearchable( const ::rtl::OUString _alias ) const;
83 private:
84 void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
88 #endif // _CONNECTIVITY_MAB_COLUMNALIAS_HXX_