Neo  0.5.0
Developer Documentation
ScriptContext.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 
25 
26 #ifndef __SCRIPT_CONTEXT_H
27 #define __SCRIPT_CONTEXT_H
28 
29 namespace Neo
30 {
32 class NEO_CORE_EXPORT ScriptContext
33 {
34 protected:
36 public :
37 
39  virtual ~ScriptContext(void){}
40 
41  virtual void init() = 0;
42 
45  virtual bool runScript(const char * filename) = 0;
46 
50  virtual bool startCallFunction(const char * name) = 0;
51 
54  virtual bool endCallFunction(int numArgs = 0) = 0;
55 
58  virtual void callFunction(const char * name) = 0;
59 
63  virtual void addFunction(const char * name, int (*function)(void)) = 0;
64 
65  virtual bool runString(const char* str) = 0;
66 
67  // variables
68  virtual unsigned int getArgsNumber(void) = 0;
69 
70  virtual void getIntArray(unsigned int arg, int * values, unsigned int valuesNumber) = 0;
71  virtual void getFloatArray(unsigned int arg, float * values, unsigned int valuesNumber) = 0;
72  virtual const char * getString(unsigned int arg) = 0;
73  virtual int getInteger(unsigned int arg) = 0;
74  virtual float getFloat(unsigned int arg) = 0;
75  virtual void * getPointer(unsigned int arg) = 0;
76  virtual bool getBoolean(unsigned int arg) = 0;
77 
78  virtual void pushIntArray(const int * values, unsigned int valuesNumber) = 0;
79  virtual void pushFloatArray(const float * values, unsigned int valuesNumber) = 0;
80  virtual void pushString(const char * string) = 0;
81  virtual void pushBoolean(bool value) = 0;
82  virtual void pushInteger(int value) = 0;
83  virtual void pushFloat(float value) = 0;
84  virtual void pushPointer(void * value) = 0;
85 
86  // Type checking
87  virtual bool isNumber(unsigned int arg) = 0;
88  virtual bool isFunctionOk(const char* name, unsigned int args) = 0;
89 
90  bool isRunning() { return m_isRunning; }
91 };
92 }
93 #endif
bool isRunning()
Definition: ScriptContext.h:90
bool m_isRunning
Definition: ScriptContext.h:35
virtual ~ScriptContext(void)
Destructor.
Definition: ScriptContext.h:39
Definition: Color.h:29
Class used to manage script functions virtually.
Definition: ScriptContext.h:32