CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
System::SequencePosition Class Reference

Represents the position of an element in a sequence. It wraps a reference to a segment object (usually held by a ReadOnlySequence) and an integer offset into that segment. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type. More...

#include <sequence_position.h>

Inherits System::Details::BoxableObjectBase.

Public Member Functions

 SequencePosition () noexcept
 Constructs a default SequencePosition that refers to no segment. More...
 
 SequencePosition (const SharedPtr< Object > &object)
 Constructs a SequencePosition that identifies the specified segment reference. More...
 
 SequencePosition (const SharedPtr< Object > &object, int32_t integer)
 Constructs a SequencePosition that identifies the specified segment reference and an integer offset within that segment. More...
 
const SharedPtr< Object > & GetObject () const noexcept
 Gets the segment reference this position points into. More...
 
int32_t GetInteger () const noexcept
 Gets the integer offset that accompanies the referenced segment. More...
 
bool Equals (const SequencePosition &other) const
 Determines whether the current SequencePosition and the specified one represent the same position. More...
 
int32_t GetHashCode () const
 Returns a hash code for the current SequencePosition. More...
 

Detailed Description

Represents the position of an element in a sequence. It wraps a reference to a segment object (usually held by a ReadOnlySequence) and an integer offset into that segment. This type should be allocated on stack and passed to functions by value or by reference. Never use System::SmartPtr class to manage objects of this type.

Constructor & Destructor Documentation

◆ SequencePosition() [1/3]

System::SequencePosition::SequencePosition ( )
noexcept

Constructs a default SequencePosition that refers to no segment.

◆ SequencePosition() [2/3]

System::SequencePosition::SequencePosition ( const SharedPtr< Object > &  object)
explicit

Constructs a SequencePosition that identifies the specified segment reference.

Parameters
objectThe reference to the segment this position points into.

◆ SequencePosition() [3/3]

System::SequencePosition::SequencePosition ( const SharedPtr< Object > &  object,
int32_t  integer 
)

Constructs a SequencePosition that identifies the specified segment reference and an integer offset within that segment.

Parameters
objectThe reference to the segment this position points into.
integerThe offset (in elements) within the referenced segment.

Member Function Documentation

◆ Equals()

bool System::SequencePosition::Equals ( const SequencePosition &  other) const

Determines whether the current SequencePosition and the specified one represent the same position.

Parameters
otherThe SequencePosition to compare with the current one.
Returns
True if both refer to the same segment object and have the same integer offset, otherwise - false.

◆ GetHashCode()

int32_t System::SequencePosition::GetHashCode ( ) const

Returns a hash code for the current SequencePosition.

Returns
A hash code that combines the hash of the referenced object and the integer offset.

◆ GetInteger()

int32_t System::SequencePosition::GetInteger ( ) const
noexcept

Gets the integer offset that accompanies the referenced segment.

Returns
The offset value held by this position.

◆ GetObject()

const SharedPtr< Object > & System::SequencePosition::GetObject ( ) const
noexcept

Gets the segment reference this position points into.

Returns
The object reference held by this position, or nullptr if this position is unset.