Rev | Line | |
---|
[7851] | 1 | /*! |
---|
| 2 | * @file zip.h |
---|
| 3 | * @brief Definition of the Zip singleton Class |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _ZIP_H |
---|
| 7 | #define _ZIP_H |
---|
| 8 | |
---|
| 9 | #include <zlib.h> |
---|
| 10 | #include <string> |
---|
| 11 | #include <vector> |
---|
| 12 | |
---|
| 13 | #include "netdefs.h" |
---|
| 14 | |
---|
| 15 | struct DictionaryEntry |
---|
| 16 | { |
---|
| 17 | byte * dict; |
---|
| 18 | int dictLen; |
---|
| 19 | uLong adler; |
---|
| 20 | }; |
---|
| 21 | |
---|
| 22 | //! A class for compressing/uncompressing packes. |
---|
[9494] | 23 | class Zip |
---|
[7851] | 24 | { |
---|
| 25 | public: |
---|
| 26 | virtual ~Zip(void); |
---|
| 27 | /** @returns a Pointer to the only object of this Class */ |
---|
| 28 | inline static Zip* getInstance(void) { if (!singletonRef) singletonRef = new Zip(); return singletonRef; }; |
---|
[9494] | 29 | |
---|
[8623] | 30 | int loadDictionary( std::string name ); |
---|
[7851] | 31 | int zip( byte * from, int fromLength, byte * to, int maxLength, int dict = 0 ); |
---|
| 32 | int unZip( byte * from, int fromLength, byte * to, int maxLength ); |
---|
[9494] | 33 | |
---|
[7851] | 34 | int getDictCount(){ return dicts.size(); } |
---|
| 35 | |
---|
| 36 | private: |
---|
| 37 | Zip(); |
---|
| 38 | static Zip* singletonRef; |
---|
[9494] | 39 | |
---|
[7851] | 40 | std::vector<DictionaryEntry> dicts; |
---|
| 41 | }; |
---|
| 42 | |
---|
[9494] | 43 | #endif /* _ZIP_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.