csutil/csobject.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 <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
    00027 #include "csextern.h"
    00028
    00029 #include "csutil/leakguard.h"
    00030 #include "csutil/refarr.h"
    00031 #include "csutil/refcount.h"
    00032 #include "csutil/scf_implementation.h"
    00033
    00034 #include "iutil/object.h"
    00035
    00036 typedef csRefArray<iObject> csObjectContainer;
    00037
    00038 #include "csutil/deprecated_warn_off.h"
    00039
    00045 class CS_CRYSTALSPACE_EXPORT csObject :
    00046   public scfImplementation1<csObject, iObject>,
    00047   public CS::Utility::InternalRefCount
    00048 {
    00049 protected:
    00050   friend class csObjectIterator;
    00052   uint csid;
    00053
    00055   csObjectContainer *Children;
    00056
    00058   char *Name;
    00059
    00061   iObject *ParentObject;
    00062
    00064   csRefArray<iObjectNameChangeListener> listeners;
    00065
    00067   void InitializeObject ();
    00068
    00070   void FireNameChangeListeners (const char* oldname, const char* newname);
    00071
    00072 public:
    00073   CS_LEAKGUARD_DECLARE (csObject);
    00074
    00076   csObject (iBase* pParent = 0);
    00077
    00083   csObject (csObject &o);
    00084
    00086   virtual ~csObject ();
    00087
    00089   virtual void SetName (const char *iName);
    00090
    00092   virtual const char *GetName () const;
    00093
    00095   virtual uint GetID () const;
    00096
    00098   virtual void SetObjectParent (iObject *);
    00099
    00101   virtual iObject* GetObjectParent () const;
    00102
    00104   virtual void ObjAdd (iObject *obj);
    00105
    00107   virtual void ObjRemove (iObject *obj);
    00108
    00110   virtual void ObjRemoveAll ();
    00111
    00113   virtual void ObjAddChildren (iObject *Parent);
    00114
    00124   virtual iObject* GetChild (int iInterfaceID, int iVersion,
    00125     const char *Name, bool FirstName) const;
    00126
    00128   virtual iObject *GetChild (const char *Name) const;
    00129
    00134   virtual csPtr<iObjectIterator> GetIterator ();
    00135
    00136   virtual void AddNameChangeListener (
    00137         iObjectNameChangeListener* listener);
    00138   virtual void RemoveNameChangeListener (
    00139         iObjectNameChangeListener* listener);
    00140
    00141
    00142   virtual void ObjReleaseOld (iObject *obj);
    00143   virtual iObject* GetChild (int iInterfaceID, int iVersion,
    00144     const char *Name = 0) const;
    00145 };
    00146
    00147 #include "csutil/deprecated_warn_on.h"
    00148
    00149 #endif // __CS_CSOBJECT_H__