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