JsUnit
Project Developer Home doxygen

Public Member Functions | Static Public Attributes | List of all members
JsUtil Class Reference

Helper class with static flags. More...

Collaboration diagram for JsUtil:
Collaboration graph

Public Member Functions

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

Static Public Attributes

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

Detailed Description

Helper class with static flags.

Constructor & Destructor Documentation

void JsUtil::JsUtil ( )

Member Function Documentation

Function JsUtil::getCaller ( Function  fn)

Retrieve the caller of a function.

Parameters
fnThe 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.

String JsUtil::include ( String  fname)

Includes a JavaScript file.

Parameters
fnameThe 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.
void JsUtil::quit ( Number  ret)

Quits the JavaScript engine.

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

Member Data Documentation

Object JsUtil::global
static

The global object.

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

Boolean JsUtil::hasCallStackSupport
static

Flag for call stack support.

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

Boolean JsUtil::isBrowser
static

Flag for a browser.

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

Boolean JsUtil::isIIS
static

Flag for Microsoft IIS.

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

Boolean JsUtil::isJScript
static

Flag for Microsoft JScript.

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

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::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::isNSServer
static

Flag for Netscape Enterprise Server (iPlanet) engine.

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

Boolean JsUtil::isObtree
static

Flag for Obtree C4.

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

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.

Boolean JsUtil::isWSH
static

Flag for Microsoft Windows Scripting Host.

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

SystemWriter JsUtil::mWriter
static

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 Wed Apr 15 2015 02:33:07 for JsUnit by doxygen 1.8.5