CrystalSpace

Public API Reference

csutil/csobject.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 1998-2001 by Jorrit Tyberghein
00003     csObject library (C) 1999 by Ivan Avramovic <[email protected]>
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_CSOBJECT_H__
00021 #define __CS_CSOBJECT_H__
00022 
00027 #include "csextern.h"
00028 
00029 #include "csutil/leakguard.h"
00030 #include "csutil/refarr.h"
00031 #include "csutil/scf_implementation.h"
00032 
00033 #include "iutil/object.h"
00034 
00035 typedef csRefArray<iObject> csObjectContainer;
00036 
00042 class CS_CRYSTALSPACE_EXPORT csObject : 
00043   public scfImplementation1<csObject, iObject>
00044 {
00045 protected:
00046   friend class csObjectIterator;
00048   uint csid;
00049 
00051   csObjectContainer *Children;
00052 
00054   char *Name;
00055 
00057   iObject *ParentObject;
00058 
00060   csRefArray<iObjectNameChangeListener> listeners;
00061 
00063   void InitializeObject ();
00064 
00066   void FireNameChangeListeners (const char* oldname, const char* newname);
00067 
00068 public:
00069   CS_LEAKGUARD_DECLARE (csObject);
00070 
00072   csObject (iBase* pParent = 0);
00073 
00079   csObject (csObject &o);
00080 
00082   virtual ~csObject ();
00083 
00085   virtual void SetName (const char *iName);
00086 
00088   virtual const char *GetName () const;
00089 
00091   virtual uint GetID () const;
00092 
00094   virtual void SetObjectParent (iObject *);
00095 
00097   virtual iObject* GetObjectParent () const;
00098 
00100   virtual void ObjAdd (iObject *obj);
00101 
00103   virtual void ObjRemove (iObject *obj);
00104 
00106   virtual void ObjRemoveAll ();
00107 
00109   virtual void ObjAddChildren (iObject *Parent);
00110 
00120   virtual iObject* GetChild (int iInterfaceID, int iVersion,
00121     const char *Name = 0, bool FirstName = false) const;
00122 
00124   virtual iObject *GetChild (const char *Name) const;
00125 
00130   virtual csPtr<iObjectIterator> GetIterator ();
00131 
00132   virtual void AddNameChangeListener (
00133         iObjectNameChangeListener* listener);
00134   virtual void RemoveNameChangeListener (
00135         iObjectNameChangeListener* listener);
00136 
00137   virtual void ObjReleaseOld (iObject *obj);
00138 };
00139 
00140 #endif // __CS_CSOBJECT_H__

Generated for Crystal Space by doxygen 1.4.7