diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-06-08 11:04:43 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-06-08 11:04:43 +0200 |
| commit | 16f738ecee689c6feb2acb7e4ef4d9bb4144ae7d (patch) | |
| tree | 3d22f54f7298f81b18ed66d05a62fa8bfab359ab /zip/ZipArchive/ZipCollections_mfc.h | |
| download | tuxcmd-modules-release-0.6.36-dev.tar.xz | |
Initial commitv0.6.36release-0.6.36-dev
Diffstat (limited to 'zip/ZipArchive/ZipCollections_mfc.h')
| -rw-r--r-- | zip/ZipArchive/ZipCollections_mfc.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/zip/ZipArchive/ZipCollections_mfc.h b/zip/ZipArchive/ZipCollections_mfc.h new file mode 100644 index 0000000..086bf64 --- /dev/null +++ b/zip/ZipArchive/ZipCollections_mfc.h @@ -0,0 +1,91 @@ +////////////////////////////////////////////////////////////////////////////////
+// This source file is part of the ZipArchive library source distribution and
+// is Copyrighted 2000 - 2007 by Artpol Software - Tadeusz Dracz
+//
+// 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.
+//
+// For the licensing details refer to the License.txt file.
+//
+// Web Site: http://www.artpol-software.com
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef ZIPARCHIVE_ZIPCOLLECTIONS_DOT_H
+ #error Do not include this file directly. Include ZipCollections.h instead
+#endif
+
+#if _MSC_VER > 1000
+ #pragma warning( push )
+ #pragma warning (disable:4786) // 'identifier' : identifier was truncated to 'number' characters in the debug information
+#endif
+
+#include <afxtempl.h>
+
+#define ZIP_ARRAY_SIZE_TYPE INT_PTR
+
+typedef CStringArray CZipStringArray;
+
+template <class TYPE>
+class CZipArray : public CArray<TYPE, TYPE>
+{
+public:
+ typedef int (*CompareFunction)(const void* pArg1, const void* pArg2);
+private:
+ static int CompareAsc(const void *pArg1, const void *pArg2)
+ {
+ TYPE w1 = *(TYPE*)pArg1;
+ TYPE w2 = *(TYPE*)pArg2;
+ return w1 == w2 ? 0 :(w2 > w1 ? - 1 : 1);
+ }
+ static int CompareDesc(const void *pArg1, const void *pArg2)
+ {
+ TYPE w1 = *(TYPE*)pArg1;
+ TYPE w2 = *(TYPE*)pArg2;
+ return w1 == w2 ? 0 :(w1 > w2 ? - 1 : 1);
+ }
+public:
+ void Sort(bool bAscending)
+ {
+ Sort(bAscending ? CompareAsc : CompareDesc);
+ }
+ void Sort(CompareFunction pFunction)
+ {
+ INT_PTR uSize = GetSize();
+ if (!uSize) // if ommitted operator [] will fail if empty
+ return;
+ qsort((void*)&((*this)[0]), (size_t)uSize , sizeof(TYPE), pFunction);
+ }
+};
+
+template<class TYPE>
+class CZipPtrList : public CTypedPtrList<CPtrList, TYPE>
+{
+public:
+ typedef POSITION iterator;
+ typedef POSITION const_iterator;
+
+ bool IteratorValid(const iterator &iter) const
+ {
+ return iter != NULL;
+ }
+
+};
+
+template<class KEY, class VALUE>
+class CZipMap : public CMap<KEY, KEY, VALUE, VALUE>
+{
+public:
+ typedef POSITION iterator;
+ typedef POSITION const_iterator;
+
+ bool IteratorValid(const iterator &iter) const
+ {
+ return iter != NULL;
+ }
+};
+
+#if _MSC_VER > 1000
+ #pragma warning( pop )
+#endif
\ No newline at end of file |
