LCOV - code coverage report
Current view: top level - dbaccess/source/ui/querydesign - QTableConnection.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 27 3.7 %
Date: 2014-11-03 Functions: 2 8 25.0 %
Legend: Lines: hit not hit

          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             : 
      20             : #include "QTableConnection.hxx"
      21             : #include <osl/diagnose.h>
      22             : #include "QueryTableView.hxx"
      23             : #include "ConnectionLine.hxx"
      24             : using namespace dbaui;
      25             : // class OQueryTableConnection
      26             : 
      27           0 : OQueryTableConnection::OQueryTableConnection(OQueryTableView* pContainer, const TTableConnectionData::value_type& pTabConnData)
      28             :     : OTableConnection(pContainer, pTabConnData)
      29           0 :     , m_bVisited(false)
      30             : {
      31           0 : }
      32             : 
      33           0 : OQueryTableConnection::OQueryTableConnection(const OQueryTableConnection& rConn)
      34             :     : OTableConnection( rConn )
      35           0 :     , m_bVisited(false)
      36             : {
      37             :     // no own members, so base class functionality is sufficient
      38           0 : }
      39             : 
      40           0 : OQueryTableConnection::~OQueryTableConnection()
      41             : {
      42           0 : }
      43             : 
      44           0 : OQueryTableConnection& OQueryTableConnection::operator=(const OQueryTableConnection& rConn)
      45             : {
      46           0 :     if (&rConn == this)
      47           0 :         return *this;
      48             : 
      49           0 :     OTableConnection::operator=(rConn);
      50             :     // no own members ...
      51           0 :     return *this;
      52             : }
      53             : 
      54           0 : bool OQueryTableConnection::operator==(const OQueryTableConnection& rCompare)
      55             : {
      56             :     OSL_ENSURE(GetData() && rCompare.GetData(), "OQueryTableConnection::operator== : one of the two participants has no data!");
      57             : 
      58             :     // I don't have to compare all too much (especially not all the members) : merely the windows, which we are connected to, and the indices in the corresponding table have to match.
      59           0 :     OQueryTableConnectionData* pMyData = static_cast<OQueryTableConnectionData*>(GetData().get());
      60           0 :     OQueryTableConnectionData* pCompData = static_cast<OQueryTableConnectionData*>(rCompare.GetData().get());
      61             : 
      62             :     // Connections are seen as equal, if source and destination window names and source and destination field Indices match...
      63           0 :     return  (   (   (pMyData->getReferencedTable() == pCompData->getReferencedTable()) &&
      64           0 :                     (pMyData->getReferencingTable() == pCompData->getReferencingTable()) &&
      65           0 :                     (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_TO)) &&
      66           0 :                     (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_FROM))
      67             :                 )
      68           0 :                 ||  // ... or this cross matching is given
      69           0 :                 (   (pMyData->getReferencingTable() == pCompData->getReferencedTable()) &&
      70           0 :                     (pMyData->getReferencedTable() == pCompData->getReferencingTable()) &&
      71           0 :                     (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_FROM)) &&
      72           0 :                     (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_TO))
      73             :                 )
      74           0 :             );
      75          72 : }
      76             : 
      77             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10