JsUnit 1.3
Project Developer Home doxygen

JsUtil Class Reference

Collaboration diagram for JsUtil:

Collaboration graph
[legend]
List of all members.

Detailed Description

Helper class with static flags.


Public Member Functions

void JsUtil ()
String include (String fname)
 Includes a JavaScript file.
Function getCaller (Function fn)
 Retrieve the caller of a function.
SystemWriter getSystemWriter ()
 Returns the SystemWriter.
void quit (Number ret)
 Quits the JavaScript engine.

Static Public Attributes

static Boolean isObtree
 Flag for Obtree C4.
static Boolean isWSH
 Flag for Microsoft Windows Scripting Host.
static Boolean isBrowser
 Flag for a browser.
static Boolean isNSServer
 Flag for Netscape Enterprise Server (iPlanet) engine.
static Boolean isRhino
 Flag for Rhino.
static Boolean isShell
 Flag for a command line shell.
static SystemWriter mWriter
 The SystemWriter.
static Boolean isKJS
 Flag for a KJS shell.
static Boolean isJScript
 Flag for Microsoft JScript.
static Object global
 The global object.
static Boolean isMozillaShell
 Flag for a Mozilla JavaScript shell.
static Boolean hasCallStackSupport
 Flag for call stack support.
static Boolean isIIS
 Flag for Microsoft IIS.


Constructor & Destructor Documentation

void JsUtil::JsUtil (  ) 


Member Function Documentation

String JsUtil::include ( String  fname  ) 

Includes a JavaScript file.

Parameters:
fname The file name. Loads the content of a JavaScript file into a String that has to be evaluated. Works for command line shells WSH, Rhino and SpiderMonkey.
Note:
This function is highly quirky. While WSH works as expected, the Mozilla shells will evaluate the file immediately and add any symbols to the global name space and return just "true". Therefore you have to evaluate the returned string for WSH at global level also. Otherwise the function is not portable.
Returns:
The JavaScript code to be evaluated.

Function JsUtil::getCaller ( Function  fn  ) 

Retrieve the caller of a function.

Parameters:
fn The function to examine.
Returns:
The caller as Function or undefined.

SystemWriter JsUtil::getSystemWriter (  ) 

Returns the SystemWriter.

Instantiates a SystemWriter depending on the current JavaScript engine. Works for command line shells WSH, Rhino and SpiderMonkey.

void JsUtil::quit ( Number  ret  ) 

Quits the JavaScript engine.

Parameters:
ret The exit code. Stops current JavaScript engine and returns an exit code. Works for command line shells WSH, Rhino and SpiderMonkey.


Member Data Documentation

Boolean JsUtil::isObtree [static]

Flag for Obtree C4.

The member is true, if the script runs in Obtree C4 of IXOS.

Boolean JsUtil::isWSH [static]

Flag for Microsoft Windows Scripting Host.

The member is true, if the script runs in the Microsoft Windows Scripting Host.

Boolean JsUtil::isBrowser [static]

Flag for a browser.

The member is true, if the script runs within a browser environment.

Boolean JsUtil::isNSServer [static]

Flag for Netscape Enterprise Server (iPlanet) engine.

The member is true, if the script runs in the iPlanet as SSJS.

Boolean JsUtil::isRhino [static]

Flag for Rhino.

The member is true, if the script runs in an embedded Rhino of Mozilla.org.

Boolean JsUtil::isShell [static]

Flag for a command line shell.

The member is true, if the script runs in a command line shell.

SystemWriter JsUtil::mWriter [static]

The SystemWriter.

See also:
getSystemWriter

Boolean JsUtil::isKJS [static]

Flag for a KJS shell.

The member is true, if the script runs in a command line shell of a KDE's script engine.

Boolean JsUtil::isJScript [static]

Flag for Microsoft JScript.

The member is true, if the script runs in the Microsoft JScript engine.

Object JsUtil::global [static]

The global object.

The member keeps the execution scope of this file, which is normally the global object.

Boolean JsUtil::isMozillaShell [static]

Flag for a Mozilla JavaScript shell.

The member is true, if the script runs in a command line shell of a Mozilla.org script engine (either SpiderMonkey or Rhino).

Boolean JsUtil::hasCallStackSupport [static]

Flag for call stack support.

The member is true, if the engine provides call stack info.

Boolean JsUtil::isIIS [static]

Flag for Microsoft IIS.

The member is true, if the script runs in the Microsoft JScript engine.


The documentation for this class was generated from the following file:
JsUnit © 1999, 2000, 2001, 2002, 2003, 2006, 2007 by Jörg Schaible
Generated on Fri Oct 19 23:11:10 2007 for JsUnit by doxygen 1.5.2