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

object.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2000 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_IOBJECT_OBJECT_H__
00020 #define __CS_IOBJECT_OBJECT_H__
00021 
00026 #include "csutil/scf_interface.h"
00027 #include "csutil/ref.h"
00028 
00029 struct iObjectIterator;
00030 struct iObject;
00031 
00037 #define CS_GET_CHILD_OBJECT(object,Interface)                        \
00038   scfQueryInterfaceSafe<Interface>((object)->GetChild(               \
00039     scfInterfaceTraits<Interface>::GetID(),                          \
00040     scfInterfaceTraits<Interface>::GetVersion()))
00041 
00046 #define CS_GET_NAMED_CHILD_OBJECT(object,Interface,name)             \
00047   scfQueryInterfaceSafe<Interface>((object)->GetChild(               \
00048     scfInterfaceTraits<Interface>::GetID(),                          \
00049     scfInterfaceTraits<Interface>::GetVersion(),                     \
00050     name))
00051 
00056 #define CS_GET_FIRST_NAMED_CHILD_OBJECT(object,Interface,name)       \
00057   scfQueryInterfaceSafe<Interface>((object)->GetChild(               \
00058     scfInterfaceTraits<Interface>::GetID(),                          \
00059     scfInterfaceTraits<Interface>::GetVersion(),                     \
00060     name, true))
00061 
00066 struct iObjectNameChangeListener : public virtual iBase
00067 {
00068   SCF_INTERFACE (iObjectNameChangeListener, 0, 0, 1);
00069 
00071   virtual void NameChanged (iObject* obj, const char* oldname,
00072         const char* newname) = 0;
00073 };
00074 
00075 
00094 struct iObject : public virtual iBase
00095 {
00096   SCF_INTERFACE(iObject,2,0,1);
00098   virtual void SetName (const char *iName) = 0;
00099 
00101   virtual const char *GetName () const = 0;
00102 
00104   virtual uint GetID () const = 0;
00105 
00110   virtual void SetObjectParent (iObject *obj) = 0;
00111 
00113   virtual iObject* GetObjectParent () const = 0;
00114 
00116   virtual void ObjAdd (iObject *obj) = 0;
00117 
00119   virtual void ObjRemove (iObject *obj) = 0;
00120 
00122   virtual void ObjRemoveAll () = 0;
00123 
00125   virtual void ObjAddChildren (iObject *Parent) = 0;
00126 
00136   virtual iObject* GetChild (int iInterfaceID, int iVersion,
00137     const char *Name = 0, bool FirstName = false) const = 0;
00138 
00140   virtual iObject* GetChild (const char *Name) const = 0;
00141 
00146   virtual csPtr<iObjectIterator> GetIterator () = 0;
00147 
00148   // @@@ temporary fix
00149   virtual void ObjReleaseOld (iObject *obj) = 0;
00150 
00154   virtual void AddNameChangeListener (
00155         iObjectNameChangeListener* listener) = 0;
00156 
00160   virtual void RemoveNameChangeListener (
00161         iObjectNameChangeListener* listener) = 0;
00162 };
00163 
00164 
00165 SCF_VERSION (iObjectIterator, 0, 1, 0);
00166 
00179 struct iObjectIterator : public iBase
00180 {
00182   virtual iObject* Next () = 0;
00183 
00185   virtual void Reset () = 0;
00186 
00188   virtual iObject* GetParentObj () const = 0;
00189 
00191   virtual bool HasNext () const = 0;
00192 
00199   virtual iObject* FindName (const char* name) = 0;
00200 };
00201 
00204 #endif // __CS_IOBJECT_OBJECT_H__

Generated for Crystal Space by doxygen 1.4.4