Mercurial > trustbridge
diff 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 |
line wrap: on
line diff
--- a/ui/certificate.h Thu Sep 25 17:37:03 2014 +0200 +++ b/ui/certificate.h Thu Sep 25 17:58:12 2014 +0200 @@ -23,16 +23,25 @@ #include <wincrypt.h> #endif +/** @brief Object representation of a single certificate + * + * This parses a PEM (base64 encoded der certificate) and + * provides accessors to the parsed certificate information + * together with meta information about the certificate as + * it is used by the Application. + */ class Certificate { public: - /** @brief the Status compared to the last installed list. */ + /** + * @enum Status + * @brief the Status compared to the last installed list. */ enum Status { - InstallNew = 1, /* Never seen this before */ - InstallOld, /* Already contained in last list */ - RemoveNew, /* Was an Install certificate in the last list */ - RemoveOld /* Already removed in the last list */ + /*! Never seen this before */ InstallNew = 1, + /*! Already contained in last list */ InstallOld, + /*! Was an Install certificate in the last list */ RemoveNew, + /*! Already removed in the last list */ RemoveOld }; /** @brief construct a certificate from a line of a certificate list. @@ -90,8 +99,16 @@ **/ void setInstallCert(bool install); + /** @brief wether or not the certificate is editable. + * + * Editable means that the installation status can be changed. + * E.g. You can not change the state of a removal certificate + * that has been removed. + * + * @returns true if the certificate is editable */ bool isEditable() const {return mEditable;} + /** @brief setter for the editable property. */ void setEditable(bool edit) {mEditable = edit;} /** @brief get the subject OU from the certificate */ @@ -133,6 +150,14 @@ **/ static QList<Certificate> fromFileName (const QString& file_name); + /** @brief comparator of two certificates. + * + * Two certificates are equal if their base64 raw data is a match + * regardless of other meta information like state or wether or not + * it is editable. + * + * @returns true if the base64 line of two certificates is equal. + **/ friend inline bool operator==(const Certificate& lhs, const Certificate& rhs) { return lhs.base64Line() == rhs.base64Line(); }