1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _OFFAPP_CONNPOOLSETTINGS_HXX_
29 #define _OFFAPP_CONNPOOLSETTINGS_HXX_
30 
31 #include <tools/string.hxx>
32 #include <comphelper/stl_types.hxx>
33 #include <svl/poolitem.hxx>
34 
35 //........................................................................
36 namespace offapp
37 {
38 //........................................................................
39 
40 	//====================================================================
41 	//= DriverPooling
42 	//====================================================================
43 	struct DriverPooling
44 	{
45 		String				sName;
46 		sal_Bool			bEnabled;
47 		sal_Int32			nTimeoutSeconds;
48 
49 		DriverPooling( const String& _rName, sal_Bool _bEnabled, const sal_Int32 _nTimeout );
50 
51 		sal_Bool operator == (const DriverPooling& _rR) const;
52 		sal_Bool operator != (const DriverPooling& _rR) const { return !operator ==(_rR); }
53 	};
54 
55 	//====================================================================
56 	//= DriverPoolingSettings
57 	//====================================================================
58 	class DriverPoolingSettings
59 	{
60 	protected:
61 		DECLARE_STL_VECTOR( DriverPooling, DriverSettings );
62 		DriverSettings		m_aDrivers;
63 
64 	public:
65 		typedef ConstDriverSettingsIterator	const_iterator;
66 		typedef DriverSettingsIterator		iterator;
67 
68 	public:
69 		DriverPoolingSettings();
70 
71 		sal_Int32 size() const { return m_aDrivers.size(); }
72 
73 		const_iterator	begin() const	{ return m_aDrivers.begin(); }
74 		const_iterator	end() const		{ return m_aDrivers.end(); }
75 
76 		iterator		begin()		{ return m_aDrivers.begin(); }
77 		iterator		end()		{ return m_aDrivers.end(); }
78 
79 		void push_back(const DriverPooling& _rElement) { m_aDrivers.push_back(_rElement); }
80 	};
81 
82 	//====================================================================
83 	//= DriverPoolingSettingsItem
84 	//====================================================================
85 	class DriverPoolingSettingsItem : public SfxPoolItem
86 	{
87 	protected:
88 		DriverPoolingSettings	m_aSettings;
89 
90 	public:
91 		TYPEINFO();
92 
93 		DriverPoolingSettingsItem( sal_uInt16 _nId, const DriverPoolingSettings _rSettings );
94 
95 		virtual int              operator==( const SfxPoolItem& ) const;
96 		virtual SfxPoolItem*     Clone( SfxItemPool *pPool = 0 ) const;
97 
98 		const DriverPoolingSettings& getSettings() const	{ return m_aSettings; }
99 	};
100 
101 //........................................................................
102 }	// namespace offapp
103 //........................................................................
104 
105 #endif // _OFFAPP_CONNPOOLSETTINGS_HXX_
106 
107 
108