#ifndef CIPHERSSINGLETON_H #define CIPHERSSINGLETON_H #include #include /** * \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 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 m_asymmetricCipherDescriptions; }; #endif // CIPHERSSINGLETON_H