-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0b8f99
commit fb22cd2
Showing
4 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#pragma once | ||
#include "from.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/// @file | ||
/// @brief Contains xtd::linq::from methods. | ||
/// @copyright Copyright (c) 2024 Gammasoft. All rights reserved. | ||
#pragma once | ||
#include "enumerable.hpp" | ||
|
||
/// @brief The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more. | ||
namespace xtd { | ||
/// @brief Provides classes and interfaces that support queries that use Language-Integrated Query (LINQ). | ||
namespace linq { | ||
/// @brief Returns the input typed as xtd::collection::generic::ienumerable <type_t>. | ||
/// @param source A sequence of values. | ||
/// @return The input sequence typed as xtd::collection::generic::ienumerable <type_t>. | ||
/// @par Header | ||
/// ```cpp | ||
/// #include <xtd/linq/from> | ||
/// ``` | ||
/// @par Namespace | ||
/// xtd::linq | ||
/// @par Library | ||
/// xtd.core | ||
/// @ingroup xtd_core linq | ||
template <typename source_t> | ||
const auto& from(const xtd::collections::generic::ienumerable<source_t>& source) { | ||
return enumerable::as_enumerable(source); | ||
} | ||
|
||
/// @brief Returns the input typed as xtd::collection::generic::ienumerable <type_t>. | ||
/// @param source A sequence of values. | ||
/// @return The input sequence typed as xtd::collection::generic::ienumerable <type_t>. | ||
/// @par Header | ||
/// ```cpp | ||
/// #include <xtd/linq/from> | ||
/// ``` | ||
/// @par Namespace | ||
/// xtd::linq | ||
/// @par Library | ||
/// xtd.core | ||
/// @ingroup xtd_core linq | ||
template <typename source_t> | ||
const auto& from(const std::initializer_list<source_t>& source) { | ||
return enumerable::as_enumerable(source); | ||
} | ||
|
||
/// @brief Returns the input typed as xtd::collection::generic::ienumerable <type_t>. | ||
/// @param source A sequence of values. | ||
/// @return The input sequence typed as xtd::collection::generic::ienumerable <type_t>. | ||
/// @par Header | ||
/// ```cpp | ||
/// #include <xtd/linq/from> | ||
/// ``` | ||
/// @par Namespace | ||
/// xtd::linq | ||
/// @par Library | ||
/// xtd.core | ||
/// @ingroup xtd_core linq | ||
template <typename collection_t> | ||
const auto& from(const collection_t& source) { | ||
return enumerable::as_enumerable(source); | ||
} | ||
|
||
/// @brief Returns the input typed as xtd::collection::generic::ienumerable <type_t>. | ||
/// @param first The first iterator. | ||
/// @param last The last iterator. | ||
/// @return The input sequence typed as xtd::collection::generic::ienumerable <type_t>. | ||
/// @par Header | ||
/// ```cpp | ||
/// #include <xtd/linq/from> | ||
/// ``` | ||
/// @par Namespace | ||
/// xtd::linq | ||
/// @par Library | ||
/// xtd.core | ||
/// @ingroup xtd_core linq | ||
template <typename input_iterator_t> | ||
const auto& from(input_iterator_t first, input_iterator_t last) { | ||
return enumerable::as_enumerable(first, last); | ||
} | ||
} | ||
} |