ScriptTextualObject¶
- class ScriptTextualObject.ScriptTextualObjectMarker¶
Bases:
object
All tree objects get amended with this marker.
- Version added:
3.5.6.0
- property has_textual_declaration¶
Gets a value indicating whether this
ScriptObject
has a textual declaration part.- Return type:
bool
- Returns:
True
if it has a textual declaration; otherwiseFalse
.
- property has_textual_implementation¶
Gets a value indicating whether this
ScriptObject
has a textual implementation part.- Return type:
bool
- Returns:
True
if it has a textual implementation; otherwiseFalse
.
- class ScriptTextualObject.ScriptTextDocument¶
Bases:
object
Interface for a text document, as it is used e. G. in textual declaration and implementation parts.
Line endings (’\n’, ‘\r’, ‘\r\n’) are normalized to ‘\n’. Lines do not include the line ending character. The first character has offset 0, the first line has lineno 0.
- Version added:
3.5.6.0
- property length¶
Gets the length of the text document in bytes.
- Return type:
int
- property linecount¶
Gets the number of lines in the current text document.
Line endings (’\n’, ‘\r’, ‘\r\n’) are normalized to ‘\n’. Lines do not include the line ending character. The first line has lineno 0.
- Return type:
int
- property text¶
Gets the complete text as a string.
- Return type:
str
- get_line(lineno)¶
Gets the line with the specified lineno.
Lines do not include the line ending character. The first line has lineno 0.
- Parameters:
lineno (int) – The line number.
- Return type:
str
- Returns:
The line.
- get_text(length, offset=None, lineno=None, lineoffset=None)¶
Gets the text.
Warning
The original C# function that is called with this method contains 2 overloads. It is strongly advised to pass all arguments with their respective keywords.
offset
,lineno
andlineoffset
are not actually optional, they just aren’t required in every overload. Pass them if your overload needs them!get_text(self, offset, length) (1/2)
Gets the text at the specified offset.
- Return type:
str
get_text(self, lineno, lineoffset, length) (2/2)
Gets the text at the specified lineno.
- Parameters:
lineoffset (int) – The offset within the line.
- Return type:
str
- replace_line(lineno, line)¶
Replaces the complete line with the specified line number with the new text.
This method retains the position info of the text lines which are not modified.
- append(text)¶
Appends the specified text at the end of the buffer.
This method retains the position info of the text lines which are not modified.
- Parameters:
text (str) – The text.
- insert(text, offset=None, lineno=None, lineoffset=None)¶
Insert text.
Warning
The original C# function that is called with this method contains 2 overloads. It is strongly advised to pass all arguments with their respective keywords.
offset
,lineno
andlineoffset
are not actually optional, they just aren’t required in every overload. Pass them if your overload needs them!insert(self, offset, text) (1/2)
Inserts the text at the specified offset.
This method retains the position info of the text lines which are not modified.
insert(self, lineno, lineoffset, text) (2/2)
Inserts the text at the offset of the specified line.
This method retains the position info of the text lines which are not modified.
- Parameters:
lineoffset (int) – The offset within the line.
- Return type:
str
- remove(length, offset=None, lineno=None, lineoffset=None)¶
Remove text.
Warning
The original C# function that is called with this method contains 2 overloads. It is strongly advised to pass all arguments with their respective keywords.
offset
,lineno
andlineoffset
are not actually optional, they just aren’t required in every overload. Pass them if your overload needs them!remove(self, offset, length) (1/2)
Removes the text at the specified offset.
This method retains the position info of the text lines which are not modified.
remove(self, lineno, lineoffset, length) (2/2)
Removes the text at the specified offset of the specified line.
This method retains the position info of the text lines which are not modified.
- Parameters:
lineoffset (int) – The offset within the line.
- replace(new_text=None, newtext=None, length=None, offset=None, lineno=None, lineoffset=None)¶
Replace text.
Warning
The original C# function that is called with this method contains 3 overloads. It is strongly advised to pass all arguments with their respective keywords. No argument is actually optional, they just aren’t required in every overload. Pass them if your overload needs them!
replace(self, offset, length, newtext) (1/3)
Removes the text at the specified offset.
This method retains the position info of the text lines which are not modified.
- Parameters:
newtext (str) – The new text.
replace(self, lineno, lineoffset, length, newtext) (2/3)
Removes the text at the specified offset of the specified line.
This method retains the position info of the text lines which are not modified.
- Parameters:
lineoffset (int) – The offset within the line.
newtext (str) – The new text.
replace (self, new_text) (3/3)
Sets the specified new text.
This method erases the position info (used for bookmarks etc).
- Parameters:
new_text (str) – The new text.
- class ScriptTextualObject.ScriptObjectWithTextualDeclaration¶
Bases:
ScriptTextualObjectMarker
Accessor interface for textual declaration parts.
- Version added:
3.5.6.0
- property textual_declaration¶
Gets the textual declaration.
- Return type:
- class ScriptTextualObject.ScriptObjectWithTextualImplementation¶
Bases:
ScriptTextualObjectMarker
Accessor interface for textual implementation parts.
- Version added:
3.5.6.0
- property textual_implementation¶
Gets the textual implementation.
- Return type: