To implement a new routine type to be used by Studio you subclass from this abstract
routine class and fill in the methods to perform your own Load/Save/Compile/Delete/Lock
functions.
Delimiter to use when constructing directories for this document type.
This only applies if you write the List query. If you override the ItemList()
then you must insert this into ^IRIS.Temp structure yourself.
Note do not use '/' or '\' as a delimiter as these are reserved for CSP files.
property Locked as %Integer [ InitialExpression = 0 ];
Used to hold the number of times this document is locked.
It happens to be used by the default lock implementation but you may ignore this
in your subclass if you wish.
Return true if the document is up to date with respect to the compiled version, i.e. if you recompiled this document
then the generated compiled code would be the same. Return false if the source document is modified but not compiled
or the generated code has been modified manually.
Clear the contents of this Stream from permanent storage. This will remove the permanent stream storage and
any temporary stream and initialise the stream to its initial state, including removing all
the stream attributes.
Returns a %Status value indicating success or failure.
Return other document types that this is related to.
Passed a name and you return a comma separated list of the other documents it is related to
or "" if it is not related to anything. Note that this can be passed a document of another type
for example if your 'test.XXX' document creates a 'test.INT' routine then it will also be called
with 'test.INT' so you can return 'test.XXX' to complete the cycle.
Return other document types that this is related to.
Passed a name and you return a comma separated list of the other documents it is related to
or "" if it is not related to anything. This goes in opposite direction to GetOther()
function. It can be called with documents that are not of this document type as with
GetOther().
Passed a stream containing the XML document, this method should insert this
into the current document. Once this is done the importer will call Save
on the document. This default handler in assumes the export ExportToXML()
just wrote the data in a CDATA structure
Return true if this is generated and zero otherwise.
Default implementation opens instance to find the property value, it is much more efficient to override this to provide
a better implementation.
Return true if the document is up to date with respect to the compiled version, i.e. if you recompiled this document
then the generated compiled code would be the same. Return false if the source document is modified but not compiled
or the generated code has been modified manually.
This method ties into the open dialog in Studio.
It is passed a list of information based on the search criteria from the user and it should
populate the ^||%RoutineList(Idx) global with the items it wishes to show in the following format:
dirtype - This is 1 if this is a regular openable item and 0 if this is a directory so that
directories show up before the other items in the open dialog
order - The value based on the sorting order of items, e.g. size or date/time last modified, more information
on this below
index - An integer index to prevent multiple items with for example the same size from over writing each
other.
name - The name to display in the open dialog
dirsymbol - The symbol to use to navigate directories, for regular items this is "" but for directories
this should be the character to append to the directory in order to browse into this directory. Do not use
'/' or '\' as these are reserved for CSP files
type - This is an integer version of the type of the item, see the list below for details
size - The size of this item as an integer
date/time - The date/time this item was last modified in %TimeStamp format, or "" if not known
The type of the item which can be one of:
0 - MAC file, a routine containing macros
1 - INT file, a standard routine
2 - INC file, an include file
3 - BAS file, a Cache Basic routine
4 - CLS, a class
5 - CSP, a Cache Server Page or another file in this directory
7 - GBL, a Global
8 - PRJ, a Project
9 - a Package
10 - a CSP application
Further numbers are reserved for future use. User defined items should start at 100.
order is one of:
1 - Name of the file non case sensitive (the default)
2 - Date/Time the file was saved
3 - Size of the file
4 - Type of the file i.e. the number from the 'type' list
5 - Name of the file case sensitive
.
The arguments to this method are:
Idx - Index into ^||%RoutineList to write data
Ext - Extension name we are processing
Work - Array of pattern match information that we test each item against, root node is $listbuild(mapped) so you can see if we want to return
mapped items
Start - First possible match, can be used to optimise the query
End - Last possible match, can be used to optimise the query
Directory - The directory name we are searching
Sort - The entry to sort by, same as the list for 'order'
System - If true then include the '%' routines/classes
Flat - If true then flatten directories to return items inside them, this is used by the
'Namespace' tab in Studio to display all items in the system
ShowGenerated - If false then do not show items generated from something else, e.g. do not show TEST.INT
if this is compiled from TEST.MAC
NewFormat - Returned by reference, if set to true use the new ^||%RoutineList format, else caller will convert output to the new format
classmethod ListClose(ByRef qHandle As %Binary) as %Status
Lock the current routine. The default method just locks the ^ROUTINE global with the name of the routine.
If it fails then return a status code of the error, otherise return $$$OK
Move to the end of the stream so the next Write() will be appended to the end.
This allows you to read from a stream, then MoveToEnd() and append new data, where just calling
Write() after a read will clear the stream before writing new data.
Returns a %Status value indicating success or failure.
Inherited description: Reads up to len characters from the current position
in the stream. The current position is advanced by the number of
characters read. Upon exit, len is set to the actual
number of characters read. If a read occurs when the stream position
is at the end of the stream, len will be set to -1 and
Read() will return a null string (""). If no len
is passed in, ie. 'Read()()' then it is up to the Read implementation as to
how much data to return. Some stream classes use this to optimize the amount of
data returned to align this with the underlying storage of the stream.
You must call Rewind() if you want to read a stream from the beginning
again. Calling Read() after Write() implicitly ends the Write()
operation and rewinds to the start of the stream.
Returns a string up to len characters long. The byref argument sc will
return a %Status if any error occurred during the read.
Inherited description: Read a line from the stream. This will look for the line terminator in the stream and
once it finds the terminator it will return the string minus the terminator character/s. If it reaches the
end of the stream before it finds a terminator it will return the data it has so far, and if you specify a
maximum size in len it will only read up to this number of characters. On exit len
will contain the actual number of characters read. The byref argument sc will
return a %Status() if any error occured during the read and the byref argument eol
is true if it found the line terminator and false otherwise. So for example you can read in a stream
a line at a time and output the results to the current device with:
While 'stream.AtEnd { Write stream.ReadLine(,.sc,.eol) If $$$ISERR(sc) { Write "ERROR" Quit } If eol { Write ! } }
Inherited description: Deprecated method, use %Save() instead.
Saves the temporary copy of the stream data to a persistent location. Note that
any locking or transaction handling must be done by the caller.
Returns a %Status value indicating success or failure.
Return the timestamp of routine 'name' in %TimeStamp format. This is used to determine if the routine has
been updated on the server and so needs reloading from Studio. So the format should be $zdatetime($horolog,3),
or "" if the routine does not exist.
Inherited description: Appends the string data along with a line terminator to the stream and advances the
current stream position by the number of characters in data plus the line terminator.
Returns a %Status value indicating success or failure.
This query scans over the documents for the Studio open dialog.
The arguments are defined in ItemList().
This should return a row formed by:
$listbuild(name,date/time modified,size,directory delimiter)
name - The name to display in the open dialog
date/time modified - In %TimeStamp format the date/time this item was last modified
size - The size of this item
directory delimiter - If this is not a directory then return "" here, if it is a directory then
return the type of delimiter to use when they double click on this directory