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