cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsUnknownFieldImpl.h
1//
2// Copyright 2014 - 2026 (C). Alex Robenko. All rights reserved.
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7// This file is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20#pragma once
21
22#include "cc_tools_qt/details/ToolsFieldBase.h"
23#include "cc_tools_qt/field/ToolsUnknownField.h"
24
25namespace cc_tools_qt
26{
27
28namespace details
29{
30
31template <typename TField>
32class ToolsUnknownFieldImpl : public ToolsFieldBase<cc_tools_qt::field::ToolsUnknownField, TField>
33{
34 using Base = ToolsFieldBase<cc_tools_qt::field::ToolsUnknownField, TField>;
35 using Field = TField;
36
37public:
38 using Ptr = typename Base::Ptr;
39 using ActPtr = typename Base::ActPtr;
40
41 explicit ToolsUnknownFieldImpl(Field& fieldRef)
42 : Base(fieldRef)
43 {
44 }
45
46 ToolsUnknownFieldImpl(const ToolsUnknownFieldImpl&) = default;
47 ToolsUnknownFieldImpl(ToolsUnknownFieldImpl&&) = default;
48 virtual ~ToolsUnknownFieldImpl() noexcept = default;
49
50 ToolsUnknownFieldImpl& operator=(const ToolsUnknownFieldImpl&) = delete;
51
52protected:
53 virtual Ptr cloneImpl() override
54 {
55 return ActPtr(new ToolsUnknownFieldImpl<TField>(Base::field()));
56 }
57};
58
59template <typename TField>
60auto makeUnknownField(TField& field)
61{
62 return std::make_unique<ToolsUnknownFieldImpl<TField>>(field);
63}
64
65} // namespace details
66
67} // namespace cc_tools_qt
Main namespace for all classes / functions of the shared library.