1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef DBACCESS_DSMETA_HXX 25 #define DBACCESS_DSMETA_HXX 26 27 #include "dsntypes.hxx" 28 #include "dsitems.hxx" 29 30 /** === begin UNO includes === **/ 31 /** === end UNO includes === **/ 32 33 #include <boost/shared_ptr.hpp> 34 35 //........................................................................ 36 namespace dbaui 37 { 38 //........................................................................ 39 40 //==================================================================== 41 //= AutheticationMode 42 //==================================================================== 43 enum AuthenticationMode 44 { 45 AuthNone, 46 AuthUserPwd, 47 AuthPwd 48 }; 49 50 //==================================================================== 51 //= DataSourceMetaData 52 //==================================================================== 53 class FeatureSet; 54 class DataSourceMetaData_Impl; 55 /** encapsulates meta data for a data source 56 57 On the long run, this class should a) encapsulate *all* meta data which 58 currently is hard coded somewhere in the program logic and b) be initialized 59 from the configuration. 60 61 At the moment, the data a) is still hard coded in the, well, code and b) 62 contains meta data about the advanced settings only. 63 */ 64 class DataSourceMetaData 65 { 66 public: 67 DataSourceMetaData( const ::rtl::OUString& _sURL ); 68 ~DataSourceMetaData(); 69 70 /// returns a struct describing this data source type's support for our known advanced settings 71 const FeatureSet& getFeatureSet() const; 72 73 /// determines whether or not the data source requires authentication 74 static AuthenticationMode getAuthentication( const ::rtl::OUString& _sURL ); 75 76 private: 77 ::boost::shared_ptr< DataSourceMetaData_Impl > m_pImpl; 78 }; 79 80 //==================================================================== 81 //= FeatureSet 82 //==================================================================== 83 /** can be used to ask for (UI) support for certain advanced features 84 */ 85 class FeatureSet 86 { 87 public: 88 typedef ::std::set< ItemID >::const_iterator const_iterator; 89 90 public: FeatureSet()91 inline FeatureSet() { } 92 put(const ItemID _id)93 inline void put( const ItemID _id ) { m_aContent.insert( _id ); } has(const ItemID _id) const94 inline bool has( const ItemID _id ) const { return m_aContent.find( _id ) != m_aContent.end(); } 95 96 inline bool supportsAnySpecialSetting() const; 97 inline bool supportsGeneratedValues() const; 98 begin() const99 inline const_iterator begin() const { return m_aContent.begin(); } end() const100 inline const_iterator end() const { return m_aContent.end(); } 101 102 private: 103 ::std::set< ItemID > m_aContent; 104 }; 105 106 //-------------------------------------------------------------------- supportsGeneratedValues() const107 inline bool FeatureSet::supportsGeneratedValues() const 108 { 109 return has( DSID_AUTORETRIEVEENABLED ); 110 } 111 112 //-------------------------------------------------------------------- supportsAnySpecialSetting() const113 inline bool FeatureSet::supportsAnySpecialSetting() const 114 { 115 return has( DSID_SQL92CHECK ) 116 || has( DSID_APPEND_TABLE_ALIAS ) 117 || has( DSID_AS_BEFORE_CORRNAME ) 118 || has( DSID_ENABLEOUTERJOIN ) 119 || has( DSID_IGNOREDRIVER_PRIV ) 120 || has( DSID_PARAMETERNAMESUBST ) 121 || has( DSID_SUPPRESSVERSIONCL ) 122 || has( DSID_CATALOG ) 123 || has( DSID_SCHEMA ) 124 || has( DSID_INDEXAPPENDIX ) 125 || has( DSID_DOSLINEENDS ) 126 || has( DSID_BOOLEANCOMPARISON ) 127 || has( DSID_CHECK_REQUIRED_FIELDS ) 128 || has( DSID_IGNORECURRENCY ) 129 || has( DSID_ESCAPE_DATETIME ) 130 || has( DSID_PRIMARY_KEY_SUPPORT ) 131 || has( DSID_MAX_ROW_SCAN ) 132 || has( DSID_RESPECTRESULTSETTYPE ) 133 ; 134 } 135 136 //........................................................................ 137 } // namespace dbaui 138 //........................................................................ 139 140 #endif // DBACCESS_DSMETA_HXX 141