Rogue Wave Views Foundation Package API Reference Guide |
Rogue Wave Views Documentation Home |
Scripting class. More...
#include <ilviews/base/script.h>
Public Member Functions | |
IlvScript (IlvScriptContext *context) | |
Constructor. More... | |
IlvScript (IlvScriptContext *context, istream &istr, const char *filename=0, const char *name=0) | |
Constructor. More... | |
IlvScript (IlvScriptContext *context, const char *contents, const char *name=0, const char *path=0) | |
Constructor. More... | |
IlvScript (IlvScriptContext *context, IlUInt nLines, const char *const *lines, const char *name=0, const char *path=0) | |
Constructor. More... | |
virtual | ~IlvScript () |
Destructor. More... | |
const char * | getContents () const |
Gets the script contents. More... | |
const char *const * | getContentsArray (IlUInt &nLines) const |
Gets the script contents. More... | |
IlvScriptContext * | getContext () const |
Gets the script context. More... | |
IlvScriptLanguage * | getLanguage () const |
Gets the scripting language. More... | |
const IlSymbol * | getLanguageName () const |
Gets the name of the scripting language. More... | |
const char * | getName () const |
Gets the script name. More... | |
const char * | getPathName () const |
Gets the script path name. More... | |
IlvScriptType | getType () const |
Gets the script type. More... | |
IlBoolean | isPersistent () const |
Gets the persistence capability. More... | |
void | setContents (const char *contents) |
Sets the script contents. More... | |
void | setContentsArray (IlUInt nLines, const char *const *lines) |
Sets the script contents. More... | |
void | setName (const char *name) |
Sets the script name. More... | |
void | setPathName (const char *pathName) |
Sets the script path name. More... | |
void | setPersistent (IlBoolean persistent) |
Sets the persistence capability. More... | |
virtual void | write (IlvOutputFile &os) const |
Saves the script contents. More... | |
Scripting class.
Library: xviews or winviews or mviews (mutually exclusive)
This class holds a script. Typically, a script is a piece of code that can be loaded and saved, and sometimes compiled.
IlvScriptContext
. IlvScript::IlvScript | ( | IlvScriptContext * | context | ) |
Constructor.
The constructor initializes a new empty IlvScript
.
context | The script context where this script will be stored. |
IlvScript::IlvScript | ( | IlvScriptContext * | context, |
istream & | istr, | ||
const char * | filename = 0 , |
||
const char * | name = 0 |
||
) |
Constructor.
The constructor initializes a new IlvScript
that is read from a stream.
context | The script context where this script will be stored. |
istr | 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.
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).
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 |
Destructor.
Releases the memory used by the script.
const char* IlvScript::getContents | ( | ) | const |
Gets the script contents.
This member function should be used only when the script is of the type IlvInlineScript
.
const char* const* IlvScript::getContentsArray | ( | IlUInt & | nLines | ) | const |
Gets the script contents.
nLines | The size of the returned array (that is, usually, the number of lines in the script). |
IlvInlineScript
. The returned array and its contents must not be modified or deleted by the user. IlvScriptContext* IlvScript::getContext | ( | ) | const |
Gets the script context.
IlvScriptLanguage* IlvScript::getLanguage | ( | ) | const |
Gets the scripting language.
const IlSymbol* IlvScript::getLanguageName | ( | ) | const |
Gets the name of the scripting language.
const char* IlvScript::getName | ( | ) | const |
Gets the script name.
const char* IlvScript::getPathName | ( | ) | const |
Gets the script path name.
IlvLinkedScript
. The returned string must not be deleted or modified by the user. IlvScriptType IlvScript::getType | ( | ) | const |
Gets the script 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.
IlTrue
if the script is persistent. Otherwise, it returns IlFalse
. void IlvScript::setContents | ( | const char * | contents | ) |
Sets the script contents.
The type of the script changes to the IlvInlineScript
.
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.
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.
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.
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.
persistent | The new persistence capability of this script. |
|
virtual |
Saves the script contents.
os | The output file that where the script is saved. |
© Copyright 2016, 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.