Branch data 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 : : #ifndef DBAUI_CONNECTIONLINEDATA_HXX
20 : : #define DBAUI_CONNECTIONLINEDATA_HXX
21 : :
22 : : #include "QEnumTypes.hxx"
23 : : #include <vector>
24 : :
25 : : #include <rtl/ref.hxx>
26 : : #include <salhelper/simplereferenceobject.hxx>
27 : : #include "RefFunctor.hxx"
28 : : #include <rtl/ustring.hxx>
29 : :
30 : : namespace dbaui
31 : : {
32 : :
33 : : //==================================================================
34 : : // ConnData ---------->* ConnLineData
35 : : // ^1 ^1
36 : : // | |
37 : : // Conn ---------->* ConnLine
38 : : //==================================================================
39 : :
40 : :
41 : : //==================================================================
42 : : /**
43 : : the class OConnectionLineData contains the data of a connection
44 : : e.g. the source and the destanation field
45 : : **/
46 : : class OConnectionLineData : public ::salhelper::SimpleReferenceObject
47 : : {
48 : : ::rtl::OUString m_aSourceFieldName;
49 : : ::rtl::OUString m_aDestFieldName;
50 : :
51 : : friend bool operator==(const OConnectionLineData& lhs, const OConnectionLineData& rhs);
52 : 0 : friend bool operator!=(const OConnectionLineData& lhs, const OConnectionLineData& rhs) { return !(lhs == rhs); }
53 : : protected:
54 : : virtual ~OConnectionLineData();
55 : : public:
56 : : OConnectionLineData();
57 : : OConnectionLineData( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName );
58 : : OConnectionLineData( const OConnectionLineData& rConnLineData );
59 : :
60 : : // eine Kopie der eigenen Instanz liefern (das ist mir irgendwie angenehmer als ein virtueller Zuweisungsoperator)
61 : : void CopyFrom(const OConnectionLineData& rSource);
62 : :
63 : : // Memberzugriff (schreiben)
64 : 0 : void SetFieldName(EConnectionSide nWhich, const ::rtl::OUString& strFieldName)
65 : : {
66 [ # # ]: 0 : if (nWhich==JTCS_FROM)
67 : 0 : m_aSourceFieldName = strFieldName;
68 : : else
69 : 0 : m_aDestFieldName = strFieldName;
70 : 0 : }
71 : 0 : void SetSourceFieldName( const ::rtl::OUString& rSourceFieldName){ SetFieldName(JTCS_FROM, rSourceFieldName); }
72 : 0 : void SetDestFieldName( const ::rtl::OUString& rDestFieldName ){ SetFieldName(JTCS_TO, rDestFieldName); }
73 : :
74 : : inline bool clearSourceFieldName() { SetSourceFieldName(::rtl::OUString()); return true;}
75 : : inline bool clearDestFieldName() { SetDestFieldName(::rtl::OUString()); return true;}
76 : :
77 : : // Memberzugriff (lesen)
78 [ # # ]: 0 : ::rtl::OUString GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; }
79 : 0 : ::rtl::OUString GetSourceFieldName() const { return GetFieldName(JTCS_FROM); }
80 : 0 : ::rtl::OUString GetDestFieldName() const { return GetFieldName(JTCS_TO); }
81 : :
82 : : bool Reset();
83 : : OConnectionLineData& operator=( const OConnectionLineData& rConnLineData );
84 : : };
85 : :
86 : : //-------------------------------------------------------------------------
87 : : //------------------------------------------------------------------
88 : : typedef ::rtl::Reference< OConnectionLineData > OConnectionLineDataRef;
89 : : typedef ::std::vector< OConnectionLineDataRef > OConnectionLineDataVec;
90 : : }
91 : : #endif // DBAUI_CONNECTIONLINEDATA_HXX
92 : :
93 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|