diff --git a/src/xtd.core/CMakeLists.txt b/src/xtd.core/CMakeLists.txt index eefabb5e680d..528a6f321ec1 100644 --- a/src/xtd.core/CMakeLists.txt +++ b/src/xtd.core/CMakeLists.txt @@ -300,6 +300,8 @@ add_sources( include/xtd/sbyte include/xtd/sbyte_object.h include/xtd/sbyte_object + include/xtd/self.h + include/xtd/self include/xtd/semaphore.h include/xtd/semaphore include/xtd/signal.h diff --git a/src/xtd.core/include/xtd/keywords.h b/src/xtd.core/include/xtd/keywords.h index 31fdf1e156c2..5f3637e6fcc7 100644 --- a/src/xtd.core/include/xtd/keywords.h +++ b/src/xtd.core/include/xtd/keywords.h @@ -6,6 +6,7 @@ #include "block_scope.h" #include "interface.h" #include "nameof.h" +#include "self.h" #include "startup.h" #include "typeof.h" #include "unused.h" diff --git a/src/xtd.core/include/xtd/self b/src/xtd.core/include/xtd/self new file mode 100644 index 000000000000..155510788ee5 --- /dev/null +++ b/src/xtd.core/include/xtd/self @@ -0,0 +1,2 @@ +#pragma once +#include "self.h" diff --git a/src/xtd.core/include/xtd/self.h b/src/xtd.core/include/xtd/self.h new file mode 100644 index 000000000000..6bfa48d98813 --- /dev/null +++ b/src/xtd.core/include/xtd/self.h @@ -0,0 +1,18 @@ +/// @file +/// @brief Contains #self_ keyword. +/// @copyright Copyright (c) 2023 Gammasoft. All rights reserved. +#pragma once + +/// @brief The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more. +namespace xtd { +} + +/// @brief The #self_ expression is a reference value expression whose value is the reference of the implicit object parameter (the object on which the non-static member function (up to C++23) implicit object member function (since C++23) is called). +/// @par Namespace +/// xtd +/// @par Library +/// xtd.core +/// @ingroup xtd_core keywords +/// @remarks #selt_ is equivalent to *this. +#define self_\ + (*this) diff --git a/src/xtd.core/include/xtd/types.h b/src/xtd.core/include/xtd/types.h index b7f99ae6cf35..6483df195f60 100644 --- a/src/xtd.core/include/xtd/types.h +++ b/src/xtd.core/include/xtd/types.h @@ -3,6 +3,7 @@ /// @copyright Copyright (c) 2023 Gammasoft. All rights reserved. #pragma once #include "core_export.h" +#include "self.h" /// @cond #define __XTD_VALUE_TYPE_NATIVE__ #include diff --git a/src/xtd.core/include/xtd/xtd.core.h b/src/xtd.core/include/xtd/xtd.core.h index aeea03d5e7e1..0de4b9bad062 100644 --- a/src/xtd.core/include/xtd/xtd.core.h +++ b/src/xtd.core/include/xtd/xtd.core.h @@ -332,6 +332,7 @@ #include "reset_color.h" #include "sbyte.h" #include "sbyte_object.h" +#include "self.h" #include "signal.h" #include "signal_cancel_event_args.h" #include "signal_cancel_event_handler.h"