00001 // 00002 // Object.h 00003 // 00004 // Object: This baseclass defines how an object should behave. 00005 // This includes the ability to be put into a list 00006 // 00007 // Part of the ht://Dig package <http://www.htdig.org/> 00008 // Copyright (c) 1999, 2000, 2001 The ht://Dig Group 00009 // For copyright details, see the file COPYING in your distribution 00010 // or the GNU General Public License version 2 or later 00011 // <http://www.gnu.org/copyleft/gpl.html> 00012 // 00013 // $Id: Object_8h-source.html,v 1.1 2008/06/08 10:12:55 sebdiaz Exp $ 00014 // 00015 00016 #ifndef _Object_h_ 00017 #define _Object_h_ 00018 00019 #include "lib.h" 00020 #include <stdio.h> 00021 00022 class String; 00023 00024 class Object 00025 { 00026 public: 00027 // 00028 // Constructor/Destructor 00029 // 00030 Object() {} 00031 virtual ~Object() {} 00032 00033 // 00034 // To ensure a consistent comparison interface and to allow comparison 00035 // of all kinds of different objects, we will define a comparison functions. 00036 // 00037 virtual int compare(const Object &) { return 0;} 00038 00039 // 00040 // To allow a deep copy of data structures we will define a standard interface... 00041 // This member will return a copy of itself, freshly allocated and deep copied. 00042 // 00043 virtual Object *Copy() const { fprintf(stderr, "Object::Copy: derived class does not implement Copy\n"); return new Object(); } 00044 }; 00045 00046 00047 #endif