00001
00002 #ifndef __JBXL_CPP_TOOLSPP_H_
00003 #define __JBXL_CPP_TOOLSPP_H_
00004
00005
00013 #include "common++.h"
00014 #include "tools.h"
00015 #include "xtools.h"
00016
00017
00018
00019
00020 namespace jbxl {
00021
00022
00024
00025
00026
00032 class Base64
00033 {
00034 public:
00035 Base64(void) { init();}
00036 virtual ~Base64(void) { free();}
00037
00038 private:
00039 void init(void) { }
00040 void free(void) { }
00041
00042 protected:
00043
00044 public:
00045 unsigned char* encode(unsigned char* str, int sz) { return encode_base64(str, sz);}
00046 unsigned char* decode(unsigned char* str, int* sz) { return decode_base64(str, sz);}
00047 Buffer encode(Buffer buf) { return encode_base64_Buffer(buf);}
00048 Buffer decode(Buffer buf) { return decode_base64_Buffer(buf);}
00049 };
00050
00051
00052
00053
00054
00056
00057
00058
00072
00073
00074
00075
00076 template <typename T> tList* add_tList_object(tList* lt, T obj)
00077 {
00078 T* pp = new T();
00079 *pp = obj;
00080 lt = add_tList_node_bystr(lt, 0, 0, NULL, NULL, (void*)pp, sizeof(T));
00081
00082 return lt;
00083 }
00084
00085
00086 template <typename T> void del_tList_object(tList** lp)
00087 {
00088 tList* lt = *lp;
00089
00090 while(lt!=NULL) {
00091 T* pp = (T*)lt->ldat.ptr;
00092 pp->free();
00093 delete(pp);
00094 lt->ldat.ptr = NULL;
00095 lt->ldat.sz = 0;
00096 lt = lt->next;
00097 }
00098 del_tList(lp);
00099 }
00100
00101
00102
00103
00105
00106
00107 #ifdef WIN32
00108
00109 #ifndef va_start
00110 #include <stdarg.h>
00111 #endif
00112
00113 void DisPatcher(int sno=0, ...);
00114
00115
00116 #endif // WIN32
00117
00118
00119
00120 }
00121
00122
00123 #endif