cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsBitmaskField.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/ToolsNumericFieldBase.h"
23
24#include <QtCore/QList>
25#include <QtCore/QString>
26
27#include <memory>
28
29namespace cc_tools_qt
30{
31
32namespace field
33{
34
35class CC_TOOLS_API ToolsBitmaskField : public details::ToolsNumericFieldBase<unsigned long long>
36{
37public:
38 using ActPtr = std::unique_ptr<ToolsBitmaskField>;
39
40 virtual ~ToolsBitmaskField() noexcept;
41
42 bool bitValue(unsigned idx) const;
43
44 void setBitValue(unsigned idx, bool value);
45
46 unsigned bitIdxLimit() const;
47
48 const QStringList& bits() const;
49
50 ActPtr actClone();
51
52protected:
53 virtual bool bitValueImpl(unsigned idx) const = 0;
54 virtual void setBitValueImpl(unsigned idx, bool value) = 0;
55 virtual unsigned bitIdxLimitImpl() const = 0;
56 virtual const QStringList& bitsImpl() const = 0;
57
58 virtual void dispatchImpl(ToolsFieldHandler& handler) override;
59};
60
61using ToolsBitmaskFieldPtr = ToolsBitmaskField::ActPtr;
62
63} // namespace field
64
65} // namespace cc_tools_qt
Main namespace for all classes / functions of the shared library.