Crystal Space: iengine/sharevar.h Source File (Crystal Space Public API Reference)

| ## Public API Reference

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

- File List
- File Members

# iengine/sharevar.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2002 by Keith Fulton
    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_IENGINE_SHAREVAR_H__
    00020 #define __CS_IENGINE_SHAREVAR_H__
    00021
    00029 #include "csutil/scf.h"
    00030
    00031
    00032 struct iObject;
    00033 struct iSharedVariableListener;
    00034
    00035 class csColor;
    00036 class csVector3;
    00037
    00038
    00050 struct iSharedVariable : public virtual iBase
    00051 {
    00052   SCF_INTERFACE(iSharedVariable, 3,0,0);
    00054   virtual iObject* QueryObject () = 0;
    00055
    00057   virtual void SetName (const char *name) = 0;
    00058
    00060   virtual const char *GetName () const = 0;
    00061
    00063   virtual void Set(float val) = 0;
    00064
    00066   virtual float Get () const = 0;
    00067
    00069   virtual void SetColor (const csColor& col) = 0;
    00070
    00072   virtual const csColor& GetColor () const = 0;
    00073
    00075   virtual void SetVector (const csVector3& v) = 0;
    00076
    00078   virtual const csVector3& GetVector () const = 0;
    00079
    00081   virtual void SetString (const char* str) = 0;
    00082
    00084   virtual const char* GetString () const = 0;
    00085
    00087   enum SharedVariableType
    00088   {
    00089     SV_UNKNOWN = 0,
    00090     SV_FLOAT   = 1,
    00091     SV_COLOR   = 2,
    00092     SV_VECTOR  = 3,
    00093     SV_STRING  = 4
    00094   };
    00095
    00097   virtual int GetType () const = 0;
    00098
    00100   virtual void AddListener (iSharedVariableListener* listener) = 0;
    00101
    00103   virtual void RemoveListener (iSharedVariableListener* listener) = 0;
    00104 };
    00105
    00106
    00114 struct iSharedVariableListener : public virtual iBase
    00115 {
    00116   SCF_INTERFACE(iSharedVariableListener,2,0,0);
    00120   virtual void VariableChanged (iSharedVariable* var) = 0;
    00121 };
    00122
    00123
    00130 struct iSharedVariableList : public virtual iBase
    00131 {
    00132   SCF_INTERFACE(iSharedVariableList, 2,0,0);
    00134   virtual int GetCount () const = 0;
    00135
    00137   virtual iSharedVariable *Get (int n) const = 0;
    00138
    00140   virtual int Add (iSharedVariable *obj) = 0;
    00141
    00143   virtual bool Remove (iSharedVariable *obj) = 0;
    00144
    00146   virtual bool Remove (int n) = 0;
    00147
    00149   virtual void RemoveAll () = 0;
    00150
    00152   virtual int Find (iSharedVariable *obj) const = 0;
    00153
    00155   virtual iSharedVariable *FindByName (const char *Name) const = 0;
    00156
    00158   virtual csPtr<iSharedVariable> New() = 0;
    00159 };
    00160
    00163 #endif // __CS_IENGINE_SHAREVAR_H__