| LineNumberTracker Class |
Namespace: Sdl.FileTypeSupport.Framework.Core.Utilities.NativeApi
The LineNumberTracker type exposes the following members.
| Name | Description | |
|---|---|---|
| LineNumberTracker | Initializes a new instance of the LineNumberTracker class |
| Name | Description | |
|---|---|---|
| LastCharacterWasCR |
If true, the last processed character was a CR (0x0d).
This flag is used to determine whether an LF character (0x0a)
should increment the line count or not, since CR + LF is
counted as a single line break character.
| |
| Line |
1-based value that expresses the number of characters that
have passed through the tag and text content of this processor
since the last line break.
| |
| LineBeforeIncrement |
Accessor to the field holding the value that is set to the
current line number before it is incremented in the IncrementLineAndOffsetNumbers(String) implementation.
Implementations that override that method without calling the base class may need to set this property.
The value is used in the implementation of GetLocationBeforeCurrentContent.
| |
| Offset |
1-based index that expresses the number of line break characters that
have passed through the tag and text content of this processor.
| |
| OffsetBeforeIncrement |
Accessor to the field holding the value that is set to the
current offset number before it is incremented in the IncrementLineAndOffsetNumbers(String) implementation.
Implementations that override that method without calling the base class may need to set this property.
The value is used in the implementation of GetLocationBeforeCurrentContent.
|
| Name | Description | |
|---|---|---|
| GetCurrentLocation |
Returns a text location that corresponds to the current line and offset numbers.
| |
| GetLocationAfterCurrentContent |
Gets the current line and offset values, i.e. after the last increment.
| |
| GetLocationBeforeCurrentContent |
Gets the line and offset values as they were before the last increment.
| |
| IncrementLineAndOffsetNumbers | ||
| InlineEndTag |
Counts line breaks and characters inside tags.
(Overrides AbstractNativeExtractionGenerationContentProcessorInlineEndTag(IEndTagProperties).) | |
| InlinePlaceholderTag |
Counts line breaks and characters inside tags.
(Overrides AbstractNativeExtractionGenerationContentProcessorInlinePlaceholderTag(IPlaceholderTagProperties).) | |
| InlineStartTag |
Counts line breaks and characters inside tags.
(Overrides AbstractNativeExtractionGenerationContentProcessorInlineStartTag(IStartTagProperties).) | |
| ParseText |
Returns the number of lines and characters after the last line
break in the text. Does not update any of the member variables.
| |
| StructureTag |
Counts line breaks and characters inside structure tags.
(Overrides AbstractNativeExtractionGenerationContentProcessorStructureTag(IStructureTagProperties).) | |
| Text |
Counts line breaks and characters inside normal text.
(Overrides AbstractNativeExtractionGenerationContentProcessorText(ITextProperties).) |
This is intended to be used for components related to native text location message reporting, where line and offset numbers is the means of specifying a location for an error message.
Both line and offset numbers are 1-based, i.e. the first line in a file is line 1, and the first character on a line is character offset 1.
Line and offsets are calculated by looking at the text and tag properties passed through the content processor. Any text or tag content that contains a line break increments the current line number. The offset is reset to 1 after each line break and is incremented by 1 for each Unicode character after the line break.
Text and tags inside locked content are counted too.
The following is considered a line break character: a combination of CR+LF, a standalone LF, or a standalone CR. A CR+LF is counted as one single line break (CR = 0x0d, LF = 0x0a).
The current line and offset numbers can be read from the Line and Offset properties. These properties can also be written to, which could be useful if the values need to be adjusted.