summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/compressbzip2.h
Unidiff
Diffstat (limited to 'pwmanager/pwmanager/compressbzip2.h') (more/less context) (show whitespace changes)
-rw-r--r--pwmanager/pwmanager/compressbzip2.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/compressbzip2.h b/pwmanager/pwmanager/compressbzip2.h
new file mode 100644
index 0000000..4f4885c
--- a/dev/null
+++ b/pwmanager/pwmanager/compressbzip2.h
@@ -0,0 +1,50 @@
1/***************************************************************************
2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. *
9 * *
10 ***************************************************************************/
11
12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde
16 *
17 * $Id$
18 **************************************************************************/
19
20#ifndef COMPRESSBZIP2_H
21#define COMPRESSBZIP2_H
22
23#include <string>
24using std::string;
25
26/** bzip2 compression */
27class CompressBzip2
28{
29public:
30 CompressBzip2() {}
31
32 /** compress the string d */
33 bool compress(string *d);
34 /** decompress the string d */
35 bool decompress(string *d);
36
37protected:
38 /** calculates the length of the dest-buffer
39 * for compress() using the size of the source-buffer
40 */
41 unsigned int calcCompressDestLen(unsigned int sourceLen)
42 { return (sourceLen + (sourceLen / 100 + 600)); }
43 /** calculates the length of the dest-buffer
44 * for decompress() using the size of the source-buffer
45 */
46 unsigned int calcDecompressDestLen(unsigned int sourceLen)
47 { return (sourceLen * 2); }
48};
49
50#endif