Struct ParseSegment
Structure used in parsing strings. Contains offset and length.
Inherited Members
Namespace: Unity.Logging
Syntax
public struct ParseSegment
Fields
Length
Length of the segment
Declaration
public int Length
Field Value
Type | Description |
---|---|
Int32 |
Offset
Start of the segment
Declaration
public int Offset
Field Value
Type | Description |
---|---|
Int32 |
Properties
IsValid
Is this segment contains anything, or was initialized
Declaration
public readonly bool IsValid { get; }
Property Value
Type | Description |
---|---|
Boolean |
OffsetEnd
End of the segment
Declaration
public readonly int OffsetEnd { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
LeftPart(in ParseSegment, Int32)
Cut segment from the left
Declaration
public static ParseSegment LeftPart(in ParseSegment origin, int splitPoint)
Parameters
Type | Name | Description |
---|---|---|
ParseSegment | origin | Original segment |
Int32 | splitPoint | Split point inside the segment |
Returns
Type | Description |
---|---|
ParseSegment | New segment [origin.Offset..splitPoint) |
Local(in ParseSegment, in ParseSegment)
Create local segment in parent's space
Declaration
public static ParseSegment Local(in ParseSegment parent, in ParseSegment convertThis)
Parameters
Type | Name | Description |
---|---|---|
ParseSegment | parent | Parent |
ParseSegment | convertThis | Segment to convert |
Returns
Type | Description |
---|---|
ParseSegment | Same as convertThis, but offset is in parent's offset space |
Reduce(in ParseSegment, Int32, Int32)
Reduce the ParseSegment by amount of bytes from the left and right
Declaration
public static ParseSegment Reduce(in ParseSegment origin, int bytesFromLeft, int bytesFromRight)
Parameters
Type | Name | Description |
---|---|---|
ParseSegment | origin | Original segment |
Int32 | bytesFromLeft | Amount to bytes to reduce from the left |
Int32 | bytesFromRight | Amount to bytes to reduce from the right |
Returns
Type | Description |
---|---|
ParseSegment | New reduced segment |
RightPart(in ParseSegment, Int32)
Cut segment from the right
Declaration
public static ParseSegment RightPart(in ParseSegment origin, int splitPoint)
Parameters
Type | Name | Description |
---|---|---|
ParseSegment | origin | Original segment |
Int32 | splitPoint | Split point inside the segment |
Returns
Type | Description |
---|---|
ParseSegment | New segment [splitPoint..original_end] |