WSF
ChangeWrapper.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2019 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef CHANGEWRAPPER_HPP
13#define CHANGEWRAPPER_HPP
14
15namespace wkf
16{
17class AttachmentZone;
18class ZonePoint;
19class AttachmentRoute;
20class Waypoint;
21} // namespace wkf
22
23#include <QString>
24
25#include "Platform.hpp"
26#include "WkfPointOfInterest.hpp"
27#include "WsfPM_Waypoint.hpp"
28
29namespace wizard
30{
31class Editor;
32
41{
42public:
43 ChangeWrapper(wizard::Editor* aEditorPtr, UtTextDocumentRange aRange)
44 : mEditorPtr(aEditorPtr)
45 , mRange(aRange)
46 {
47 }
48
50 explicit ChangeWrapper(WsfPProxyNode aProxyNode);
51
55 ChangeWrapper(wizard::Platform* aPlatformPtr, WsfPProxyNode aProxyNode);
56
57 ChangeWrapper(wizard::Editor* aEditorPtr, vespa::VaAttachment* aAttachmentPtr, UtTextDocumentRange aRange)
58 : mEditorPtr(aEditorPtr)
59 , mRange(aRange)
60 , mAttachmentPtr(aAttachmentPtr)
61 {
62 }
63
65 wizard::Platform* aPlatformPtr,
66 vespa::VaAttachment* aAttachmentPtr,
67 WsfPProxyNode aProxyNode)
68 : mEditorPtr(aEditorPtr)
69 , mPlatformPtr(aPlatformPtr)
70 , mAttachmentPtr(aAttachmentPtr)
71 , mNode(aProxyNode)
72 {
73 SetRangeFromNode();
74 }
75
80 ChangeWrapper(wizard::Platform* aPlatformPtr, vespa::VaAttachment* aAttachmentPtr, WsfPProxyNode aProxyNode);
81
86 ChangeWrapper(wizard::Platform* aPlatformPtr, wkf::Waypoint* aWaypointPtr, WsfPProxyNode aProxyNode);
87
92 ChangeWrapper(wizard::Platform* aPlatformPtr, wkf::ZonePoint* aZonePointPtr, WsfPProxyNode aProxyNode);
93
96 ChangeWrapper(wkf::PointOfInterest* aPointOfInterestPtr, WsfPProxyNode aProxyNode);
97
100 bool operator<(const ChangeWrapper& aRHS) const noexcept
101 {
102 if (!mRange.Valid())
103 {
104 // if the range for this object is not valid bail out
105 return false;
106 }
107 else if (!aRHS.mRange.Valid())
108 {
109 // if the range of the item being compared to is undefined, assume this is smaller and bail out
110 return true;
111 }
112 if (mRange.mSource->GetFilePath() == aRHS.mRange.mSource->GetFilePath())
113 {
114 if (mRange.GetBegin() == aRHS.mRange.GetBegin())
115 {
116 return mRange.GetEnd() > aRHS.mRange.GetEnd();
117 }
118 else
119 {
120 return mRange.GetBegin() > aRHS.mRange.GetBegin();
121 }
122 }
123 else
124 {
125 return mRange.mSource->GetFilePath() < aRHS.mRange.mSource->GetFilePath();
126 }
127 }
128
130
131
134 wkf::AttachmentRoute* GetRoute() const noexcept;
135
138 wkf::Waypoint* GetWaypoint() const noexcept;
139
142 wkf::AttachmentZone* GetZone() const noexcept;
143
146 wkf::ZonePoint* GetZonePoint() const noexcept;
147
150 wizard::Platform* GetPlatform() const noexcept;
151
154 wkf::PointOfInterest* GetPointOfInterest() const noexcept;
155
156 wizard::Editor* GetEditor() const { return mEditorPtr; }
157 const UtTextDocumentRange& GetRange() const { return mRange; }
158 WsfPProxyNode GetProxyNode() const { return mNode; }
160
161private:
165 void SetRangeFromNode() noexcept;
166
170 void SetEditorFromRange() noexcept;
171
172 wizard::Editor* mEditorPtr{nullptr};
173 UtTextDocumentRange mRange;
174 wizard::Platform* mPlatformPtr{nullptr};
175 wkf::PointOfInterest* mPointOfInterestPtr{nullptr};
176 vespa::VaAttachment* mAttachmentPtr{nullptr};
177 wkf::Waypoint* mWaypointPtr{nullptr};
178 wkf::ZonePoint* mZonePointPtr{nullptr};
179 WsfPProxyNode mNode;
180};
181} // namespace wizard
182
183#endif
#define VI_EXPORT
Definition ViExport.hpp:38
Definition WsfPProxyNode.hpp:60
Definition ChangeWrapper.hpp:41
ChangeWrapper(wizard::Editor *aEditorPtr, vespa::VaAttachment *aAttachmentPtr, UtTextDocumentRange aRange)
Definition ChangeWrapper.hpp:57
bool operator<(const ChangeWrapper &aRHS) const noexcept
Definition ChangeWrapper.hpp:100
ChangeWrapper(wizard::Editor *aEditorPtr, wizard::Platform *aPlatformPtr, vespa::VaAttachment *aAttachmentPtr, WsfPProxyNode aProxyNode)
Definition ChangeWrapper.hpp:64
WsfPProxyNode GetProxyNode() const
Definition ChangeWrapper.hpp:158
ChangeWrapper(wizard::Editor *aEditorPtr, UtTextDocumentRange aRange)
Definition ChangeWrapper.hpp:43
const UtTextDocumentRange & GetRange() const
Definition ChangeWrapper.hpp:157
wizard::Editor * GetEditor() const
Definition ChangeWrapper.hpp:156
Definition Editor.hpp:57
Definition wizard/lib/source/map/Platform.hpp:37
@ Waypoint
Definition P6DofVehicleData.hpp:304
Definition Runner.hpp:22
Definition ActionManager.hpp:28
Copyrights Multiple, All Rights Reserved