Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

cscoll.h

00001 /*
00002     Copyright (C) 1998-2001 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_CSCOLL_H__
00020 #define __CS_CSCOLL_H__
00021 
00022 #include "csgeom/matrix3.h"
00023 #include "csutil/csobject.h"
00024 #include "csutil/csvector.h"
00025 #include "iengine/collectn.h"
00026 
00027 class csSector;
00028 class csEngine;
00029 
00030 SCF_VERSION (csCollection, 0, 0, 1);
00031 
00036 class csCollection : public csObject
00037 {
00038 private:
00040   csVector objects;
00041 
00043   csEngine* engine;
00044 
00045 private:
00047   virtual ~csCollection ();
00048 
00049 public:
00053   csCollection (csEngine* engine);
00054 
00058   iObject* FindObject (char* name);
00059 
00063   int GetObjectCount () const { return objects.Length(); }
00064 
00066   void AddObject (iObject* obj) { objects.Push((csSome)obj); }
00067 
00069   iObject* operator[] (int i) { return (iObject*) (objects[i]); }
00070 
00071   SCF_DECLARE_IBASE;
00072 
00073   //------------------------- iCollection interface --------------------------
00074   struct Collection : public iCollection
00075   {
00076     SCF_DECLARE_EMBEDDED_IBASE (csCollection);
00077     virtual iObject *QueryObject()
00078       { return scfParent; }
00079     virtual iObject* FindObject (char* name) const
00080       { return scfParent->FindObject(name); }
00081     virtual int GetObjectCount () const
00082       { return scfParent->GetObjectCount(); }
00083     virtual void AddObject (iObject* obj)
00084       { scfParent->AddObject(obj); }
00085     virtual iObject* operator[] (int i) const
00086       { return (*scfParent)[i]; }
00087     virtual iObject* GetObject (int i) const
00088       { return (*scfParent)[i]; }
00089   } scfiCollection;
00090   friend struct Collection;
00091 };
00092 
00093 #endif // __CS_CSCOLL_H__

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000