Search Results for

    Show / Hide Table of Contents

    Class NativeTextLocation

    Reference to a location inside a plain text file, specified through line and offset numbers.

    Inheritance
    object
    NativeTextLocation
    Implements
    ICloneable
    IComparable<NativeTextLocation>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.FileTypeSupport.Framework.NativeApi
    Assembly: Sdl.FileTypeSupport.Framework.Core.dll
    Syntax
    public class NativeTextLocation : ICloneable, IComparable<NativeTextLocation>
    Remarks

    Line and offset numbers are 1-based, i.e. line number 1 is the first line in a file, and offset number 1 is the first character on the line.

    Constructors

    NativeTextLocation()

    Creates an uninitialized instance, where line and offset are both 0.

    Declaration
    public NativeTextLocation()

    NativeTextLocation(NativeTextLocation)

    Protected constructor used in cloning

    Declaration
    protected NativeTextLocation(NativeTextLocation other)
    Parameters
    Type Name Description
    NativeTextLocation other

    NativeTextLocation(int, int)

    Initializes with the specified line and offset numbers.

    Declaration
    public NativeTextLocation(int line, int offset)
    Parameters
    Type Name Description
    int line
    int offset

    Properties

    Line

    Line number in the text. The first line in a file is line number 1. A value of 0 indicates that the line number has not been set. Negative values are not allowed.

    Declaration
    public virtual int Line { get; set; }
    Property Value
    Type Description
    int
    Remarks

    A new line starts when one of the following character combinations are encountered:

    • CR + LF (0x0c 0x0a) (treated as a single line break)
    • Standalone CR (without a following LF)
    • Standalone LF

    Offset

    Character offset on the current line. The first character on the line is offset 1. A value of 0 indicates that the offset has not be specified. Negative values are not allowed.

    Declaration
    public virtual int Offset { get; set; }
    Property Value
    Type Description
    int

    Methods

    Clone()

    Returns a deep clone of this object.

    Declaration
    public object Clone()
    Returns
    Type Description
    object

    CompareTo(NativeTextLocation)

    Returns 1 if this is after the other, -1 if this is before the other, and 0 if equal to the other.

    Declaration
    public int CompareTo(NativeTextLocation other)
    Parameters
    Type Name Description
    NativeTextLocation other

    Must not be null

    Returns
    Type Description
    int

    Equals(object)

    True if both line and offset numbers are equal.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)

    GetHashCode()

    The hash code is computed by shifting and combining the line and offset numbers.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()

    IsAfter(NativeTextLocation)

    True if this instance has line and offset numbers that indicate that it appears later in the content than the other instance.

    Declaration
    public bool IsAfter(NativeTextLocation other)
    Parameters
    Type Name Description
    NativeTextLocation other

    Must not be null

    Returns
    Type Description
    bool

    IsBefore(NativeTextLocation)

    True if this instance has line and offset numbers that indicate that it appears earlier in the content than the other instance.

    Declaration
    public bool IsBefore(NativeTextLocation other)
    Parameters
    Type Name Description
    NativeTextLocation other

    must not be null

    Returns
    Type Description
    bool

    ToString()

    Returns a string in the format "(line, offset)" that is intended for ease of use in debugging

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Implements

    ICloneable
    IComparable<T>
    In this article
    • Constructors
      • NativeTextLocation()
      • NativeTextLocation(NativeTextLocation)
      • NativeTextLocation(int, int)
    • Properties
      • Line
      • Offset
    • Methods
      • Clone()
      • CompareTo(NativeTextLocation)
      • Equals(object)
      • GetHashCode()
      • IsAfter(NativeTextLocation)
      • IsBefore(NativeTextLocation)
      • ToString()
    • Implements
    Back to top Generated by DocFX