/* * Jakelib2 - General purpose C++ library * Copyright (C) 2001 Florian Wolff (florian@donuz.de) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: ZObject.h,v 1.3 2002/06/08 10:09:42 florian Exp $ */ class ZString; class ZHashtable; class ZOutputStream; /** *

ZObject is the base class for all classes of jakelib.

* *

Every inheriting class should at least set the classname * property. * * @package jakelib.lang * @version $Id: ZObject.h,v 1.3 2002/06/08 10:09:42 florian Exp $ * @author Florian 'Overflo' Wolff (florian@donuz.de) */ class ZObject { public: ZObject(); virtual ~ZObject(); /** * Returns a hash code for this object. Should be overwritten by inheriting * classes. */ virtual int hashCode(); /** * Returns a copy of this object. Should be overwritten by inheriting classes. */ virtual ZObject* clone(); /** * Returns a string representation of this object. Should be overwritten by * inheriting classes. */ virtual ZString toString(); /** * Returns a pointer to the string representation of this object. * Should be overwritten by inheriting classes. */ virtual const char* getChars(); /** * Compares this object to another ZObject. Returns TRUE if * the objects are equal and FALSE otherwise. * Should be overwritten by inheriting classes. */ virtual boolean equals(ZObject* obj); /** * Increments the internal reference counter by one. * This function should be called directly! * Always use the macro ZREF! */ void ref(); /** * Decrements the internal reference counter by one. * This function should be called directly! * Always use the macro ZUNREF! */ unsigned long unref(); /** * Returns the class name. */ char* getClassname(); protected: /** The class name of this object. Should be set in the constructor. */ char* classname; /** The internal reference counter */ unsigned long refCounter; };