comparison ui/certificate.h @ 1255:2a1aa9df8f11

(issue133) Improve API documentation
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 25 Sep 2014 17:58:12 +0200
parents 9bb9932bb819
children 265583011f24
comparison
equal deleted inserted replaced
1254:6d840341bc25 1255:2a1aa9df8f11
21 #ifdef Q_OS_WIN 21 #ifdef Q_OS_WIN
22 #include <windows.h> 22 #include <windows.h>
23 #include <wincrypt.h> 23 #include <wincrypt.h>
24 #endif 24 #endif
25 25
26 /** @brief Object representation of a single certificate
27 *
28 * This parses a PEM (base64 encoded der certificate) and
29 * provides accessors to the parsed certificate information
30 * together with meta information about the certificate as
31 * it is used by the Application.
32 */
26 class Certificate 33 class Certificate
27 { 34 {
28 public: 35 public:
29 36
30 /** @brief the Status compared to the last installed list. */ 37 /**
38 * @enum Status
39 * @brief the Status compared to the last installed list. */
31 enum Status { 40 enum Status {
32 InstallNew = 1, /* Never seen this before */ 41 /*! Never seen this before */ InstallNew = 1,
33 InstallOld, /* Already contained in last list */ 42 /*! Already contained in last list */ InstallOld,
34 RemoveNew, /* Was an Install certificate in the last list */ 43 /*! Was an Install certificate in the last list */ RemoveNew,
35 RemoveOld /* Already removed in the last list */ 44 /*! Already removed in the last list */ RemoveOld
36 }; 45 };
37 46
38 /** @brief construct a certificate from a line of a certificate list. 47 /** @brief construct a certificate from a line of a certificate list.
39 * 48 *
40 * The first two characters of the string are expected to be 49 * The first two characters of the string are expected to be
88 * 97 *
89 * Set the base 64 line prefix to "I:" or "R:". 98 * Set the base 64 line prefix to "I:" or "R:".
90 **/ 99 **/
91 void setInstallCert(bool install); 100 void setInstallCert(bool install);
92 101
102 /** @brief wether or not the certificate is editable.
103 *
104 * Editable means that the installation status can be changed.
105 * E.g. You can not change the state of a removal certificate
106 * that has been removed.
107 *
108 * @returns true if the certificate is editable */
93 bool isEditable() const {return mEditable;} 109 bool isEditable() const {return mEditable;}
94 110
111 /** @brief setter for the editable property. */
95 void setEditable(bool edit) {mEditable = edit;} 112 void setEditable(bool edit) {mEditable = edit;}
96 113
97 /** @brief get the subject OU from the certificate */ 114 /** @brief get the subject OU from the certificate */
98 QString subjectOU() const {return mSubjectOU;} 115 QString subjectOU() const {return mSubjectOU;}
99 116
131 * The size restrictions for the certificate list file also apply 148 * The size restrictions for the certificate list file also apply
132 * for this file. 149 * for this file.
133 **/ 150 **/
134 static QList<Certificate> fromFileName (const QString& file_name); 151 static QList<Certificate> fromFileName (const QString& file_name);
135 152
153 /** @brief comparator of two certificates.
154 *
155 * Two certificates are equal if their base64 raw data is a match
156 * regardless of other meta information like state or wether or not
157 * it is editable.
158 *
159 * @returns true if the base64 line of two certificates is equal.
160 **/
136 friend inline bool operator==(const Certificate& lhs, const Certificate& rhs) { 161 friend inline bool operator==(const Certificate& lhs, const Certificate& rhs) {
137 return lhs.base64Line() == rhs.base64Line(); 162 return lhs.base64Line() == rhs.base64Line();
138 } 163 }
139 private: 164 private:
140 /** @brief Helper function to parse the details of a certificate **/ 165 /** @brief Helper function to parse the details of a certificate **/

http://wald.intevation.org/projects/trustbridge/