Commits

Andreas Tscharner committed 005c469

List compression and encryption type names in an array

* Use this array in eval_compression_type and eval_encryption_type

  • Participants
  • Parent commits e1bd485

Comments (0)

Files changed (3)

File src/compiler/InFileParser.cxx

 //      InFileParser.cxx
 //
-//      Copyright 2011, 2012 Andreas Tscharner <andy@vis.ethz.ch>
+//      Copyright 2011, 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
 //
 //      This program is free software; you can redistribute it and/or modify
 //      it under the terms of the GNU Lesser General Public License as
 		return lrc::NoneCompression;
 	};
 
-	if (strcmp("zLib", p_compStr) == 0) {
-		return lrc::zLibCompression;
-	};
-
-	if (strcmp("bzip2", p_compStr) == 0) {
-		return lrc::bz2LibCompression;
+	for (unsigned int iter = lrc::NoneCompression; iter < lrc::lastCompression; iter++) {
+		if (strcmp(lrc::CompressionTypeNames[iter], p_compStr) == 0) {
+			return static_cast<lrc::CompressionType>(iter);
+		};
 	};
 
 	return lrc::NoneCompression;
 		return lrc::NoneEncryption;
 	};
 
-	if (strcmp("Serpent", p_encStr) == 0) {
-		return lrc::SerpentEncryption;
+	for (unsigned int iter = lrc::NoneEncryption; iter < lrc::lastEncryption; iter++) {
+		if (strcmp(lrc::EncryptionTypeNames[iter], p_encStr) == 0) {
+			return static_cast<lrc::EncryptionType>(iter);
+		};
 	};
 
 	return lrc::NoneEncryption;

File src/include/CompressDecompress.hxx

 //      CompressDecompress.hxx
 //
-//      Copyright 2011, 2012 Andreas Tscharner <andy@vis.ethz.ch>
+//      Copyright 2011, 2012, 2013 Andreas Tscharner <andy@vis.ethz.ch>
 //
 //      This program is free software; you can redistribute it and/or modify
 //      it under the terms of the GNU Lesser General Public License as
  * compression/decompression algorithms used in \c lrc
  *
  * \author Andreas Tscharner
- * \date 2012-12-28
+ * \date 2013-02-24
  */
 
 
 	 *
 	 * \todo Add more possibilities to compress resource
 	 */
-	 enum CompressionType {
+	enum CompressionType {
 		 NoneCompression,              //!< No compression at all
 		 zLibCompression,              //!< zlib compression
-		 bz2LibCompression             //!< bzip2 compression
-	 };
+		 bz2LibCompression,            //!< bzip2 compression
+		 lastCompression               //!< Marker for last entry
+	};
+
+	/*! German names of all possible compression types for a resource
+	 */
+	static const char *CompressionTypeNames[] = {"Keine", "zLib", "bz2Lib"};
 
 
 	/*! \class CompressDecompress

File src/include/EncryptDecrypt.hxx

 //      EncryptDecyrpt.hxx
 //
-//      Copyright 2011 Andreas Tscharner <andy@vis.ethz.ch>
+//      Copyright 2011, 2013 Andreas Tscharner <andy@vis.ethz.ch>
 //
 //      This program is free software; you can redistribute it and/or modify
 //      it under the terms of the GNU Lesser General Public License as
  * class for all encryption and decryption used in \c lrc.
  *
  * \author Andreas Tscharner
- * \date 2011-08-22
+ * \date 2013-02-24
  */
 
 
 	 *
 	 * \todo Add more possibilities to encrypt resource
 	 */
-	 enum EncryptionType {
+	enum EncryptionType {
 		 NoneEncryption,               //!< No encryption at all
-		 SerpentEncryption             //!< Serpent algorithm for encryption
-	 };
+		 SerpentEncryption,            //!< Serpent algorithm for encryption
+		 lastEncryption                //!< Marker for last entry
+	};
 
+	/*! German names of all possible encryption types for resources
+	 */
+	static const char *EncryptionTypeNames[] = {"Keine", "Serpent"};
 
 	/*! \class EncryptDecrypt
 	 *  \brief Encryption and Decryption base class