summaryrefslogtreecommitdiffstats
path: root/helper.h
blob: 90a1ad639bb386c289558eecc4e9e5278949ebfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version
  2 of the License, or (at your option) any later version.
*/

#ifndef HELPER_H
#define HELPER_H

#include <magic.h>

class QString;
class QFileInfo;

namespace Helper {
	const QString mimeType(const QString &path);
	const QString md5Sum(const QString &path);
	const QString moveToArchive(const QString &path, const QString &md5);
	bool removeFromArchive(const QString &filename, const QString &md5);
	const QString createArchivePath(const QString &path, const QString &md5, bool withMd5 = false);
	class StringListContains : public std::binary_function<QString, QString, bool> {
		public:
			bool operator()(const QString s, const QString &part) const;
	};
	class SortFileInfoList : public std::binary_function<QFileInfo, QFileInfo, bool> {
		public:
			bool operator()(const QFileInfo &lhs, const QFileInfo &rhs) const;
	};
	class FileInfoListContains : public std::binary_function<QFileInfo, QString, bool> {
		public:
			bool operator()(const QFileInfo &info, const QString &file) const;
	};
}

#endif