nScriptServer Class Reference
[Scripting Support]
#include <nscriptserver.h>
Inheritance diagram for nScriptServer:

Detailed Description
The script server object is the communication point between a nRoot object's Dispatch() method and a specific scripting language. More specifically, the script server's main task is to translate nCmd objects into script statements and back, and to communicate with receiver nRoot objects by sending nCmd objects to them (which is done by invoking Dispatch() on the receiver with the nCmd object as the argument).Script servers are also used as filter for the object serialization. An object serializes itself by emitting nCmd objects to the file server. The file server will talk to a script server to translate those nCmd objects to actual script statements, which are then written to the output stream. This stream must then simply be fed into a script server to reconstruct the serialized object, no special loader code is needed.
(C) 2002 RadonLabs GmbH
Definition at line 31 of file nscriptserver.h.
Public Types | |
| enum | SelectMethod { SELCOMMAND, NOSELCOMMAND } |
Public Member Functions | |
| nScriptServer () | |
| constructor | |
| virtual | ~nScriptServer () |
| destructor | |
| virtual bool | Run (const char *cmdStr, nString &result) |
| evaluate a script command | |
| virtual bool | RunFunction (const char *functionName, nString &result) |
| invoke a script function by name, with no parameters | |
| virtual bool | RunScript (const char *filename, nString &result) |
| evaluate a script file | |
| virtual nFile * | BeginWrite (const char *filename, nObject *obj) |
| write header of a persistent object file | |
| virtual bool | WriteBeginNewObject (nFile *fp, nRoot *o, nRoot *owner) |
| write object header with default constructor | |
| virtual bool | WriteBeginNewObjectCmd (nFile *fp, nRoot *o, nRoot *owner, nCmd *cmd) |
| write object header with constructor cmd | |
| virtual bool | WriteBeginSelObject (nFile *fp, nRoot *o, nRoot *owner) |
| write object header without constructor (select only) | |
| virtual bool | WriteCmd (nFile *, nCmd *) |
| translate and write a cmd message | |
| virtual bool | WriteEndObject (nFile *fp, nRoot *o, nRoot *owner) |
| write object footer | |
| virtual bool | EndWrite (nFile *) |
| finish a persistent object file | |
| void | SetFailOnError (bool b) |
| abort program on error? | |
| bool | GetFailOnError () const |
| get abort program status | |
| void | SetSelectMethod (SelectMethod sm) |
| set the select method when writing persistent objects | |
| SelectMethod | GetSelectMethod () const |
| get current select method | |
| void | SetQuitRequested (bool b) |
| set the quit requested flag | |
| bool | GetQuitRequested () const |
| get the quit requested flag | |
| virtual bool | Trigger () |
| trigger server (should be called frequently) | |
| virtual nString | Prompt () |
| generate a prompt string for interactive mode | |
Static Public Member Functions | |
| static void | SetCurrentTargetObject (nObject *obj) |
| set an unnamed object that will receive cmds instead of the cwd | |
| static nObject * | GetCurrentTargetObject () |
| get the currently set unnamed object | |
Static Protected Attributes | |
| static nObject * | currentTargetObject = 0 |
| when set the script server will dispatch cmds to this object instead of the cwd | |
Member Enumeration Documentation
|
|
Definition at line 35 of file nscriptserver.h. |
Constructor & Destructor Documentation
|
|
constructor
Definition at line 15 of file nscriptserver_main.cc. |
|
|
destructor
Definition at line 26 of file nscriptserver_main.cc. |
Member Function Documentation
|
||||||||||||
|
evaluate a script command Run a script statement.
Reimplemented in nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 40 of file nscriptserver_main.cc. |
|
||||||||||||
|
invoke a script function by name, with no parameters Run a script function with the specified name without any args
Reimplemented in nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 55 of file nscriptserver_main.cc. |
|
||||||||||||
|
evaluate a script file Run a script file.
Reimplemented in nBinScriptServer, nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 70 of file nscriptserver_main.cc. |
|
|
set an unnamed object that will receive cmds instead of the cwd
Definition at line 165 of file nscriptserver.h. |
|
|
get the currently set unnamed object
Definition at line 175 of file nscriptserver.h. |
|
||||||||||||
|
write header of a persistent object file
Reimplemented in nBinScriptServer, nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 92 of file nscriptserver_main.cc. |
|
||||||||||||||||
|
write object header with default constructor
Reimplemented in nBinScriptServer, nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 102 of file nscriptserver_main.cc. |
|
||||||||||||||||||||
|
write object header with constructor cmd
Reimplemented in nBinScriptServer, nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 112 of file nscriptserver_main.cc. |
|
||||||||||||||||
|
write object header without constructor (select only)
Reimplemented in nBinScriptServer, nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 122 of file nscriptserver_main.cc. |
|
||||||||||||
|
translate and write a cmd message
Reimplemented in nBinScriptServer, nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 132 of file nscriptserver_main.cc. |
|
||||||||||||||||
|
write object footer
Reimplemented in nBinScriptServer, nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 142 of file nscriptserver_main.cc. |
|
|
finish a persistent object file
Reimplemented in nBinScriptServer, nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 152 of file nscriptserver_main.cc. |
|
|
abort program on error?
Definition at line 125 of file nscriptserver.h. |
|
|
get abort program status
Definition at line 135 of file nscriptserver.h. |
|
|
set the select method when writing persistent objects
|
|
|
get current select method
Definition at line 155 of file nscriptserver.h. |
|
|
set the quit requested flag
Definition at line 105 of file nscriptserver.h. |
|
|
get the quit requested flag
Definition at line 115 of file nscriptserver.h. |
|
|
trigger server (should be called frequently) This method should be called frequently (normally once per frame) when the script server is not run in interactive mode.
Reimplemented in nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 168 of file nscriptserver_main.cc. |
|
|
generate a prompt string for interactive mode
Reimplemented in nTclServer, nLuaServer, nPythonServer, and nRubyServer. Definition at line 81 of file nscriptserver_main.cc. |
Member Data Documentation
|
|
when set the script server will dispatch cmds to this object instead of the cwd
Definition at line 10 of file nscriptserver_main.cc. |
The documentation for this class was generated from the following files: