cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsOptionalField.h
1//
2// Copyright 2015 - 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/ToolsField.h"
23
24#include "comms/field/Optional.h"
25
26#include <memory>
27#include <cassert>
28
29namespace cc_tools_qt
30{
31
32namespace field
33{
34
35class CC_TOOLS_API ToolsOptionalField : public ToolsField
36{
37public:
38 using ActPtr = std::unique_ptr<ToolsOptionalField>;
39 using Mode = comms::field::OptionalMode;
40
41 ToolsOptionalField();
42 virtual ~ToolsOptionalField() noexcept;
43
44 Mode getMode() const;
45
46 void setMode(Mode mode);
47
48 bool hasField() const;
49
50 ToolsField& getField();
51
52 const ToolsField& getField() const;
53
54 void setField(ToolsFieldPtr fieldPtr);
55
56 ActPtr actClone();
57
58protected:
59 virtual Mode getModeImpl() const = 0;
60 virtual void setModeImpl(Mode mode) = 0;
61
62 void dispatchImpl(ToolsFieldHandler& handler);
63};
64
65using ToolsOptionalFieldPtr = ToolsOptionalField::ActPtr;
66
67} // namespace field
68
69} // namespace cc_tools_qt
70
Main namespace for all classes / functions of the shared library.