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