CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

csobject.h

00001 /*
00002     Copyright (C) 1998-2001 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_CSOBJECT_H__
00021 #define __CS_CSOBJECT_H__
00022 
00023 #include "csextern.h"
00024 
00025 #include "csutil/leakguard.h"
00026 #include "csutil/refarr.h"
00027 #include "csutil/scf.h"
00028 
00029 #include "iutil/object.h"
00030 
00031 typedef csRefArray<iObject> csObjectContainer;
00032 
00038 class CS_CRYSTALSPACE_EXPORT csObject : public iObject
00039 {
00040 protected:
00041   friend class csObjectIterator;
00043   uint csid;
00044 
00046   csObjectContainer *Children;
00047 
00049   char *Name;
00050 
00052   iObject *ParentObject;
00053 
00055   csRefArray<iObjectNameChangeListener> listeners;
00056 
00058   void InitializeObject ();
00059 
00061   void FireNameChangeListeners (const char* oldname, const char* newname);
00062 
00063 public:
00064   CS_LEAKGUARD_DECLARE (csObject);
00065 
00067   csObject (iBase* pParent = 0);
00068 
00074   csObject (csObject &o);
00075 
00077   virtual ~csObject ();
00078 
00080   virtual void SetName (const char *iName);
00081 
00083   virtual const char *GetName () const;
00084 
00086   virtual uint GetID () const;
00087 
00089   virtual void SetObjectParent (iObject *);
00090 
00092   virtual iObject* GetObjectParent () const;
00093 
00095   virtual void ObjAdd (iObject *obj);
00096 
00098   virtual void ObjRemove (iObject *obj);
00099 
00101   virtual void ObjRemoveAll ();
00102 
00104   virtual void ObjAddChildren (iObject *Parent);
00105 
00115   virtual iObject* GetChild (int iInterfaceID, int iVersion,
00116     const char *Name = 0, bool FirstName = false) const;
00117 
00119   virtual iObject *GetChild (const char *Name) const;
00120 
00125   virtual csPtr<iObjectIterator> GetIterator ();
00126 
00127   virtual void AddNameChangeListener (
00128         iObjectNameChangeListener* listener);
00129   virtual void RemoveNameChangeListener (
00130         iObjectNameChangeListener* listener);
00131 
00132   SCF_DECLARE_IBASE;
00133 
00134   virtual void ObjReleaseOld (iObject *obj);
00135 };
00136 
00137 #endif // __CS_CSOBJECT_H__

Generated for Crystal Space by doxygen 1.4.4