ivaria/script.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 1999 by Brandon Ehle <azverkan@yahoo.com> 00003 (C) 2003-2007 by Mat Sutcliffe <oktal@gmx.co.uk> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_IVARIA_SCRIPT_H__ 00021 #define __CS_IVARIA_SCRIPT_H__ 00022 00027 #include "csutil/scf.h" 00028 #include "csutil/ref.h" 00029 #include "csutil/array.h" 00030 #include "csutil/refarr.h" 00031 #include "iutil/string.h" 00032 00033 struct iScript; 00034 struct iScriptObject; 00035 00054 struct iScriptValue : public virtual iBase 00055 { 00056 SCF_INTERFACE (iScriptValue, 2, 0, 0); 00057 00059 enum 00060 { 00061 tInt = 0x01, 00062 tFloat = 0x02, 00063 tDouble = 0x04, 00064 tString = 0x08, 00065 tBool = 0x10, 00066 tObject = 0x20 00067 }; 00068 00070 virtual iScript* GetScript () = 0; 00071 00073 virtual unsigned GetTypes () const = 0; 00074 00076 virtual int GetInt () const = 0; 00077 00079 virtual float GetFloat () const = 0; 00080 00082 virtual double GetDouble () const = 0; 00083 00085 virtual const csRef<iString> GetString () const = 0; 00086 00088 virtual bool GetBool () const = 0; 00089 00091 virtual csRef<iScriptObject> GetObject () const = 0; 00092 }; 00093 00102 struct iScriptObject : public virtual iBase 00103 { 00104 SCF_INTERFACE (iScriptObject, 3, 0, 0); 00105 00109 virtual iScript* GetScript () = 0; 00110 00117 virtual const csRef<iString> GetClass () const = 0; 00118 00126 virtual bool IsA (const char *) const = 0; 00127 00129 CS_DEPRECATED_METHOD_MSG("use IsA() instead") 00130 virtual bool IsType (const char *) const = 0; 00131 00141 virtual void* GetPointer () = 0; 00142 00149 CS_DEPRECATED_METHOD 00150 virtual bool SetPointer (void*) = 0; 00151 00162 virtual csPtr<iScriptValue> Call (const char *name, 00163 const csRefArray<iScriptValue> &args = csRefArray<iScriptValue> ()) = 0; 00164 00175 virtual bool Set (const char *name, iScriptValue *value) = 0; 00176 00186 virtual csPtr<iScriptValue> Get (const char *name) = 0; 00187 00189 //@@@ Lots more deprecated methods below 00190 00191 #define CS_DEPRECATED_METHOD_MSG_SET(NEW_METHOD) CS_DEPRECATED_METHOD_MSG \ 00192 ("use " NEW_METHOD "(const char*, iScriptValue*) instead") 00193 #define CS_DEPRECATED_METHOD_MSG_GET(NEW_METHOD) CS_DEPRECATED_METHOD_MSG \ 00194 ("use " NEW_METHOD "(const char*) instead") 00195 00196 CS_DEPRECATED_METHOD_MSG_SET("Set") 00197 virtual bool Set (const char *name, int data) = 0; 00198 CS_DEPRECATED_METHOD_MSG_SET("Set") 00199 virtual bool Set (const char *name, float data) = 0; 00200 CS_DEPRECATED_METHOD_MSG_SET("Set") 00201 virtual bool Set (const char *name, double data) = 0; 00202 CS_DEPRECATED_METHOD_MSG_SET("Set") 00203 virtual bool Set (const char *name, char const *data) = 0; 00204 CS_DEPRECATED_METHOD_MSG_SET("Set") 00205 virtual bool Set (const char *name, iScriptObject *data) = 0; 00206 CS_DEPRECATED_METHOD_MSG_SET("Set") 00207 virtual bool SetTruth (const char *name, bool isTrue) = 0; 00208 00209 CS_DEPRECATED_METHOD_MSG_GET("Get") 00210 virtual bool Get (const char *name, int &data) const = 0; 00211 CS_DEPRECATED_METHOD_MSG_GET("Get") 00212 virtual bool Get (const char *name, float &data) const = 0; 00213 CS_DEPRECATED_METHOD_MSG_GET("Get") 00214 virtual bool Get (const char *name, double &data) const = 0; 00215 CS_DEPRECATED_METHOD_MSG_GET("Get") 00216 virtual bool Get (const char *name, csRef<iString>&) const = 0; 00217 CS_DEPRECATED_METHOD_MSG_GET("Get") 00218 virtual bool Get (const char *name, csRef<iScriptObject>&) const = 0; 00219 CS_DEPRECATED_METHOD_MSG_GET("Get") 00220 virtual bool GetTruth (const char *name, bool &isTrue) const = 0; 00221 }; 00222 00228 struct iScript : public virtual iBase 00229 { 00230 SCF_INTERFACE (iScript, 3, 0, 0); 00231 00237 virtual bool RunText (const char *text) = 0; 00238 00244 virtual bool LoadModule (const char *name) = 0; 00245 00252 virtual bool LoadModule (const char *path, const char *filename) = 0; 00253 00260 virtual bool LoadModuleNative (const char *path, const char *filename) = 0; 00261 00272 virtual csPtr<iScriptValue> Call (const char *name, 00273 const csRefArray<iScriptValue> &args = csRefArray<iScriptValue> ()) = 0; 00274 00276 virtual csPtr<iScriptValue> RValue (int value) = 0; 00277 00279 virtual csPtr<iScriptValue> RValue (float value) = 0; 00280 00282 virtual csPtr<iScriptValue> RValue (double value) = 0; 00283 00285 virtual csPtr<iScriptValue> RValue (const char *value) = 0; 00286 00288 virtual csPtr<iScriptValue> RValue (bool value) = 0; 00289 00291 virtual csPtr<iScriptValue> RValue (iScriptObject *value) = 0; 00292 00301 virtual csPtr<iScriptObject> New (const char *type, 00302 const csRefArray<iScriptValue> &args = csRefArray<iScriptValue> ()) = 0; 00303 00313 virtual bool Store (const char *name, iScriptValue *value) = 0; 00314 00322 virtual csPtr<iScriptValue> Retrieve (const char *name) = 0; 00323 00331 virtual bool Remove (const char *name) = 0; 00332 00334 //@@@ Lots more deprecated methods below. 00335 00336 CS_DEPRECATED_METHOD_MSG_SET("Store") 00337 virtual bool Store (const char *name, int data) = 0; 00338 CS_DEPRECATED_METHOD_MSG_SET("Store") 00339 virtual bool Store (const char *name, float data) = 0; 00340 CS_DEPRECATED_METHOD_MSG_SET("Store") 00341 virtual bool Store (const char *name, double data) = 0; 00342 CS_DEPRECATED_METHOD_MSG_SET("Store") 00343 virtual bool Store (const char *name, char const *data) = 0; 00344 CS_DEPRECATED_METHOD_MSG_SET("Store") 00345 virtual bool Store (const char *name, iScriptObject *data) = 0; 00346 CS_DEPRECATED_METHOD_MSG_SET("Store") 00347 virtual bool SetTruth (const char *name, bool isTrue) = 0; 00348 00349 CS_DEPRECATED_METHOD_MSG_GET("Retrieve") 00350 virtual bool Retrieve (const char *name, int &data) const = 0; 00351 CS_DEPRECATED_METHOD_MSG_GET("Retrieve") 00352 virtual bool Retrieve (const char *name, float &data) const = 0; 00353 CS_DEPRECATED_METHOD_MSG_GET("Retrieve") 00354 virtual bool Retrieve (const char *name, double &data) const = 0; 00355 CS_DEPRECATED_METHOD_MSG_GET("Retrieve") 00356 virtual bool Retrieve (const char *name, csRef<iString>&) const = 0; 00357 CS_DEPRECATED_METHOD_MSG_GET("Retrieve") 00358 virtual bool Retrieve (const char *name, csRef<iScriptObject>&) const = 0; 00359 CS_DEPRECATED_METHOD_MSG_GET("Retrieve") 00360 virtual bool GetTruth (const char *name, bool &isTrue) const = 0; 00361 00362 #undef CS_DEPRECATED_METHOD_MSG_CALL 00363 #undef CS_DEPRECATED_METHOD_MSG_SET 00364 #undef CS_DEPRECATED_METHOD_MSG_GET 00365 }; 00366 00367 #endif // __CS_IVARIA_SCRIPT_H__
Generated for Crystal Space 2.1 by doxygen 1.6.1
