Represents a type that can be used to index a collection either from the beginning or the end.
Public Aliases | |
| using | value_type |
| Represents the xtd::index index type. | |
Public Static Properties | |
| static const index | end |
| Represents a value that is not a valid position in a collection. | |
| static const index | last |
| Represents the index of the last valid element in a collection. | |
| static const index | start |
| Represents the index of the first valid element in a collection. | |
Public Constructors | |
| constexpr | index () noexcept=default |
| Instantiates a new xtd::index instance. | |
| constexpr | index (xtd::integer auto value, xtd::logical auto from_end) noexcept |
| Initializes a new xtd::index with a specified index position and a value that indicates if the index is from the beginning or the end of a collection. | |
| constexpr | index (xtd::integer auto value) noexcept |
| Initializes a new xtd::index with a specified index position and a value that indicates if the index is from the beginning or the end of a collection. | |
Public Properties | |
| constexpr auto | value () const noexcept -> value_type |
| Gets an xtd::index that represents the exclusive end index of the range. | |
| constexpr auto | is_from_end () const noexcept -> bool |
| Gets a value that indicates whether the index is from the start or the end. | |
Public Methods | |
| auto | equals (const object &obj) const noexcept -> bool override |
| Determines whether the specified object is equal to the current object. | |
| auto | equals (const index &value) const noexcept -> bool override |
| Indicates whether the current object is equal to another object of the same type. | |
| auto | get_hash_code () const noexcept -> xtd::usize override |
| Serves as a hash function for a particular type. | |
| auto | get_offset (value_type length) const noexcept -> xtd::usize |
| Calculates the offset from the start of the collection using the specified collection length. | |
| auto | to_string () const noexcept -> xtd::string override |
| Returns the string representation of the current Range object. | |
| constexpr auto | to_usize () const noexcept -> value_type |
| Returns the xtd::usize representation of the current Range object. | |
Public Static Methods | |
| static constexpr auto | from_end (xtd::integer auto value) |
| Creates an xtd::ndex from the end of a collection at a specified index position. | |
| static constexpr auto | from_start (xtd::integer auto value) |
| Creates an xtd::ndex from the start of a collection at a specified index position. | |
| static auto | parse (const xtd::string &value) -> xtd::index |
| Converts the string to xtd::index equivalent. | |
| static auto | try_parse (const xtd::string &value, xtd::index &result) noexcept -> bool |
| Converts the string to xtd::index equivalent. A return value indicates whether the conversion succeeded or failed. | |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual auto | get_type () const noexcept -> type_object |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| Creates a shallow copy of the current object. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are the same instance. | |
| using xtd::index::value_type |
Represents the xtd::index index type.
|
constexprdefaultnoexcept |
Instantiates a new xtd::index instance.
|
inlineconstexprnoexcept |
Initializes a new xtd::index with a specified index position and a value that indicates if the index is from the beginning or the end of a collection.
| value | The index value. It has to be greater then or equal to zero. |
| from_end | true to index from the end of the collection, or false to index from the beginning of the collection. |
|
inlineexplicitconstexprnoexcept |
Initializes a new xtd::index with a specified index position and a value that indicates if the index is from the beginning or the end of a collection.
| value | The index value. It has to be greater then or equal to zero. |
|
inlinenodiscardconstexprnoexcept |
Gets an xtd::index that represents the exclusive end index of the range.
|
inlinenodiscardconstexprnoexcept |
Gets a value that indicates whether the index is from the start or the end.
|
nodiscardoverridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
| obj | The object to compare with the current object. |
Reimplemented from xtd::object.
|
nodiscardoverridevirtualnoexcept |
Indicates whether the current object is equal to another object of the same type.
| obj | An object to compare with this object. |
Implements xtd::iequatable< index >.
|
nodiscardoverridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
|
nodiscardnoexcept |
Calculates the offset from the start of the collection using the specified collection length.
| length | The length of the collection that the xtd::index will be used with. Must be a positive value. |
|
nodiscardoverridevirtualnoexcept |
Returns the string representation of the current Range object.
Reimplemented from xtd::object.
|
inlinenodiscardconstexprnoexcept |
Returns the xtd::usize representation of the current Range object.
|
inlinestaticconstexpr |
Creates an xtd::ndex from the end of a collection at a specified index position.
| value | The index value from the end of a collection. |
|
inlinestaticconstexpr |
Creates an xtd::ndex from the start of a collection at a specified index position.
| value | The index value from the start of a collection. |
|
staticnodiscard |
Converts the string to xtd::index equivalent.
| value | A string containing a xtd::index to convert. |
|
staticnodiscardnoexcept |
Converts the string to xtd::index equivalent. A return value indicates whether the conversion succeeded or failed.
| value | A string containing a xtd::index to convert. |
| result | A xtd::index equivalent to the native value contained in value. |
|
static |
Represents a value that is not a valid position in a collection.
|
static |
Represents the index of the last valid element in a collection.
|
static |
Represents the index of the first valid element in a collection.