Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

common.h

Go to the documentation of this file.
00001 /* 
00002  *      HT Editor
00003  *      common.h
00004  *
00005  *      Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de)
00006  *
00007  *      This program is free software; you can redistribute it and/or modify
00008  *      it under the terms of the GNU General Public License version 2 as
00009  *      published by the Free Software Foundation.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #ifndef COMMON_H
00022 #define COMMON_H
00023 
00024 #include "global.h"
00025 #include "htdebug.h"
00026 
00030 #define BUILDER(reg, obj) Object *build_##obj(){return new obj();}
00031 
00035 #define REGISTER(reg, obj) register_atom(reg, (void*)build_##obj);
00036 
00040 #define UNREGISTER(reg, obj) unregister_atom(reg);
00041 
00042 /* actually a str => bigendian-int */
00044 #define MAGICD(magic) (unsigned long)(((unsigned char)magic[0]<<24) | ((unsigned char)magic[1]<<16) | ((unsigned char)magic[2]<<8) | (unsigned char)magic[3])
00045 
00046 #define ATOM_OBJECT MAGICD("OBJ0")
00047 
00048 class ht_object_stream;
00049 
00053 class Object {
00054 public:
00055 #ifdef HTDEBUG
00056         bool initialized;
00057         bool destroyed;
00058 #endif
00059 
00060                                         Object();
00061         virtual                 ~Object();
00062 
00063                         void            init();
00064         virtual void            done();
00065         virtual int             compareTo(const Object *obj) const;
00066         virtual Object *        duplicate();
00067         virtual bool            idle();
00068         virtual bool            instanceOf(OBJECT_ID id);
00069                         bool            instanceOf(Object *o);
00070         virtual int             load(ht_object_stream *s);
00071         virtual OBJECT_ID       object_id() const;
00072         virtual void            store(ht_object_stream *s);
00073         virtual int             toString(char *s, int maxlen);
00074 };
00075 
00076 class SInt64;
00077 
00078 class UInt64: public Object {
00079         uint64  mInt;
00080 public:
00081                                         UInt64();
00082                                         UInt64(const UInt64 &u);
00083                                         UInt64(const SInt64 &s);
00084                                         UInt64(UINT u);
00085                                         UInt64(uint64 u);
00086         virtual                 ~UInt64();
00087 
00088                         void            assign(const UInt64 &u);
00089                         void            assign(const SInt64 &s);
00090                         void            assign(UINT u);
00091                         void            assign(uint64 u);
00092         virtual int             compareTo(const Object *obj) const;
00093         virtual Object *        duplicate();
00094         virtual bool            instanceOf(OBJECT_ID id);
00095         virtual int             load(ht_object_stream *s);
00096         virtual OBJECT_ID       object_id() const;
00097         virtual void            store(ht_object_stream *s);
00098         virtual int             toString(char *s, int maxlen);
00099 
00100                         void            operator =(const UInt64 &u);
00101                         void            operator +=(const UInt64 &u);
00102                         void            operator -=(const UInt64 &u);
00103                         UInt64 &        operator ++();
00104                         UInt64  operator ++(int b);
00105                         
00106                         bool            operator < (const UInt64 &s);
00107                         bool            operator > (const UInt64 &s);
00108                         bool            operator <=(const UInt64 &s);
00109                         bool            operator >=(const UInt64 &s);
00110                         bool            operator ==(const UInt64 &s);
00111                         bool            operator !=(const UInt64 &s);
00112 };
00113 
00114 #endif

Generated on Fri May 7 21:15:29 2004 by doxygen 1.3.5