Loading...
 

CX_FILE_SOURCE_RANGE

CX_FILE_SOURCE_RANGE

230011
Class hierarchy
Description:

Objects of this class represent an area in a source file and provide methods to read, overwrite or open the referenced code in the editor.

The area is defined by the absolute path to the source file, as well as a start and end position. Both start and end positions are defined as (row:column), with both starting at 0. The first character of a file thus has the position (0:0).

Important: The end position defines the position of the first character that no longer belongs to the selected source code area.

This type of definition makes it possible, among other things, to select a certain line from a file without having to know how many characters this line contains at all (since the position of the last character is not needed for this).

To select the 7th line of a file, the range would be defined as follows: (start=(6:0), end=(7:0)).

Code example:

Var(sourceRange)
CreateTransObject(CX_FILE_SOURCE_RANGE) -> sourceRange
"evaluate.cxp" sourceRange Put(File())
FALSE sourceRange Call(Read) // ".... whole file content..."

// now only read the 7th line
6 sourceRange Put(StartLine())
0 sourceRange Put(StartColumn())
7 sourceRange Put(EndLine())
0 sourceRange Put(EndColumn())
FALSE sourceRange Call(Read) // "... 7th line content ... "

Method directory (MDI)
FunctionMA*ParameterReturnShort description
EditSource Opens the start position of this source range in the source code editor.
EndColumn* INTEGERColumn of the end position (starting at 0)
EndLine* INTEGERLine of the end position (starting at 0)
File* STRINGRead/write access to the file name/path for this source range.
IsValid INTEGERIs this a valid source range definition?
IsValidRange
230223
INTEGERAre start & end position valid?
Read INTEGERSTRINGReads the defined range from the source file
ReadFromString
230177
STRINGSTRINGReads the defined range from the passed STRING
RelativeTo
230177
CX_FILE_SOURE_RANGECX_FILE_SOURCE_RANGEComputes a new source range relative to the starting position of the passed source range.
Rewrite STRING Overwrites the defined range in the source file
RewriteInString
230177
STRING, STRINGSTRINGReplaces the defined range in the passed source string with the replacement string.
StartColumn* INTEGERStart column of the source range (starting at 0)
StartLine* INTEGERStart line of the source range (starting at 0)

* MA = Member access function,
greyed out = inherited function

Data Directory (DDI)
Data fieldTypeReference classI*Brief description

* I = Indexable data field,
greyed out = inherited data field.

Use in AppsWH
ModuleBrief description