00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __BASE_H__
00018 #define __BASE_H__
00019
00020 #include "inspircd_config.h"
00021 #include <time.h>
00022 #include <map>
00023 #include <string>
00024
00025 typedef void* VoidPointer;
00026
00029 class classbase
00030 {
00031 public:
00034 time_t age;
00035
00039 classbase() { age = time(NULL); }
00040 ~classbase() { }
00041 };
00042
00050 class Extensible : public classbase
00051 {
00054 std::map<std::string,char*> Extension_Items;
00055
00056 public:
00057
00069 bool Extend(std::string key, char* p);
00070
00080 bool Shrink(std::string key);
00081
00088 char* GetExt(std::string key);
00089 };
00090
00091 const int bitfields[] = {1,2,4,8,16,32,64,128};
00092 const int inverted_bitfields[] = {~1,~2,~4,~8,~16,~32,~64,~128};
00093
00098 class BoolSet
00099 {
00100 char bits;
00101
00102 public:
00103
00106 BoolSet();
00107
00110 BoolSet(char bitmask);
00111
00116 void Set(int number);
00117
00124 bool Get(int number);
00125
00130 void Unset(int number);
00131
00136 void Invert(int number);
00137
00140 bool operator==(BoolSet other);
00141
00144 BoolSet operator|(BoolSet other);
00145
00148 BoolSet operator&(BoolSet other);
00149
00152 bool operator=(BoolSet other);
00153 };
00154
00155
00156 #endif
00157