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