1 #ifndef COIN_SOJAVASCRIPTENGINE_H 2 #define COIN_SOJAVASCRIPTENGINE_H 36 #include <Inventor/misc/SoScriptEngine.h> 38 #include <Inventor/lists/SbList.h> 42 #define COIN_JAVASCRIPT_RUNTIME_MAXBYTES 4194304 46 typedef void SoJSfield2jsvalFunc(JSContext *,
const SoField *, jsval *);
47 typedef SbBool SoJSjsval2field2Func(JSContext *,
const jsval,
SoField *);
48 typedef JSObject * SoJSWrapperInitFunc(JSContext *, JSObject * obj);
58 virtual SbBool executeScript(
const SbName & name,
60 virtual SbBool executeFile(
const SbName & filename)
const;
61 virtual SbBool executeFunction(
const SbName &name,
int argc,
65 virtual SbBool setScriptField(
const SbName & name,
const SoField * f)
const;
66 virtual SbBool unsetScriptField(
const SbName & name)
const;
67 virtual SbBool getScriptField(
const SbName & name,
SoField * f)
const;
68 virtual SbBool hasScriptField(
const SbName & name)
const;
74 SbBool field2jsval(
const SoField * f, jsval * v)
const;
75 SbBool jsval2field(
const jsval v,
SoField * f)
const;
76 void enableAutoNodeUnref(SbBool onoff);
77 SbBool getAutoNodeUnrefState(
void)
const;
79 static SbBool init(uint32_t maxbytes = COIN_JAVASCRIPT_RUNTIME_MAXBYTES);
80 static void shutdown(
void);
81 static SbBool debug(
void);
83 static JSRuntime * getRuntime(
void);
84 JSContext * getContext(
void)
const;
85 JSObject * getGlobal(
void)
const;
87 void addHandler(
const SoType & type, SoJSWrapperInitFunc * init,
88 SoJSfield2jsvalFunc * field2jsval,
89 SoJSjsval2field2Func * jsval2field);
92 static void setRuntime(JSRuntime * runtime);
93 void setContext(JSContext * context);
94 void setGlobal(JSObject * global);
97 class SoJavaScriptEngineP * pimpl;
98 friend class SoJavaScriptEngineP;
101 #endif // !COIN_SOJAVASCRIPTENGINE_H The SoField class is the top-level abstract base class for fields.
Definition: SoField.h:47
Definition: SoScriptEngine.h:40
Definition: SoJavaScriptEngine.h:52
The SbString class is a string class with convenience functions for string operations.
Definition: SbString.h:52
The SoType class is the basis for the run-time type system in Coin.
Definition: SoType.h:59
The SbName class stores strings by reference.
Definition: SbName.h:40