xtd 0.2.0
Loading...
Searching...
No Matches
expression.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "../type_of.hpp"
7#include <concepts>
8#include <ostream>
9#include <type_traits>
10
12namespace xtd {
14 namespace expressions {
107 struct expression {
109
142 template <typename left_t, typename right_t>
143 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
144 static constexpr auto add(left_t left, right_t right);
145
177 template <typename left_t, typename right_t>
178 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
179 static constexpr auto and_(left_t left, right_t right);
180
214 template <typename left_t, typename right_t>
215 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
216 static constexpr auto and_also(left_t left, right_t right);
217
250 template <size_t index>
251 static constexpr auto arg();
252
284 template <typename left_t, typename right_t>
285 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
286 static constexpr auto compare_three_way(left_t left, right_t right);
287
323 template <auto constant_value>
324 static constexpr auto constant();
325
357 template <typename left_t, typename right_t>
358 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
359 static constexpr auto divide(left_t left, right_t right);
360
392 template <typename left_t, typename right_t>
393 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
394 static constexpr auto equal(left_t left, right_t right);
395
427 template <typename left_t, typename right_t>
428 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
429 static constexpr auto greater_than(left_t left, right_t right);
430
462 template <typename left_t, typename right_t>
463 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
464 static constexpr auto greater_than_or_equal(left_t left, right_t right);
465
497 template <typename left_t, typename right_t>
498 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
499 static constexpr auto left_shift(left_t left, right_t right);
500
532 template <typename left_t, typename right_t>
533 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
534 static constexpr auto less_than(left_t left, right_t right);
535
567 template <typename left_t, typename right_t>
568 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
569 static constexpr auto less_than_or_equal(left_t left, right_t right);
570
604 template <typename left_t, typename right_t>
605 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
606 static constexpr auto logical_and(left_t left, right_t right);
607
631 template <typename value_t>
632 requires std::is_base_of_v<expression, std::decay_t<value_t>>
633 static constexpr auto logical_not(value_t value);
634
668 template <typename left_t, typename right_t>
669 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
670 static constexpr auto logical_or(left_t left, right_t right);
671
703 template <typename left_t, typename right_t>
704 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
705 static constexpr auto modulo(left_t left, right_t right);
706
738 template <typename left_t, typename right_t>
739 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
740 static constexpr auto multiply(left_t left, right_t right);
741
765 template <typename value_t>
766 requires std::is_base_of_v<expression, std::decay_t<value_t>>
767 static constexpr auto negate(value_t value);
768
792 template <typename value_t>
793 requires std::is_base_of_v<expression, std::decay_t<value_t>>
794 static constexpr auto not_(value_t value);
795
827 template <typename left_t, typename right_t>
828 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
829 static constexpr auto not_equal(left_t left, right_t right);
830
862 template <typename left_t, typename right_t>
863 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
864 static constexpr auto or_(left_t left, right_t right);
865
899 template <typename left_t, typename right_t>
900 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
901 static constexpr auto or_else(left_t left, right_t right);
902
936 template <size_t index>
937 static constexpr auto placeholder();
938
970 template <typename left_t, typename right_t>
971 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
972 static constexpr auto right_shift(left_t left, right_t right);
973
1005 template <typename left_t, typename right_t>
1006 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
1007 static constexpr auto spaceship(left_t left, right_t right);
1008
1040 template <typename left_t, typename right_t>
1041 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
1042 static constexpr auto subtract(left_t left, right_t right);
1043
1067 template <typename value_t>
1068 requires std::is_base_of_v<expression, std::decay_t<value_t>>
1069 static constexpr auto unary_minus(value_t value);
1070
1094 template <typename value_t>
1095 requires std::is_base_of_v<expression, std::decay_t<value_t>>
1096 static constexpr auto unary_plus(value_t value);
1097
1133 template <typename type_t>
1134 static constexpr auto value(type_t value);
1135
1167 template <typename left_t, typename right_t>
1168 requires std::is_base_of_v<expression, std::decay_t<left_t>> || std::is_base_of_v<expression, std::decay_t<right_t>>
1169 static constexpr auto xor_(left_t left, right_t right);
1171
1172 protected:
1174
1176 expression() = default;
1178 };
1179
1181 template<typename type_t>
1182 requires std::is_base_of_v<expression, std::decay_t<type_t>>
1183 auto operator <<(std::ostream& os, const type_t& e) -> std::ostream& {return os << type_of(e);}
1185 }
1186}
1187
constexpr auto operator<<(left_t left, right_t right)
Subtract the specified left and right operands.
Definition left_shift_expression.hpp:127
@ e
The E key.
Definition console_key.hpp:96
The xtd::expressions namespace provides a lightweight, composable expression template framework for b...
Definition add_expression.hpp:14
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::expressions::operator_precedence enum class.
static constexpr auto less_than(left_t left, right_t right)
Less than the specified left and right operands.
static constexpr auto and_also(left_t left, right_t right)
Logical and the specified left and right operands.
static constexpr auto xor_(left_t left, right_t right)
Bitwise xor the specified left and right operands.
static constexpr auto spaceship(left_t left, right_t right)
Compare three way the specified left and right operands.
static constexpr auto negate(value_t value)
Unary minus the specified left and right operands.
static constexpr auto add(left_t left, right_t right)
Add the specified left and right operands.
static constexpr auto not_(value_t value)
Bitwise not the specified left and right operands.
static constexpr auto placeholder()
Gets the index placeholder used by expression.
static constexpr auto left_shift(left_t left, right_t right)
Left shift the specified left and right operands.
static constexpr auto multiply(left_t left, right_t right)
Multiply the specified left and right operands.
static constexpr auto divide(left_t left, right_t right)
Divide the specified left and right operands.
static constexpr auto greater_than(left_t left, right_t right)
Greater than the specified left and right operands.
static constexpr auto arg()
Gets the index argument used by expression.
static constexpr auto constant()
Gets the constant value.
static constexpr auto modulo(left_t left, right_t right)
Modulo the specified left and right operands.
static constexpr auto logical_or(left_t left, right_t right)
Logical or the specified left and right operands.
static constexpr auto not_equal(left_t left, right_t right)
Not equal the specified left and right operands.
static constexpr auto less_than_or_equal(left_t left, right_t right)
Less than or equal the specified left and right operands.
static constexpr auto subtract(left_t left, right_t right)
Subtract the specified left and right operands.
static constexpr auto greater_than_or_equal(left_t left, right_t right)
Greater than or equzl the specified left and right operands.
static constexpr auto compare_three_way(left_t left, right_t right)
Compare three way the specified left and right operands.
static constexpr auto or_else(left_t left, right_t right)
Logical or the specified left and right operands.
static constexpr auto unary_minus(value_t value)
Unary minus the specified left and right operands.
static constexpr auto value(type_t value)
Gets the value value.
static constexpr auto right_shift(left_t left, right_t right)
Right shift the specified left and right operands.
static constexpr auto or_(left_t left, right_t right)
Bitwise or the specified left and right operands.
static constexpr auto equal(left_t left, right_t right)
Equal the specified left and right operands.
static constexpr auto and_(left_t left, right_t right)
Bitwise and the specified left and right operands.
static constexpr auto logical_not(value_t value)
Logical not the specified left and right operands.
static constexpr auto logical_and(left_t left, right_t right)
Logical and the specified left and right operands.
static constexpr auto unary_plus(value_t value)
Unary plus the specified left and right operands.
Contains xtd::type_of methods.