Browse Source

- added 'magic' to allow iteration over enum

master
Andreas Romeyke 2 years ago
parent
commit
9533ed598b
1 changed files with 17 additions and 3 deletions
  1. +17
    -3
      src/include/checksum.hpp

+ 17
- 3
src/include/checksum.hpp View File

@ -6,17 +6,31 @@
#include <openssl/sha.h>
using namespace std;
enum checksum_algorithms {md5=1, sha1, sha256};
typedef struct {
long unsigned int octetcount;
long unsigned int streamcount;
} oxum_t;
//enum Checksum_algorithms {md5=1, sha1, sha256};
#define SequentialEnum(Name,...) \
enum Name { __VA_ARGS__ }; \
namespace \
{ \
const std::initializer_list<Name> Name##List { __VA_ARGS__ }; \
};
SequentialEnum(checksum_algorithms,
md5,
sha1,
sha256,
);
string string_of_algorithm( checksum_algorithms alg);
class Checksum {
public:
//Checksum();
//list<string> get_supported_checksum_algorithms();
//bool is_algorithm_supported( string alg );
bool is_algorithm_supported( checksum_algorithms alg );
string checksum_of_file(string filepath, checksum_algorithms alg);
oxum_t oxum_of_file(string filepath);
oxum_t oxum_of_filelist( list<string> filepaths);


Loading…
Cancel
Save