csutil/dataobj.h
00001 /* 00002 Copyright (C) 1998 by Jorrit Tyberghein 00003 csObject library (C) 1999 by Ivan Avramovic <ivan@avramovic.com> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_DATAOBJ_H_ 00021 #define __CS_DATAOBJ_H_ 00022 00023 #include "csobject.h" 00024 00032 class csDataObject : public csObject 00033 { 00034 protected: 00036 void* data; 00037 00038 public: 00040 csDataObject (void *d) : csObject (), data (d) 00041 { 00042 SCF_CONSTRUCT_IBASE (0); 00043 SCF_CONSTRUCT_EMBEDDED_IBASE (scfiDataObject); 00044 } 00046 ~csDataObject () 00047 { 00048 SCF_DESTRUCT_EMBEDDED_IBASE (scfiDataObject); 00049 SCF_DESTRUCT_IBASE (); 00050 } 00052 void* GetData () const 00053 { return data; } 00057 static void* GetData (iObject* obj) 00058 { 00059 csRef<iDataObject> d (CS_GET_CHILD_OBJECT (obj, iDataObject)); 00060 void *res = (d ? d->GetData () : 0); 00061 return res; 00062 } 00063 00064 SCF_DECLARE_IBASE_EXT (csObject); 00065 00067 struct DataObject : public iDataObject 00068 { 00069 SCF_DECLARE_EMBEDDED_IBASE (csDataObject); 00070 00071 virtual iObject* QueryObject () 00072 { return scfParent; } 00073 virtual void* GetData () 00074 { return scfParent->GetData (); } 00075 } scfiDataObject; 00076 }; 00077 00078 #endif // __CS_DATAOBJ_H__
Generated for Crystal Space by doxygen 1.2.18