rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvScript Class Reference

Scripting class. More...

#include <ilviews/base/script.h>

List of all members.

Public Member Functions

 IlvScript (IlvScriptContext *context, IlUInt nLines, const char *const *lines, const char *name=0, const char *path=0)
 Constructor.
 IlvScript (IlvScriptContext *context, const char *contents, const char *name=0, const char *path=0)
 Constructor.
 IlvScript (IlvScriptContext *context, istream &, const char *filename=0, const char *name=0)
 Constructor.
 IlvScript (IlvScriptContext *context)
 Constructor.
virtual ~IlvScript ()
 Destructor.
const char * getContents () const
 Gets the script contents.
const char *const * getContentsArray (IlUInt &nLines) const
 Gets the script contents.
IlvScriptContextgetContext () const
 Gets the script context.
IlvScriptLanguagegetLanguage () const
 Gets the scripting language.
const IlSymbolgetLanguageName () const
 Gets the name of the scripting language.
const char * getName () const
 Gets the script name.
const char * getPathName () const
 Gets the script path name.
IlvScriptType getType () const
 Gets the script type.
IlBoolean isPersistent () const
 Gets the persistence capability.
void setContents (const char *contents)
 Sets the script contents.
void setContentsArray (IlUInt nLines, const char *const *lines)
 Sets the script contents.
void setName (const char *name)
 Sets the script name.
void setPathName (const char *pathName)
 Sets the script path name.
void setPersistent (IlBoolean persistent)
 Sets the persistence capability.
virtual void write (IlvOutputFile &os) const
 Saves the script contents.

Detailed Description

Scripting class.

Library: display

This class holds a script. Typically, a script is a piece of code that can be loaded and saved, and sometimes compiled.

See also:
IlvScriptContext.

Constructor & Destructor Documentation

IlvScript::IlvScript ( IlvScriptContext context  ) 

Constructor.

The constructor initializes a new empty IlvScript.

Parameters:
context The script context where this script will be stored.
IlvScript::IlvScript ( IlvScriptContext context,
istream &  ,
const char *  filename = 0,
const char *  name = 0 
)

Constructor.

The constructor initializes a new IlvScript that is read from a stream.

Parameters:
context The script context where this script will be stored.
stream The input stream from which the script is read.
filename The file name of this stream, or 0 if the stream has no associated file. This is used in error messages for easier correction.
name The name of that script, or 0 if you do not want this script to have a name. Named scripts can be retrieved easily from a script context. This string is copied internally.
IlvScript::IlvScript ( IlvScriptContext context,
const char *  contents,
const char *  name = 0,
const char *  path = 0 
)

Constructor.

The constructor initializes a new IlvScript that is created from a string.

Parameters:
context The script context where this script will be stored.
contents The string from which the script is created. This must be a 0 terminated string with valid scripting contents. This string is copied internally.
name The name of that script, or 0 if you do not want this script to have a name. Named scripts can be retrieved easily from a script context. This string is copied internally.
path A path that can identify the script, or 0 if the script has no associated path. This is used in error messages for easier correction. This string is copied internally.
IlvScript::IlvScript ( IlvScriptContext context,
IlUInt  nLines,
const char *const *  lines,
const char *  name = 0,
const char *  path = 0 
)

Constructor.

The constructor initializes a new IlvScript that is created from an array of strings (typically, an array of lines).

Parameters:
context The script context where this script will be stored.
nLines The number of strings in the array lines.
lines The array of at least nLines lines from which the script is created. Each string in the array must be a 0 terminated string, and the concatenation of all the strings should be a valid scripting contents. This array and all the strings it holds are copied internally.
name The name of that script, or 0 if you do not want this script to have a name. Named scripts can be retrieved easily from a script context. This string is copied internally.
path A path that can identify the script, or 0 if the script has no associated path. This is used in error messages for easier correction. This string is copied internally.
virtual IlvScript::~IlvScript (  )  [virtual]

Destructor.

Releases the memory used by the script.


Member Function Documentation

const char* IlvScript::getContents (  )  const

Gets the script contents.

This member function should be used only when the script is of the type IlvInlineScript.

Returns:
the contents of the script as a string. The returned string must not be modified or deleted by the user.
const char* const* IlvScript::getContentsArray ( IlUInt nLines  )  const

Gets the script contents.

Parameters:
nLines The size of the returned array (that is, usually, the number of lines in the script).
Returns:
The contents of the script as an array of strings. This member function should be used only if the script is of the type IlvInlineScript. The returned array and its contents must not be modified or deleted by the user.
IlvScriptContext* IlvScript::getContext (  )  const

Gets the script context.

Returns:
the script context of this script.
IlvScriptLanguage* IlvScript::getLanguage (  )  const

Gets the scripting language.

Returns:
The scripting language used by this script.
const IlSymbol* IlvScript::getLanguageName (  )  const

Gets the name of the scripting language.

Returns:
The name of the scripting language used in this script. This method is useful when you do not want to link with an interpreter, but still want to manipulate script languages, script contexts and scripts.
const char* IlvScript::getName (  )  const

Gets the script name.

Returns:
The name of the script or 0 if the script has no name. The returned string must not be deleted or modified by the user.
const char* IlvScript::getPathName (  )  const

Gets the script path name.

Returns:
The path name of the script, or 0 if it has none. This member function should be used only if the script is of the type IlvLinkedScript. The returned string must not be deleted or modified by the user.
IlvScriptType IlvScript::getType (  )  const

Gets the script type.

Returns:
The type of this script. Scripts of the type IlvLinkedScript reference an external file that contains the script code. When such a script is saved, only the path name of the external file is saved. When the script is loaded, it opens the specified file in order to access the script code.
IlBoolean IlvScript::isPersistent (  )  const

Gets the persistence capability.

Scripts are persistent by default. Non-persistent script cannot be saved.

Returns:
IlTrue if the script is persistent. Otherwise, it returns IlFalse.
See also:
setPersistent.
void IlvScript::setContents ( const char *  contents  ) 

Sets the script contents.

The type of the script changes to the IlvInlineScript.

Parameters:
contents The string that will be copied and stored as the new script contents.
void IlvScript::setContentsArray ( IlUInt  nLines,
const char *const *  lines 
)

Sets the script contents.

Parameters:
nLines The number of strings if the array lines.
lines The array of strings that are copied and stored as the new script contents. The type of the script changes to IlvInlineScript.
void IlvScript::setName ( const char *  name  ) 

Sets the script name.

Parameters:
name The string that will be copied and stored as the new name of this script.
void IlvScript::setPathName ( const char *  pathName  ) 

Sets the script path name.

Parameters:
pathName The string that will be copied and stored as the path name of the script. The type of the script changes to IlvLinkedScript.
void IlvScript::setPersistent ( IlBoolean  persistent  ) 

Sets the persistence capability.

Parameters:
persistent The new persistence capability of this script.
virtual void IlvScript::write ( IlvOutputFile os  )  const [virtual]

Saves the script contents.

Parameters:
os The output file that where the script is saved.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.