00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #define DEBUG_ARRAY
00020 #define DEBUG_AMORPH
00021
00022 #include <basis/istring.h>
00023 #include <data_struct/amorph.h>
00024
00025 #include <string.h>
00026
00027 class bogon
00028 {
00029 public:
00030 bogon(byte *to_copy) : my_held(NIL) {
00031 if (to_copy) {
00032 istring t((char *)to_copy);
00033 if (t.length()) {
00034 my_held = new byte[t.length() + 1];
00035 t.stuff((char *)my_held, t.length() + 1);
00036 }
00037 }
00038 }
00039 bogon(const bogon &to_copy) : my_held(NIL) { operator = (to_copy); }
00040 bogon &operator = (const bogon &to_copy) {
00041 if (this == &to_copy) return *this;
00042 istring t((char *)to_copy.my_held);
00043 if (my_held) delete [] my_held;
00044 my_held = new byte[t.length() + 1];
00045 t.stuff((char *)my_held, t.length() + 1);
00046 return *this;
00047 }
00048 ~bogon() { if (my_held) delete [] my_held; }
00049 byte *held() const { return my_held; }
00050 int size() const { return my_held? int(strlen((char *)my_held) + 1) : 0; }
00051
00052 private:
00053 byte *my_held;
00054 };