Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

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 __DATAOBJ_H_
00021 #define __DATAOBJ_H_
00022 
00023 #include "csutil/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   { SCF_CONSTRUCT_IBASE (NULL); SCF_CONSTRUCT_EMBEDDED_IBASE (scfiDataObject); }
00043   void* GetData () const
00044   { return data; }
00049   static void* GetData (iObject* obj)
00050   {
00051     iDataObject *d = CS_GET_CHILD_OBJECT (obj, iDataObject);
00052     void *res = (d ? d->GetData () : NULL);
00053     if (d) d->DecRef ();
00054     return res;
00055   }
00056 
00057   SCF_DECLARE_IBASE_EXT (csObject);
00058 
00059   struct DataObject : public iDataObject
00060   {
00061     SCF_DECLARE_EMBEDDED_IBASE (csDataObject);
00062 
00063     virtual iObject* QueryObject ()
00064     { return scfParent; }
00065     virtual void* GetData ()
00066     { return scfParent->GetData (); }
00067   } scfiDataObject;
00068 };
00069 
00070 #endif /* __DATAOBJ_H_ */

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000