/usr/include/crystalspace-2.0/iengine/sharevar.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /*
Copyright (C) 2002 by Keith Fulton
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_IENGINE_SHAREVAR_H__
#define __CS_IENGINE_SHAREVAR_H__
/**\file
* Shared variables
*/
/**
* \addtogroup engine3d
* @{ */
#include "csutil/scf.h"
struct iObject;
struct iSharedVariableListener;
class csColor;
class csVector3;
/**
* This class implements a refcounted value which can
* be shared across many objects and updated efficiently.
*
* Main creators of instances implementing this interface:
* - iSharedVariableList::New()
*
* Main ways to get pointers to this interface:
* - iEngine::GetVariableList()
* - iSharedVariableList::Get()
*/
struct iSharedVariable : public virtual iBase
{
SCF_INTERFACE(iSharedVariable, 3,0,0);
/// Get the private object interface
virtual iObject* QueryObject () = 0;
/// iSharedVariables are referenced by name. Here is where you set it.
virtual void SetName (const char *name) = 0;
/// Get the name of this variable.
virtual const char *GetName () const = 0;
/// Set the variable to a floating pt value.
virtual void Set(float val) = 0;
/// Get the floating point version of the var value.
virtual float Get () const = 0;
/// Set the variable to store a csColor.
virtual void SetColor (const csColor& col) = 0;
/// Get the csColor from the variable.
virtual const csColor& GetColor () const = 0;
/// Set the variable to store a csVector3.
virtual void SetVector (const csVector3& v) = 0;
/// Get the vector from the variable.
virtual const csVector3& GetVector () const = 0;
/// Set the string from the variable.
virtual void SetString (const char* str) = 0;
/// Get the string from the variable.
virtual const char* GetString () const = 0;
/// Possible types stored by this class.
enum SharedVariableType
{
SV_UNKNOWN = 0, /*!< Undefined variable type. */
SV_FLOAT = 1, /*!< 'float' variable type. */
SV_COLOR = 2, /*!< csColor variable type. */
SV_VECTOR = 3, /*!< csVector3 variable type. */
SV_STRING = 4 /*!< 'const char*' variable type. */
};
/// Get the type currently stored by this variable.
virtual int GetType () const = 0;
/// Add a listener to variables.
virtual void AddListener (iSharedVariableListener* listener) = 0;
/// Remove a listener.
virtual void RemoveListener (iSharedVariableListener* listener) = 0;
};
/**
* A listener so that you can get notified when a variable is
* changed.
*
* This callback is used by:
* - iSharedVariable
*/
struct iSharedVariableListener : public virtual iBase
{
SCF_INTERFACE(iSharedVariableListener,2,0,0);
/**
* A variable has changed.
*/
virtual void VariableChanged (iSharedVariable* var) = 0;
};
/**
* A list of shared variables.
*
* Main ways to get pointers to this interface:
* - iEngine::GetVariableList()
*/
struct iSharedVariableList : public virtual iBase
{
SCF_INTERFACE(iSharedVariableList, 2,0,0);
/// Return the number of Shared Variables in this list.
virtual int GetCount () const = 0;
/// Return a SharedVariable by index.
virtual iSharedVariable *Get (int n) const = 0;
/// Add a SharedVariable.
virtual int Add (iSharedVariable *obj) = 0;
/// Remove a SharedVariable.
virtual bool Remove (iSharedVariable *obj) = 0;
/// Remove the nth SharedVariable.
virtual bool Remove (int n) = 0;
/// Remove all SharedVariables.
virtual void RemoveAll () = 0;
/// Find a SharedVariable and return its index.
virtual int Find (iSharedVariable *obj) const = 0;
/// Find a SharedVariable by name.
virtual iSharedVariable *FindByName (const char *Name) const = 0;
/// iSharedVariable Factory method. This does not add the new var to the list.
virtual csPtr<iSharedVariable> New() = 0;
};
/** @} */
#endif // __CS_IENGINE_SHAREVAR_H__
|