diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-03-25 10:15:50 +0100 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-03-25 10:33:32 +0100 |
| commit | a1e3d36dca9c6abf235c7ddf47ab9185c4b748d5 (patch) | |
| tree | 859befb5df101432b7388e1562f90a01c6d8e238 /src/cipherssingleton.h | |
| download | IT-Sicherheit-a1e3d36dca9c6abf235c7ddf47ab9185c4b748d5.tar.gz IT-Sicherheit-a1e3d36dca9c6abf235c7ddf47ab9185c4b748d5.zip | |
First commit of IT-Sicherheit
Diffstat (limited to 'src/cipherssingleton.h')
| -rw-r--r-- | src/cipherssingleton.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/cipherssingleton.h b/src/cipherssingleton.h new file mode 100644 index 0000000..6286652 --- /dev/null +++ b/src/cipherssingleton.h @@ -0,0 +1,111 @@ +#ifndef CIPHERSSINGLETON_H +#define CIPHERSSINGLETON_H + +#include <QVector> +#include <QString> + + +/** +* \class CiphersSingleton +* \brief Singleton-Class to assign a short descriptive string and a number for all Ciphers. +* +* This Class, basically, provides an Array containing QStrings, each of which is used as +* description for an available cipher. +* The index of each QString is also used to describe the cipher. +* This is needed since sometimes ciphers need to be referred to by strings, and other times +* by integers. +* \author Uwe Gogolin [Gogolin.Uwe@FH-SWF.de] +* \version 0.1 +* \date 28.02.2013 +*/ +class CiphersSingleton +{ +public: //Methods + /** + * \brief Method to fetch the Singleton-Instance of this class. + * + * The Assignments of QStrings to Integers (and vice versa) made in this Class is needed + * throughout the entire program. This Method, therefore, returns a Singleton-instance of + * this Class. + * \returns A reference to the Singleton-instance of this Class + */ + static CiphersSingleton & getInstance() + { return instance; } + + + + /** + * \brief Method to fetch a QString corresponding with the given Integer. + * + * For the given value, looks up what QString corresponds to it and returns that. + * \param int value integer representing an algorithm + * \returns QString corresponding to the given integer. + */ + QString textFromValue ( int value ); + + + /** + * \brief Method to fetch an Integer corresponding with the given QString. + * + * For the given QString, looks up what Integer corresponds to it and returns that. + * \param QString& text QString representing an algorithm + * \returns Integer corresponding to the given QString. + */ + int valueFromText ( const QString& text ); + + + /** + * \brief Method to fetch the number of supported symmetric Ciphers. + * + * Returns the number of supported symmetric Ciphers. + * \returns The number of supported symmetric Ciphers. + */ + int symmetricCiphersCount() + { return m_symmetricCipherDescriptions.size(); } + + + /** + * \brief Method to fetch the number of supported asymmetric Ciphers. + * + * Returns the number of supported asymmetric Ciphers. + * \returns The number of supported asymmetric Ciphers. + */ + int asymmetricCiphersCount() + { return m_asymmetricCipherDescriptions.size(); } + + +private: //Methods + /** + * \brief Class Constructor. + * + * Class Constructor. Initializes the Array containing the Cipher-Strings. + */ + CiphersSingleton(); + + + +private: //Attributes + /** + * \brief Singleton-instance of this class. + */ + static CiphersSingleton instance; + + + + /** + * \brief QVector of QStrings assigning an integer to a String for each symmetric Cipher (and vice versa). + * + * \attention These Strings are used throughout the entire program to reference ciphers! + */ + QVector<QString> m_symmetricCipherDescriptions; + + + /** + * \brief QVector of QStrings assigning an integer to a String for each asymmetric Cipher (and vice versa). + * + * \attention These Strings are used throughout the entire program to reference ciphers! + */ + QVector<QString> m_asymmetricCipherDescriptions; +}; + +#endif // CIPHERSSINGLETON_H |
