Click or drag to resize
LineNumberTracker Class
Native content processor implementation that tracks line and offset number for content passed through the native API.
Inheritance Hierarchy

Namespace: Sdl.FileTypeSupport.Framework.Core.Utilities.NativeApi
Assembly: Sdl.FileTypeSupport.Framework.Core.Utilities (in Sdl.FileTypeSupport.Framework.Core.Utilities.dll) Version: 1.0.0.0 (1.0.2551.0)
Syntax
public class LineNumberTracker : AbstractNativeExtractionGenerationContentProcessor, 
	INativeLocationTracker

The LineNumberTracker type exposes the following members.

Constructors
  NameDescription
Public methodLineNumberTracker
Initializes a new instance of the LineNumberTracker class
Top
Properties
  NameDescription
Public propertyExtractionOutput
Strongly typed output content handler that can be used when the buffer is used for extraction.
(Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public propertyGenerationOutput
Strongly typed output content handler that can be used when the buffer is used for generation.
(Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public propertyLastCharacterWasCR
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.
Public propertyLine
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.
Protected propertyLineBeforeIncrement
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.
Public propertyMessageReporter
The message reporter to be used for reporting non-critical issues.
(Inherited from AbstractNativeFileTypeComponent.)
Public propertyOffset
1-based index that expresses the number of line break characters that have passed through the tag and text content of this processor.
Protected propertyOffsetBeforeIncrement
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.
Public propertyOutput
Agnostic access to the output handler; accesses the very same object instance as the ExtractionOutput and the GenerationOutput properties.
(Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public propertyPropertiesFactory
The factory used to create native properties objects
(Inherited from AbstractNativeFileTypeComponent.)
Top
Methods
  NameDescription
Public methodChangeContext
Calls ChangeContext(IContextProperties) on the Output (if set).
(Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodCommentEnd (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodCommentStart (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodCustomInfo
Calls CustomInfo(ICustomInfoProperties) on the Output (if set).
(Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetCurrentLocation
Returns a text location that corresponds to the current line and offset numbers.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLocationAfterCurrentContent
Gets the current line and offset values, i.e. after the last increment.
Public methodGetLocationBeforeCurrentContent
Gets the line and offset values as they were before the last increment.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodIncrementLineAndOffsetNumbers
This method gets called for each text and tag content that is processed. The implementation parses text for CR and LF and updates the Line and Offset properties accordingly.
Public methodInlineEndTag
Counts line breaks and characters inside tags.
(Overrides AbstractNativeExtractionGenerationContentProcessorInlineEndTag(IEndTagProperties).)
Public methodInlinePlaceholderTag
Counts line breaks and characters inside tags.
(Overrides AbstractNativeExtractionGenerationContentProcessorInlinePlaceholderTag(IPlaceholderTagProperties).)
Public methodInlineStartTag
Counts line breaks and characters inside tags.
(Overrides AbstractNativeExtractionGenerationContentProcessorInlineStartTag(IStartTagProperties).)
Public methodLocationMark
Calls LocationMark(LocationMarkerId) on the Output (if set).
(Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodLockedContentEnd (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodLockedContentStart (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodParagraphComments (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodParagraphUnitEnd (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodParagraphUnitStart (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodParseText
Returns the number of lines and characters after the last line break in the text. Does not update any of the member variables.
Public methodReportMessage(Object, String, ErrorLevel, String, String)
Calls the corresponding method on the message reporter property.
(Inherited from AbstractNativeFileTypeComponent.)
Public methodReportMessage(Object, String, ErrorLevel, String, LocationMarkerId, LocationMarkerId)
Calls the corresponding method on the message reporter property.
(Inherited from AbstractNativeFileTypeComponent.)
Public methodRevisionEnd (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodRevisionStart (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodSegmentEnd (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodSegmentStart (Inherited from AbstractNativeExtractionGenerationContentProcessor.)
Public methodStructureTag
Counts line breaks and characters inside structure tags.
(Overrides AbstractNativeExtractionGenerationContentProcessorStructureTag(IStructureTagProperties).)
Public methodText
Counts line breaks and characters inside normal text.
(Overrides AbstractNativeExtractionGenerationContentProcessorText(ITextProperties).)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

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.

See Also
Community
Edit

Be the first to Edit the community content of this topic.
Comments