cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
ToolsFloatField.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/QPair>
26
27#include <memory>
28
29namespace cc_tools_qt
30{
31
32namespace field
33{
34
35class CC_TOOLS_API ToolsFloatField : public details::ToolsNumericFieldBase<double>
36{
37 using Base = details::ToolsNumericFieldBase<double>;
38public:
39
40 using UnderlyingType = Base::UnderlyingType;
41 using ActPtr = std::unique_ptr<ToolsFloatField>;
42 using SpecialType = QPair<QString, UnderlyingType>;
43 using SpecialsList = QList<SpecialType>;
44
45 ToolsFloatField();
46 virtual ~ToolsFloatField() noexcept;
47
48 bool isNan() const;
49 void setNan();
50 bool isInf() const;
51 void setInf();
52 bool isMinusInf() const;
53 void setMinusInf();
54 double getEpsilon() const;
55 const SpecialsList& specials() const;
56 int decimals() const;
57
58 ActPtr actClone();
59
60protected:
61 virtual bool isNanImpl() const = 0;
62 virtual void setNanImpl() = 0;
63 virtual bool isInfImpl() const = 0;
64 virtual void setInfImpl() = 0;
65 virtual bool isMinusInfImpl() const = 0;
66 virtual void setMinusInfImpl() = 0;
67 virtual double getEpsilonImpl() const = 0;
68 virtual const SpecialsList& specialsImpl() const = 0;
69 virtual int decimalsImpl() const = 0;
70
71 virtual void dispatchImpl(ToolsFieldHandler& handler) override;
72};
73
74using ToolsFloatFieldPtr = ToolsFloatField::ActPtr;
75
76} // namespace field
77
78} // namespace cc_tools_qt
Main namespace for all classes / functions of the shared library.