Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / dbaccess / source / ui / inc / dsmeta.hxx
blobd7e62e5345bb65cf5637b6971379334444a0b351
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 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DSMETA_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_DSMETA_HXX
23 #include <sal/config.h>
25 #include <set>
27 #include "dsntypes.hxx"
28 #include "dsitems.hxx"
30 #include <memory>
32 namespace dbaui
35 // AuthenticationMode
36 enum AuthenticationMode
38 AuthNone,
39 AuthUserPwd,
40 AuthPwd
43 // DataSourceMetaData
44 class FeatureSet;
45 class DataSourceMetaData_Impl;
46 /** encapsulates meta data for a data source
48 On the long run, this class should a) encapsulate *all* meta data which
49 currently is hard coded somewhere in the program logic and b) be initialized
50 from the configuration.
52 At the moment, the data a) is still hard coded in the, well, code and b)
53 contains meta data about the advanced settings only.
55 class DataSourceMetaData
57 public:
58 DataSourceMetaData( const OUString& _sURL );
59 ~DataSourceMetaData();
61 /// returns a struct describing this data source type's support for our known advanced settings
62 const FeatureSet& getFeatureSet() const;
64 /// determines whether or not the data source requires authentication
65 static AuthenticationMode getAuthentication( const OUString& _sURL );
67 private:
68 std::shared_ptr< DataSourceMetaData_Impl > m_pImpl;
71 // FeatureSet
72 /** can be used to ask for (UI) support for certain advanced features
74 class FeatureSet
76 public:
77 typedef ::std::set< ItemID >::const_iterator const_iterator;
79 public:
80 inline FeatureSet() { }
82 inline void put( const ItemID _id ) { m_aContent.insert( _id ); }
83 inline bool has( const ItemID _id ) const { return m_aContent.find( _id ) != m_aContent.end(); }
85 inline bool supportsAnySpecialSetting() const;
86 inline bool supportsGeneratedValues() const;
88 inline const_iterator begin() const { return m_aContent.begin(); }
89 inline const_iterator end() const { return m_aContent.end(); }
91 private:
92 ::std::set< ItemID > m_aContent;
95 inline bool FeatureSet::supportsGeneratedValues() const
97 return has( DSID_AUTORETRIEVEENABLED );
100 inline bool FeatureSet::supportsAnySpecialSetting() const
102 return has( DSID_SQL92CHECK )
103 || has( DSID_APPEND_TABLE_ALIAS )
104 || has( DSID_AS_BEFORE_CORRNAME )
105 || has( DSID_ENABLEOUTERJOIN )
106 || has( DSID_IGNOREDRIVER_PRIV )
107 || has( DSID_PARAMETERNAMESUBST )
108 || has( DSID_SUPPRESSVERSIONCL )
109 || has( DSID_CATALOG )
110 || has( DSID_SCHEMA )
111 || has( DSID_INDEXAPPENDIX )
112 || has( DSID_DOSLINEENDS )
113 || has( DSID_BOOLEANCOMPARISON )
114 || has( DSID_CHECK_REQUIRED_FIELDS )
115 || has( DSID_IGNORECURRENCY )
116 || has( DSID_ESCAPE_DATETIME )
117 || has( DSID_PRIMARY_KEY_SUPPORT )
118 || has( DSID_MAX_ROW_SCAN )
119 || has( DSID_RESPECTRESULTSETTYPE )
123 } // namespace dbaui
125 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DSMETA_HXX
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */