-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
180 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. | ||
// | ||
|
||
// This file is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
#pragma once | ||
|
||
#include "cc_tools_qt/details/ToolsFieldBase.h" | ||
#include "cc_tools_qt/field/ToolsBundleField.h" | ||
|
||
#include "comms/field/Bundle.h" | ||
|
||
#include <cstdint> | ||
#include <cassert> | ||
#include <memory> | ||
#include <vector> | ||
|
||
namespace cc_tools_qt | ||
{ | ||
|
||
namespace details | ||
{ | ||
|
||
template <typename TField> | ||
class ToolsBundleFieldImpl : public ToolsFieldBase<cc_tools_qt::field::ToolsBundleField, TField> | ||
{ | ||
using Base = ToolsFieldBase<cc_tools_qt::field::ToolsBundleField, TField>; | ||
using Field = TField; | ||
|
||
static_assert(comms::field::isBundle<Field>(), "Must be of Bundle field type"); | ||
|
||
public: | ||
using ActPtr = typename Base::ActPtr; | ||
|
||
explicit ToolsBundleFieldImpl(Field& fieldRef) | ||
: Base(fieldRef) | ||
{ | ||
} | ||
|
||
ToolsBundleFieldImpl(const ToolsBundleFieldImpl&) = default; | ||
ToolsBundleFieldImpl(ToolsBundleFieldImpl&&) = default; | ||
virtual ~ToolsBundleFieldImpl() noexcept = default; | ||
|
||
ToolsBundleFieldImpl& operator=(const ToolsBundleFieldImpl&) = delete; | ||
|
||
protected: | ||
virtual ActPtr cloneImpl() override | ||
{ | ||
return ActPtr(new ToolsBundleFieldImpl(Base::field())); | ||
} | ||
}; | ||
|
||
template <typename TField> | ||
auto makeBundleField(TField& field) | ||
{ | ||
return std::make_unique<ToolsBundleFieldImpl<TField>>(field); | ||
} | ||
|
||
} // namespace details | ||
|
||
} // namespace cc_tools_qt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,6 @@ | |
#include <memory> | ||
#include <limits> | ||
|
||
#include "cc_tools_qt/ToolsField.h" | ||
|
||
namespace cc_tools_qt | ||
{ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// Copyright 2014 - 2024 (C). Alex Robenko. All rights reserved. | ||
// | ||
|
||
// This file is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
#pragma once | ||
|
||
#include "cc_tools_qt/ToolsField.h" | ||
|
||
#include <memory> | ||
#include <vector> | ||
|
||
namespace cc_tools_qt | ||
{ | ||
|
||
namespace field | ||
{ | ||
|
||
class CC_API ToolsBundleField : public ToolsField | ||
{ | ||
using Base = ToolsField; | ||
public: | ||
using Members = std::vector<ToolsFieldPtr>; | ||
using ActPtr = std::unique_ptr<ToolsBundleField>; | ||
|
||
ToolsBundleField(); | ||
ToolsBundleField(const ToolsBundleField&) =delete; | ||
ToolsBundleField& operator=(const ToolsBundleField&) =delete; | ||
|
||
virtual ~ToolsBundleField() noexcept; | ||
|
||
Members& getMembers(); | ||
|
||
const Members& getMembers() const; | ||
|
||
void setMembers(Members&& members); | ||
|
||
ActPtr clone(); | ||
|
||
protected: | ||
virtual ActPtr cloneImpl() = 0; | ||
|
||
void dispatchImpl(field_wrapper::FieldWrapperHandler& handler); | ||
|
||
private: | ||
Members m_members; | ||
}; | ||
|
||
using ToolsBundleFieldPtr = ToolsBundleField::ActPtr; | ||
|
||
} // namespace field | ||
|
||
} // namespace cc_tools_qt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.