Mercurial > trustbridge
annotate ui/certificatelist.h @ 205:a3f542bf38f7
Added header for mainwindow.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 26 Mar 2014 15:21:34 +0100 |
parents | 00a93409e93e |
children | 60c5df8e7980 |
rev | line source |
---|---|
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
1 #ifndef CERTIFICATELIST_H |
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
2 #define CERTIFICATELIST_H |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
3 /** |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
4 * This class handles a certificate list file. |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
5 * It checks for the validity of that certificate |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
6 * list file and provides an API for working with that |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
7 * file. |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
8 * |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
9 * The List is parsed on Initialization. You should |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
10 * check the Status afterwards to see if the file |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
11 * could be parsed. |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 * |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 */ |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 class QByteArray; |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 #include <QString> |
9
2ad9a96518e3
Actually parse all elements in the list
Andre Heinecke <aheinecke@intevation.de>
parents:
7
diff
changeset
|
18 #include <QDateTime> |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
19 #include <QObject> |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
20 |
25
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
21 #include "../common/listutil.h" |
21
dc1e1e9e62ce
Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
18
diff
changeset
|
22 #include "certificate.h" |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
23 |
70
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
24 class CertificateList |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
25 { |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
26 public: |
70
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
27 CertificateList(); |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
28 CertificateList(const char *fileName); |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
29 |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
30 list_status_t getStatus() {return mStatus;} |
25
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
31 |
70
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
32 /** @brief Read a list |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
33 * |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
34 * @param[in] fileName the filename of the list to read |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
35 * |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
36 * @return status of the read. Vaild on success. |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
37 */ |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
38 list_status_t readList(const char *fileName); |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
39 |
25
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
40 /** @brief Returns true if the list is Valid |
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
41 * |
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
42 * A list is valid only if the signature matched and the |
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
43 * list could be parsed. |
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
44 */ |
26
cbd57d767dfa
Move layout around. Restructure CMakeLists
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
45 bool isValid() const {return mStatus == Valid;} |
25
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
46 |
84
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
47 /* @brief get a list of certificate objects that should be installed */ |
79
1dd8e91972a8
Add accessors to certificate's in certificatelist
Andre Heinecke <aheinecke@intevation.de>
parents:
70
diff
changeset
|
48 const QList<Certificate>& getInstallCertificates() const; |
84
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
49 |
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
50 /* @brief get a list of certificate objects that should be removed */ |
79
1dd8e91972a8
Add accessors to certificate's in certificatelist
Andre Heinecke <aheinecke@intevation.de>
parents:
70
diff
changeset
|
51 const QList<Certificate>& getRemoveCertificates() const; |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
52 |
84
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
53 /* @brief get the raw certificate list */ |
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
54 const QString& rawData() const {return mData;} |
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
55 |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
56 private: |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
57 QString mFileName; |
21
dc1e1e9e62ce
Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
18
diff
changeset
|
58 QList<Certificate> mCertificatesInstall; |
dc1e1e9e62ce
Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
18
diff
changeset
|
59 QList<Certificate> mCertificatesRemove; |
84
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
60 QString mData; |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
61 list_status_t mStatus; |
9
2ad9a96518e3
Actually parse all elements in the list
Andre Heinecke <aheinecke@intevation.de>
parents:
7
diff
changeset
|
62 QDateTime mDate; |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
63 }; |
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
64 #endif |