## Public API Reference

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

- File List
- File Members

# iutil/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
    00027 #include "csutil/scf_interface.h"
    00028 #include "csutil/ref.h"
    00029
    00030 struct iObjectIterator;
    00031 struct iObject;
    00032
    00038 #define CS_GET_CHILD_OBJECT(object,Interface)                        \
    00039   scfQueryInterfaceSafe<Interface>((object)->GetChild(               \
    00040     scfInterfaceTraits<Interface>::GetID(),                          \
    00041     scfInterfaceTraits<Interface>::GetVersion()))
    00042
    00047 #define CS_GET_NAMED_CHILD_OBJECT(object,Interface,name)             \
    00048   scfQueryInterfaceSafe<Interface>((object)->GetChild(               \
    00049     scfInterfaceTraits<Interface>::GetID(),                          \
    00050     scfInterfaceTraits<Interface>::GetVersion(),                     \
    00051     name))
    00052
    00057 #define CS_GET_FIRST_NAMED_CHILD_OBJECT(object,Interface,name)       \
    00058   scfQueryInterfaceSafe<Interface>((object)->GetChild(               \
    00059     scfInterfaceTraits<Interface>::GetID(),                          \
    00060     scfInterfaceTraits<Interface>::GetVersion(),                     \
    00061     name, true))
    00062
    00067 struct iObjectNameChangeListener : public virtual iBase
    00068 {
    00069   SCF_INTERFACE (iObjectNameChangeListener, 0, 0, 1);
    00070
    00072   virtual void NameChanged (iObject* obj, const char* oldname,
    00073         const char* newname) = 0;
    00074 };
    00075
    00076
    00092 struct iObject : public virtual iBase
    00093 {
    00094   SCF_INTERFACE(iObject,2,0,1);
    00095
    00097   virtual void SetName (const char *iName) = 0;
    00098
    00100   virtual const char *GetName () const = 0;
    00101
    00103   virtual uint GetID () const = 0;
    00104
    00109   virtual void SetObjectParent (iObject *obj) = 0;
    00110
    00112   virtual iObject* GetObjectParent () const = 0;
    00113
    00115   virtual void ObjAdd (iObject *obj) = 0;
    00116
    00118   virtual void ObjRemove (iObject *obj) = 0;
    00119
    00121   virtual void ObjRemoveAll () = 0;
    00122
    00124   virtual void ObjAddChildren (iObject *Parent) = 0;
    00125
    00135   virtual iObject* GetChild (int iInterfaceID, int iVersion,
    00136     const char *Name = 0, bool FirstName = false) const = 0;
    00137
    00139   virtual iObject* GetChild (const char *Name) const = 0;
    00140
    00145   virtual csPtr<iObjectIterator> GetIterator () = 0;
    00146
    00147   // @@@ temporary fix
    00148   virtual void ObjReleaseOld (iObject *obj) = 0;
    00149
    00153   virtual void AddNameChangeListener (
    00154         iObjectNameChangeListener* listener) = 0;
    00155
    00159   virtual void RemoveNameChangeListener (
    00160         iObjectNameChangeListener* listener) = 0;
    00161 };
    00162
    00163
    00174 struct iObjectIterator : public virtual iBase
    00175 {
    00176   SCF_INTERFACE(iObjectIterator,2,0,0);
    00178   virtual iObject* Next () = 0;
    00179
    00181   virtual void Reset () = 0;
    00182
    00184   virtual iObject* GetParentObj () const = 0;
    00185
    00187   virtual bool HasNext () const = 0;
    00188
    00195   virtual iObject* FindName (const char* name) = 0;
    00196 };
    00197
    00200 #endif // __CS_IOBJECT_OBJECT_H__