LibreOffice Module dbaccess (master) 1
ConnectionLineData.hxx
Go to the documentation of this file.
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#pragma once
20
21#include "QEnumTypes.hxx"
22#include <vector>
23
24#include <rtl/ref.hxx>
26#include <rtl/ustring.hxx>
27
28namespace dbaui
29{
30
31 // ConnData ---------->* ConnLineData
32 // ^1 ^1
33 // | |
34 // Conn ---------->* ConnLine
35
41 {
44
45 friend bool operator==(const OConnectionLineData& lhs, const OConnectionLineData& rhs);
46 friend bool operator!=(const OConnectionLineData& lhs, const OConnectionLineData& rhs) { return !(lhs == rhs); }
47 protected:
48 virtual ~OConnectionLineData() override;
49 public:
51 OConnectionLineData( OUString sSourceFieldName, OUString sDestFieldName );
52 OConnectionLineData( const OConnectionLineData& rConnLineData );
53 // provide a copy of own instance (this is somehow more acceptable for me compared to a virtual assignment operator
54 void CopyFrom(const OConnectionLineData& rSource);
55
56 // member access (write)
57 void SetFieldName(EConnectionSide nWhich, const OUString& strFieldName)
58 {
59 if (nWhich==JTCS_FROM)
60 m_aSourceFieldName = strFieldName;
61 else
62 m_aDestFieldName = strFieldName;
63 }
64 void SetSourceFieldName( const OUString& rSourceFieldName){ SetFieldName(JTCS_FROM, rSourceFieldName); }
65 void SetDestFieldName( const OUString& rDestFieldName ){ SetFieldName(JTCS_TO, rDestFieldName); }
66
67 // member access (read)
68 const OUString& GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; }
69 OUString const & GetSourceFieldName() const { return GetFieldName(JTCS_FROM); }
70 OUString const & GetDestFieldName() const { return GetFieldName(JTCS_TO); }
71
72 void Reset();
73 OConnectionLineData& operator=( const OConnectionLineData& rConnLineData );
74 };
75
76 typedef ::rtl::Reference< OConnectionLineData > OConnectionLineDataRef;
77 typedef std::vector< OConnectionLineDataRef > OConnectionLineDataVec;
78}
79
80/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
the class OConnectionLineData contains the data of a connection e.g.
void SetFieldName(EConnectionSide nWhich, const OUString &strFieldName)
friend bool operator!=(const OConnectionLineData &lhs, const OConnectionLineData &rhs)
virtual ~OConnectionLineData() override
OUString const & GetSourceFieldName() const
void SetSourceFieldName(const OUString &rSourceFieldName)
const OUString & GetFieldName(EConnectionSide nWhich) const
OUString const & GetDestFieldName() const
friend bool operator==(const OConnectionLineData &lhs, const OConnectionLineData &rhs)
void CopyFrom(const OConnectionLineData &rSource)
OConnectionLineData & operator=(const OConnectionLineData &rConnLineData)
void SetDestFieldName(const OUString &rDestFieldName)
std::vector< OConnectionLineDataRef > OConnectionLineDataVec
::rtl::Reference< OConnectionLineData > OConnectionLineDataRef
EConnectionSide
Definition: QEnumTypes.hxx:42
@ JTCS_TO
Definition: QEnumTypes.hxx:44
@ JTCS_FROM
Definition: QEnumTypes.hxx:43