swift
Loading...
Searching...
No Matches
presentweather.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_WEATHER_PRESENTWEATHER_H
7#define SWIFT_MISC_WEATHER_PRESENTWEATHER_H
8
9#include <QHash>
10#include <QMetaType>
11#include <QString>
12
13#include "misc/metaclass.h"
16#include "misc/valueobject.h"
17
18SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::weather, CPresentWeather)
19
20namespace swift::misc::weather
21{
25 class SWIFT_MISC_EXPORT CPresentWeather : public CValueObject<CPresentWeather>
26 {
27 public:
30 {
31 Light,
32 Moderate,
33 Heavy,
34 InVincinity
35 };
36
39 {
40 None,
41 Shallow,
42 Patches,
43 Partial,
44 Drifting,
45 Blowing,
46 Showers,
47 Thunderstorm,
48 Freezing,
49 };
50
53 {
54 NoPhenomena = 0,
55 Drizzle = 1 << 0,
56 Rain = 1 << 1,
57 Snow = 1 << 2,
58 SnowGrains = 1 << 3,
59 IceCrystals = 1 << 4,
60 IcePellets = 1 << 5,
61 Hail = 1 << 6,
62 SnowPellets = 1 << 7,
63 Unknown = 1 << 8,
64 Mist = 1 << 9,
65 Fog = 1 << 10,
66 Smoke = 1 << 11,
67 VolcanicAsh = 1 << 12,
68 Dust = 1 << 13,
69 Sand = 1 << 14,
70 Haze = 1 << 15,
71 DustSandWhirls = 1 << 16,
72 Squalls = 1 << 17,
73 TornadoOrWaterspout = 1 << 18,
74 FunnelCloud = 1 << 19,
75 Sandstorm = 1 << 20,
76 Duststorm = 1 << 21,
77 };
78
81 {
82 IndexPresentWeather = swift::misc::CPropertyIndexRef::GlobalIndexCPresentWeather,
83 IndexIntensity,
84 IndexDescriptor,
85 IndexWeatherPhenomena
86 };
87
89 static void registerMetadata();
90
92 CPresentWeather() = default;
93
95 CPresentWeather(Intensity intensity, Descriptor descriptor, int weatherPhenomena);
96
98 void setIntensity(Intensity intensity) { m_intensity = intensity; }
99
101 Intensity getIntensity() const { return m_intensity; }
102
104 void setDescriptor(Descriptor descriptor) { m_descriptor = descriptor; }
105
107 Descriptor getDescriptor() const { return m_descriptor; }
108
110 void setWeatherPhenomena(int phenomena) { m_weatherPhenomena = phenomena; }
111
113 int getWeatherPhenomena() const { return m_weatherPhenomena; }
114
116 QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
117
119 void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
120
122 QString convertToQString(bool i18n = false) const;
123
124 private:
125 Intensity m_intensity = Moderate;
126 Descriptor m_descriptor = None;
127 int m_weatherPhenomena;
128
131 SWIFT_METAMEMBER(intensity),
132 SWIFT_METAMEMBER(descriptor),
133 SWIFT_METAMEMBER(weatherPhenomena));
134 };
135
136} // namespace swift::misc::weather
137
141
142#endif // SWIFT_MISC_WEATHER_PRESENTWEATHER_H
Non-owning reference to a CPropertyIndex with a subset of its features.
Value object for present weather flags.
Intensity getIntensity() const
Get intensity.
int getWeatherPhenomena() const
Get weather phenomenas.
Descriptor getDescriptor() const
Get descriptor.
void setIntensity(Intensity intensity)
Set intensity.
void setDescriptor(Descriptor descriptor)
Set descriptor.
CPresentWeather()=default
Default constructor.
void setWeatherPhenomena(int phenomena)
Set weather phenomena.
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition metaclass.h:72
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition metaclass.h:52
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition valueobject.h:65