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 : // provide a copy of own instance (this is somehow more acceptable for me compared to a virtual assignment operator
60 : void CopyFrom(const OConnectionLineData& rSource);
61 :
62 : // member access (write)
63 0 : void SetFieldName(EConnectionSide nWhich, const ::rtl::OUString& strFieldName)
64 : {
65 0 : if (nWhich==JTCS_FROM)
66 0 : m_aSourceFieldName = strFieldName;
67 : else
68 0 : m_aDestFieldName = strFieldName;
69 0 : }
70 0 : void SetSourceFieldName( const ::rtl::OUString& rSourceFieldName){ SetFieldName(JTCS_FROM, rSourceFieldName); }
71 0 : void SetDestFieldName( const ::rtl::OUString& rDestFieldName ){ SetFieldName(JTCS_TO, rDestFieldName); }
72 :
73 : inline bool clearSourceFieldName() { SetSourceFieldName(::rtl::OUString()); return true;}
74 : inline bool clearDestFieldName() { SetDestFieldName(::rtl::OUString()); return true;}
75 :
76 : // member access (read)
77 0 : ::rtl::OUString GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; }
78 0 : ::rtl::OUString GetSourceFieldName() const { return GetFieldName(JTCS_FROM); }
79 0 : ::rtl::OUString GetDestFieldName() const { return GetFieldName(JTCS_TO); }
80 :
81 : bool Reset();
82 : OConnectionLineData& operator=( const OConnectionLineData& rConnLineData );
83 : };
84 :
85 : //-------------------------------------------------------------------------
86 : //------------------------------------------------------------------
87 : typedef ::rtl::Reference< OConnectionLineData > OConnectionLineDataRef;
88 : typedef ::std::vector< OConnectionLineDataRef > OConnectionLineDataVec;
89 : }
90 : #endif // DBAUI_CONNECTIONLINEDATA_HXX
91 :
92 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|