cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsBitmaskField.h
1//
2// Copyright 2014 - 2025 (C). Alex Robenko. All rights reserved.
3//
4
5// This file is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18#pragma once
19
20#include "cc_tools_qt/details/ToolsNumericFieldBase.h"
21
22#include <QtCore/QList>
23#include <QtCore/QString>
24
25#include <memory>
26
27namespace cc_tools_qt
28{
29
30namespace field
31{
32
33class CC_TOOLS_API ToolsBitmaskField : public details::ToolsNumericFieldBase<unsigned long long>
34{
35public:
36 using ActPtr = std::unique_ptr<ToolsBitmaskField>;
37
38 virtual ~ToolsBitmaskField() noexcept;
39
40 bool bitValue(unsigned idx) const;
41
42 void setBitValue(unsigned idx, bool value);
43
44 unsigned bitIdxLimit() const;
45
46 const QStringList& bits() const;
47
48 ActPtr actClone();
49
50protected:
51 virtual bool bitValueImpl(unsigned idx) const = 0;
52 virtual void setBitValueImpl(unsigned idx, bool value) = 0;
53 virtual unsigned bitIdxLimitImpl() const = 0;
54 virtual const QStringList& bitsImpl() const = 0;
55
56 virtual void dispatchImpl(ToolsFieldHandler& handler) override;
57};
58
59using ToolsBitmaskFieldPtr = ToolsBitmaskField::ActPtr;
60
61} // namespace field
62
63} // namespace cc_tools_qt
Main namespace for all classes / functions of the shared library.