去除所有访问级别

This commit is contained in:
2026-08-07 17:50:04 +08:00
parent 0c7fac70b2
commit 3205dd84e8
17 changed files with 2086 additions and 2424 deletions
+12 -24
View File
@@ -7,22 +7,15 @@
#include <utility>
namespace structive {
struct Key_Category {};
struct Access_Category {};
struct Persistence_Category {};
struct Capability_Category {};
struct Unit_Category {};
struct Sensitive_Category {};
enum class External_Access {
enum class Property_Capability {
none,
read,
write,
read_write
};
enum class Persistence_Access {
none,
load,
store,
load_store
};
template <Fixed_String Value>
struct Key_Attribute {
using attribute_category = Key_Category;
@@ -30,18 +23,11 @@ struct Key_Attribute {
static constexpr bool inheritable = false;
static constexpr auto value = Value;
};
template <External_Access Value>
struct External_Access_Attribute {
using attribute_category = Access_Category;
template <Property_Capability Value>
struct Property_Capability_Attribute {
using attribute_category = Capability_Category;
static constexpr bool single_valued = true;
static constexpr bool inheritable = true;
static constexpr auto value = Value;
};
template <Persistence_Access Value>
struct Persistence_Access_Attribute {
using attribute_category = Persistence_Category;
static constexpr bool single_valued = true;
static constexpr bool inheritable = true;
static constexpr bool inheritable = false;
static constexpr auto value = Value;
};
template <Fixed_String Value>
@@ -100,10 +86,12 @@ struct Custom_Constraint {
};
template <Fixed_String Value>
inline constexpr Key_Attribute<Value> key{};
template <External_Access Value>
inline constexpr External_Access_Attribute<Value> external_access{};
template <Persistence_Access Value>
inline constexpr Persistence_Access_Attribute<Value> persistence_access{};
template <Property_Capability Value>
inline constexpr Property_Capability_Attribute<Value> capability{};
inline constexpr auto read_only = capability<Property_Capability::read>;
inline constexpr auto write_only = capability<Property_Capability::write>;
inline constexpr auto read_write = capability<Property_Capability::read_write>;
inline constexpr auto inaccessible = capability<Property_Capability::none>;
template <Fixed_String Value>
inline constexpr Unit_Attribute<Value> unit{};
template <bool Value = true>