KWeatherCore

alertentry.h
1 /*
2  * SPDX-FileCopyrightText: 2021 Anjani Kumar <[email protected]>
3  * SPDX-License-Identifier: LGPL-2.0-or-later
4  */
5 
6 #pragma once
7 #include "kweathercore/kweathercore_export.h"
8 #include <QDateTime>
9 #include <QObject>
10 #include <memory>
11 #include <vector>
12 namespace KWeatherCore
13 {
14 class AlertInfo;
15 /**
16  * @short Class represents single CAP
17  *
18  * This class contains the information of a parsed
19  * CAP file
20  * @see AlertInfo
21  *
22  * @author Anjani Kumar <[email protected]>
23  */
24 class KWEATHERCORE_EXPORT AlertEntry
25 {
26  Q_GADGET
27  Q_PROPERTY(QString identifier READ identifier WRITE setIdentifier)
28  Q_PROPERTY(QString sender READ sender WRITE setSender)
29  Q_PROPERTY(QDateTime sentTime READ sentTime WRITE setSentTime)
30  Q_PROPERTY(QString note READ note WRITE setNote)
31 public:
32  enum class Status {
33  Unknown,
34  Actual,
35  Exercise,
36  System,
37  Test,
38  Draft,
39  };
40  enum class MsgType {
41  Unknown,
42  Alert,
43  Update,
44  Cancel,
45  Ack,
46  Error,
47  };
48  enum class Scope {
49  Unknown,
50  Public,
51  Restricted,
52  Private,
53  };
54 
55  /**
56  * Default constructor, Status, MsgType, Scope
57  * are set to Unknown
58  */
59  AlertEntry();
60  /**
61  * Copy Constructor
62  */
63  AlertEntry(const AlertEntry &other);
64  /**
65  * overloaded copy constructor
66  */
67  AlertEntry(AlertEntry &&other);
68  ~AlertEntry();
69 
70  /**
71  * identifier of CAP
72  */
73  const QString &identifier() const;
74  /**
75  * CAP file sender
76  */
77  const QString &sender() const;
78  /**
79  * sentTime of CAP
80  * @return
81  */
82  const QDateTime &sentTime() const;
83  /**
84  * status enum, initilized to Unknown
85  */
86  Status status() const;
87  /**
88  * msgType enum, initilized to Unknown
89  */
90  MsgType msgType() const;
91  /**
92  * scope enum, initilized to Unknown
93  */
94  Scope scope() const;
95  /**
96  * note of CAP
97  */
98  const QString &note() const;
99  /**
100  * the parsed info entries in CAP
101  * see @AlertInfo
102  */
103  const std::vector<AlertInfo> &infoVec() const;
104 
105  void setIdentifier(const QString &identifier);
106  void setSender(const QString &sender);
107  void setSentTime(const QDateTime &dateTime);
108  void setStatus(Status status);
109  void setMsgType(MsgType msgType);
110  void setScope(Scope scope);
111  void setNote(const QString &note);
112  void setInfoVec(const std::vector<AlertInfo> &infoVec);
113  void setInfoVec(std::vector<AlertInfo> &&infoVec);
114  void addInfo(const AlertInfo &alertInfo);
115  void addInfo(AlertInfo &&alertInfo);
116  AlertEntry &operator=(const AlertEntry &other);
117  AlertEntry &operator=(AlertEntry &&other);
118 
119 private:
120  class AlertEntryPrivate;
121  std::unique_ptr<AlertEntryPrivate> d;
122 };
123 }
Class represents single CAP.
Definition: alertinfo.h:27
Class represents single CAP.
Definition: alertentry.h:24
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Oct 21 2021 23:05:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.