87 [[nodiscard]]
constexpr auto end() const noexcept -> const
index_type& {
return end_;}
90 [[nodiscard]]
constexpr auto start() const noexcept -> const
index_type& {
return start_;}
99 [[nodiscard]]
auto equals(
const object& obj)
const noexcept ->
bool override {
return is<range>(obj) &&
equals(
static_cast<const range&
> (obj));}
152 auto result =
range {};
171 auto indexes = value.split(
'.');
188template<
typename char_t,
typename traits_t,
typename allocator_t>
195template<
typename char_t,
typename traits_t,
typename allocator_t>
197 return operator [](range);
200template<xtd::iterable source_t>
202 if (
range.start().is_from_end() ||
range.end().is_from_end()) {
203 auto safe_source = std::vector<xtd::iterable_value_type<source_t>> {source.begin(), source.end()};
208 auto skip =
range.start().value();
212 for (
const auto& item : source) {
213 if (index++ < skip)
continue;
214 if (index - 1 == end)
break;
Contains xtd::basic_string_view alias.
auto operator[](xtd::usize index) const -> const_reference
Returns a reference to the character at specified location index.
Definition basic_string.hpp:1378
auto operator()(xtd::usize index) const -> const_reference
Returns a reference to the character at specified location index.
Definition basic_string.hpp:1396
static auto is_empty(const xtd::basic_string< value_type, traits_type, allocator_type > &string) noexcept -> bool
Definition basic_string.hpp:1231
Represents an enumerable generator that supports deferred, lazy iteration over a collection of a spec...
Definition enumerable_generator.hpp:44
static auto combine(args_t... values) noexcept -> xtd::usize
Combines values into a hash code.
Definition hash_code.hpp:70
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.hpp:23
static auto take(source_t &&source, xtd::usize count) -> xtd::collections::generic::enumerable_generator< xtd::iterable_value_type< source_t > >
Returns a specified number of contiguous elements from the start of a sequence.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:40
Represents a range that has start and end indexes.
Definition range.hpp:38
auto get_hash_code() const noexcept -> size_type override
Serves as a hash function for a particular type.
Definition range.hpp:121
auto to_string() const noexcept -> xtd::string override
Returns the string representation of the current Range object.
Definition range.hpp:125
static auto end_at(index_type end) noexcept -> xtd::range
Creates a xtd::range object starting from the first element in the collection to a specified end inde...
Definition range.hpp:142
xtd::index index_type
Represents the xtd::range index type.
Definition range.hpp:44
constexpr auto start() const noexcept -> const index_type &
Gets the inclusive start index of the Range.
Definition range.hpp:90
static auto end_at(xtd::integer auto end) noexcept -> xtd::range
Creates a xtd::range object starting from the first element in the collection to a specified end inde...
Definition range.hpp:146
auto get_offset_and_length(size_type length) const -> offset_and_length
Calculates the start offset and length of the range object using a collection length.
Definition range.hpp:112
xtd::usize size_type
Represents the size type.
Definition range.hpp:47
static auto all() noexcept -> xtd::range
Gets a xtd::range object that starts from the first element to the end.
Definition range.hpp:133
auto equals(const object &obj) const noexcept -> bool override
Determines whether the specified object is equal to the current object.
Definition range.hpp:99
static auto try_parse(const xtd::string &value, xtd::range &result) noexcept -> bool
Converts the string to xtd::range equivalent. A return value indicates whether the conversion succeed...
Definition range.hpp:170
range(xtd::integer auto start, const xtd::integer auto end) noexcept
Instantiates a new xtd::range instance with the specified starting and ending indexes.
Definition range.hpp:79
constexpr auto end() const noexcept -> const index_type &
Gets an Index that represents the exclusive end index of the range.
Definition range.hpp:87
static auto start_at(xtd::integer auto start) noexcept -> xtd::range
Creates a new xtd::range object starting from a specified start index to the end of the collection.
Definition range.hpp:164
static auto start_at(index_type start) noexcept -> xtd::range
Creates a new xtd::range object starting from a specified start index to the end of the collection.
Definition range.hpp:160
static auto parse(const xtd::string &value) -> xtd::range
Converts the string to xtd::range equivalent.
Definition range.hpp:151
auto equals(const range &value) const noexcept -> bool override
Indicates whether the current object is equal to another object of the same type.
Definition range.hpp:103
range() noexcept=default
Instantiates a new xtd::range instance.
Represents a non-owning view over a contiguous sequence of objects.
Definition span.hpp:62
Definition integer.hpp:12
xtd::raw_type< decltype(*std::begin(std::declval< iterable_t & >()))> iterable_value_type
Represents the orward iterable value type.
Definition iterable_value_type.hpp:29
@ format
The format is not valid.
Definition exception_case.hpp:51
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
auto range(type_t count)
Generates a sequence of integral numbers within a specified range.
Definition range.hpp:39
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::basic_string_view< char_t, traits_t > basic_read_only_string_view
Represents an object that can refer to a constant contiguous sequence of char_t with the first elemen...
Definition basic_read_only_string_view.hpp:16
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
auto is(xtd::any value) -> bool
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:485
@ start
Starting of a logical operation.
Definition trace_event_type.hpp:37
@ end
The END key.
Definition console_key.hpp:42
Contains xtd::index struct.
Contains xtd::linq::enumerable <type_t> class.
Contains xtd::range suffixes.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
constexpr auto length() const noexcept -> size_type
Returns the length of the current read_only_span.
Definition read_only_span.hpp:209
constexpr auto size() const noexcept -> size_type
Returns the number of elements.
Definition read_only_span.hpp:213
Contains xtd::npos constant.
Contains xtd::object class.
Implements a function object for performing comparisons. Unless specialised, invokes operator== on ty...
Definition equator.hpp:39
Represents a type that can be used to index a collection either from the beginning or the end.
Definition index.hpp:38
static const index start
Represents the index of the first valid element in a collection.
Definition index.hpp:172
static const index end
Represents a value that is not a valid position in a collection.
Definition index.hpp:136
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 succeed...
Represents a offset and length.
Definition range.hpp:59
size_type length
Represents a length.
Definition range.hpp:63
size_type start
Represents a offset.
Definition range.hpp:61
Contains xtd::helpers::throw_helper class.
Contains xtd::usize type.
Contains xtd::usize_object alias.