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 : #ifndef DBACCESS_DSMETA_HXX
21 : #define DBACCESS_DSMETA_HXX
22 :
23 : #include "dsntypes.hxx"
24 : #include "dsitems.hxx"
25 :
26 : #include <boost/shared_ptr.hpp>
27 :
28 : //........................................................................
29 : namespace dbaui
30 : {
31 : //........................................................................
32 :
33 : //====================================================================
34 : //= AutheticationMode
35 : //====================================================================
36 : enum AuthenticationMode
37 : {
38 : AuthNone,
39 : AuthUserPwd,
40 : AuthPwd
41 : };
42 :
43 : //====================================================================
44 : //= DataSourceMetaData
45 : //====================================================================
46 : class FeatureSet;
47 : class DataSourceMetaData_Impl;
48 : /** encapsulates meta data for a data source
49 :
50 : On the long run, this class should a) encapsulate *all* meta data which
51 : currently is hard coded somewhere in the program logic and b) be initialized
52 : from the configuration.
53 :
54 : At the moment, the data a) is still hard coded in the, well, code and b)
55 : contains meta data about the advanced settings only.
56 : */
57 : class DataSourceMetaData
58 : {
59 : public:
60 : DataSourceMetaData( const ::rtl::OUString& _sURL );
61 : ~DataSourceMetaData();
62 :
63 : /// returns a struct describing this data source type's support for our known advanced settings
64 : const FeatureSet& getFeatureSet() const;
65 :
66 : /// determines whether or not the data source requires authentication
67 : static AuthenticationMode getAuthentication( const ::rtl::OUString& _sURL );
68 :
69 : private:
70 : ::boost::shared_ptr< DataSourceMetaData_Impl > m_pImpl;
71 : };
72 :
73 : //====================================================================
74 : //= FeatureSet
75 : //====================================================================
76 : /** can be used to ask for (UI) support for certain advanced features
77 : */
78 0 : class FeatureSet
79 : {
80 : public:
81 : typedef ::std::set< ItemID >::const_iterator const_iterator;
82 :
83 : public:
84 0 : inline FeatureSet() { }
85 :
86 0 : inline void put( const ItemID _id ) { m_aContent.insert( _id ); }
87 0 : inline bool has( const ItemID _id ) const { return m_aContent.find( _id ) != m_aContent.end(); }
88 :
89 : inline bool supportsAnySpecialSetting() const;
90 : inline bool supportsGeneratedValues() const;
91 :
92 0 : inline const_iterator begin() const { return m_aContent.begin(); }
93 0 : inline const_iterator end() const { return m_aContent.end(); }
94 :
95 : private:
96 : ::std::set< ItemID > m_aContent;
97 : };
98 :
99 : //--------------------------------------------------------------------
100 0 : inline bool FeatureSet::supportsGeneratedValues() const
101 : {
102 0 : return has( DSID_AUTORETRIEVEENABLED );
103 : }
104 :
105 : //--------------------------------------------------------------------
106 0 : inline bool FeatureSet::supportsAnySpecialSetting() const
107 : {
108 0 : return has( DSID_SQL92CHECK )
109 0 : || has( DSID_APPEND_TABLE_ALIAS )
110 0 : || has( DSID_AS_BEFORE_CORRNAME )
111 0 : || has( DSID_ENABLEOUTERJOIN )
112 0 : || has( DSID_IGNOREDRIVER_PRIV )
113 0 : || has( DSID_PARAMETERNAMESUBST )
114 0 : || has( DSID_SUPPRESSVERSIONCL )
115 0 : || has( DSID_CATALOG )
116 0 : || has( DSID_SCHEMA )
117 0 : || has( DSID_INDEXAPPENDIX )
118 0 : || has( DSID_DOSLINEENDS )
119 0 : || has( DSID_BOOLEANCOMPARISON )
120 0 : || has( DSID_CHECK_REQUIRED_FIELDS )
121 0 : || has( DSID_IGNORECURRENCY )
122 0 : || has( DSID_ESCAPE_DATETIME )
123 0 : || has( DSID_PRIMARY_KEY_SUPPORT )
124 0 : || has( DSID_MAX_ROW_SCAN )
125 0 : || has( DSID_RESPECTRESULTSETTYPE )
126 : ;
127 : }
128 :
129 : //........................................................................
130 : } // namespace dbaui
131 : //........................................................................
132 :
133 : #endif // DBACCESS_DSMETA_HXX
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|