xref: /AOO41X/main/dbaccess/source/ui/inc/ConnectionLineData.hxx (revision 2e2212a7c22e96cf6f6fab0dd042c34a45a64bd6)
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 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
24 #define DBAUI_CONNECTIONLINEDATA_HXX
25 
26 #ifndef DBAUI_ENUMTYPES_HXX
27 #include "QEnumTypes.hxx"
28 #endif
29 #ifndef _VOS_REFERNCE_HXX_
30 #include <vos/refernce.hxx>
31 #endif
32 #include <vector>
33 
34 #ifndef _VOS_REF_HXX_
35 #include <vos/ref.hxx>
36 #endif
37 
38 #ifndef DBAUI_REFFUNCTOR_HXX
39 #include "RefFunctor.hxx"
40 #endif
41 #ifndef _RTL_USTRING_HXX_
42 #include <rtl/ustring.hxx>
43 #endif
44 
45 namespace dbaui
46 {
47 
48     //==================================================================
49     // ConnData     ---------->*    ConnLineData
50     //    ^1                            ^1
51     //    |                             |
52     //  Conn        ---------->*    ConnLine
53     //==================================================================
54 
55 
56     //==================================================================
57     /**
58         the class OConnectionLineData contains the data of a connection
59         e.g. the source and the destanation field
60     **/
61     class OConnectionLineData : public ::vos::OReference
62     {
63         ::rtl::OUString m_aSourceFieldName;
64         ::rtl::OUString m_aDestFieldName;
65 
66         friend bool operator==(const OConnectionLineData& lhs, const OConnectionLineData& rhs);
operator !=(const OConnectionLineData & lhs,const OConnectionLineData & rhs)67         friend bool operator!=(const OConnectionLineData& lhs, const OConnectionLineData& rhs) { return !(lhs == rhs); }
68     protected:
69         virtual ~OConnectionLineData();
70     public:
71         OConnectionLineData();
72         OConnectionLineData( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName );
73         OConnectionLineData( const OConnectionLineData& rConnLineData );
74 
75         // eine Kopie der eigenen Instanz liefern (das ist mir irgendwie angenehmer als ein virtueller Zuweisungsoperator)
76         void CopyFrom(const OConnectionLineData& rSource);
77 
78         // Memberzugriff (schreiben)
SetFieldName(EConnectionSide nWhich,const::rtl::OUString & strFieldName)79         void SetFieldName(EConnectionSide nWhich, const ::rtl::OUString& strFieldName)
80         {
81             if (nWhich==JTCS_FROM)
82                 m_aSourceFieldName = strFieldName;
83             else
84                 m_aDestFieldName = strFieldName;
85         }
SetSourceFieldName(const::rtl::OUString & rSourceFieldName)86         void SetSourceFieldName( const ::rtl::OUString& rSourceFieldName){ SetFieldName(JTCS_FROM, rSourceFieldName); }
SetDestFieldName(const::rtl::OUString & rDestFieldName)87         void SetDestFieldName( const ::rtl::OUString& rDestFieldName ){ SetFieldName(JTCS_TO, rDestFieldName); }
88 
clearSourceFieldName()89         inline bool clearSourceFieldName() { SetSourceFieldName(::rtl::OUString()); return true;}
clearDestFieldName()90         inline bool clearDestFieldName() { SetDestFieldName(::rtl::OUString());     return true;}
91 
92         // Memberzugriff (lesen)
GetFieldName(EConnectionSide nWhich) const93         ::rtl::OUString GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; }
GetSourceFieldName() const94         ::rtl::OUString GetSourceFieldName() const { return GetFieldName(JTCS_FROM); }
GetDestFieldName() const95         ::rtl::OUString GetDestFieldName() const { return GetFieldName(JTCS_TO); }
96 
97         bool Reset();
98         OConnectionLineData& operator=( const OConnectionLineData& rConnLineData );
99     };
100 
101     //-------------------------------------------------------------------------
102     //------------------------------------------------------------------
103     typedef ::vos::ORef< OConnectionLineData >      OConnectionLineDataRef;
104     typedef ::std::vector< OConnectionLineDataRef > OConnectionLineDataVec;
105 }
106 #endif // DBAUI_CONNECTIONLINEDATA_HXX
107 
108