File indexing completed on 2024-05-19 05:42:22

0001 // ct_lvtqtwc_tool_add_logical_relation.h                                                                      -*-C++-*-
0002 
0003 /*
0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk>
0005 // SPDX-License-Identifier: Apache-2.0
0006 //
0007 // Licensed under the Apache License, Version 2.0 (the "License");
0008 // you may not use this file except in compliance with the License.
0009 // You may obtain a copy of the License at
0010 //
0011 //     http://www.apache.org/licenses/LICENSE-2.0
0012 //
0013 // Unless required by applicable law or agreed to in writing, software
0014 // distributed under the License is distributed on an "AS IS" BASIS,
0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 // See the License for the specific language governing permissions and
0017 // limitations under the License.
0018 */
0019 
0020 #ifndef INCLUDED_LVTQTC_TOOL_ADD_LOGICAL_RELATION
0021 #define INCLUDED_LVTQTC_TOOL_ADD_LOGICAL_RELATION
0022 
0023 #include <ct_lvtqtc_edge_based_tool.h>
0024 #include <ct_lvtshr_graphenums.h>
0025 
0026 #include <QGraphicsView>
0027 
0028 #include <memory>
0029 
0030 namespace Codethink::lvtldr {
0031 class NodeStorage;
0032 }
0033 
0034 namespace Codethink::lvtqtc {
0035 
0036 class LVTQTC_EXPORT ToolAddLogicalRelation : public EdgeBasedTool {
0037     Q_OBJECT
0038   protected:
0039     ToolAddLogicalRelation(const QString& name,
0040                            const QString& tooltip,
0041                            const QIcon& icon,
0042                            GraphicsView *gv,
0043                            Codethink::lvtldr::NodeStorage& nodeStorage);
0044     ~ToolAddLogicalRelation() override;
0045 
0046     bool doRun(LakosEntity *fromItem, LakosEntity *toItem, lvtshr::LakosRelationType type);
0047 
0048   private:
0049     struct Private;
0050     std::unique_ptr<Private> d;
0051 };
0052 
0053 class LVTQTC_EXPORT ToolAddIsARelation : public ToolAddLogicalRelation {
0054     Q_OBJECT
0055   public:
0056     ToolAddIsARelation(GraphicsView *gv, Codethink::lvtldr::NodeStorage& nodeStorage);
0057 
0058   protected:
0059     bool run(LakosEntity *source, LakosEntity *target) override;
0060 };
0061 
0062 class LVTQTC_EXPORT ToolAddUsesInTheImplementation : public ToolAddLogicalRelation {
0063     Q_OBJECT
0064   public:
0065     ToolAddUsesInTheImplementation(GraphicsView *gv, Codethink::lvtldr::NodeStorage& nodeStorage);
0066 
0067   protected:
0068     bool run(LakosEntity *source, LakosEntity *target) override;
0069 };
0070 
0071 class LVTQTC_EXPORT ToolAddUsesInTheInterface : public ToolAddLogicalRelation {
0072     Q_OBJECT
0073   public:
0074     ToolAddUsesInTheInterface(GraphicsView *gv, Codethink::lvtldr::NodeStorage& nodeStorage);
0075 
0076   protected:
0077     bool run(LakosEntity *source, LakosEntity *target) override;
0078 };
0079 
0080 } // namespace Codethink::lvtqtc
0081 #endif