csplugincommon/script/scriptcommon.h
00001 /* 00002 Copyright (C) 2007 by Mat Sutcliffe <oktal@gmx.co.uk> 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_PLUGINCOMMON_SCRIPT_SCRIPTCOMMON_H__ 00020 #define __CS_PLUGINCOMMON_SCRIPT_SCRIPTCOMMON_H__ 00021 00022 #include "csutil/scf_implementation.h" 00023 #include "csutil/array.h" 00024 #include "csutil/ref.h" 00025 #include "csutil/refarr.h" 00026 #include "csutil/weakref.h" 00027 #include "ivaria/script.h" 00028 00029 #include "csutil/deprecated_warn_off.h" 00030 00038 class CS_CRYSTALSPACE_EXPORT csScriptObjectCommon : 00039 public scfImplementation1<csScriptObjectCommon, iScriptObject> 00040 { 00041 void CallCommon (const char *name, csRef<iScriptValue> &retval, 00042 va_list var_args, const char *format); 00043 00044 protected: 00045 csScriptObjectCommon() : scfImplementationType (this) {} 00046 csScriptObjectCommon(iBase *parent) : scfImplementationType (this, parent) {} 00047 00048 public: 00049 virtual ~csScriptObjectCommon() {} 00050 00051 virtual bool IsType (const char *t) const { return IsA (t); } 00052 00053 virtual bool SetPointer (void*) { return false; } 00054 00055 virtual bool Set (const char *name, int data); 00056 virtual bool Set (const char *name, float data); 00057 virtual bool Set (const char *name, double data); 00058 virtual bool Set (const char *name, char const *data); 00059 virtual bool Set (const char *name, iScriptObject *data); 00060 virtual bool SetTruth (const char *name, bool isTrue); 00061 00062 virtual bool Get (const char *name, int &data) const; 00063 virtual bool Get (const char *name, float &data) const; 00064 virtual bool Get (const char *name, double &data) const; 00065 virtual bool Get (const char *name, csRef<iString>&) const; 00066 virtual bool Get (const char *name, csRef<iScriptObject>&) const; 00067 virtual bool GetTruth (const char *name, bool &isTrue) const; 00068 00069 virtual csPtr<iScriptValue> Call (const char*, 00070 const csRefArray<iScriptValue>& = csRefArray<iScriptValue> ()) = 0; 00071 virtual bool Set (const char *name, iScriptValue*) = 0; 00072 virtual csPtr<iScriptValue> Get (const char*) = 0; 00073 }; 00074 00082 class CS_CRYSTALSPACE_EXPORT csScriptCommon : 00083 public scfImplementation1<csScriptCommon, iScript> 00084 { 00085 void CallCommon (const char *name, csRef<iScriptValue> &retval, 00086 va_list var_args, const char *format); 00087 00088 protected: 00089 csScriptCommon() : scfImplementationType (this) {} 00090 csScriptCommon(iBase *parent) : scfImplementationType (this, parent) {} 00091 00092 public: 00093 virtual ~csScriptCommon() {} 00094 00095 virtual bool Store (const char *name, int data); 00096 virtual bool Store (const char *name, float data); 00097 virtual bool Store (const char *name, double data); 00098 virtual bool Store (const char *name, char const *data); 00099 virtual bool Store (const char *name, iScriptObject *data); 00100 virtual bool SetTruth (const char *name, bool isTrue); 00101 00102 virtual bool Retrieve (const char *name, int &data) const; 00103 virtual bool Retrieve (const char *name, float &data) const; 00104 virtual bool Retrieve (const char *name, double &data) const; 00105 virtual bool Retrieve (const char *name, csRef<iString>&) const; 00106 virtual bool Retrieve (const char *name, csRef<iScriptObject>&) const; 00107 virtual bool GetTruth (const char *name, bool &isTrue) const; 00108 00109 virtual csPtr<iScriptValue> Call (const char*, 00110 const csRefArray<iScriptValue>& = csRefArray<iScriptValue> ()) = 0; 00111 virtual bool Store (const char *name, iScriptValue*) = 0; 00112 virtual csPtr<iScriptValue> Retrieve (const char*) = 0; 00113 }; 00114 00115 #include "csutil/deprecated_warn_on.h" 00116 00117 #endif // __CS_PLUGINCOMMON_SCRIPT_SCRIPTCOMMON_H__
Generated for Crystal Space 2.1 by doxygen 1.6.1
