XS constructor
[gitmo/Mouse.git] / xs-src / MouseAttribute.xs
diff --git a/xs-src/MouseAttribute.xs b/xs-src/MouseAttribute.xs
new file mode 100644 (file)
index 0000000..f4d4ea4
--- /dev/null
@@ -0,0 +1,49 @@
+#define  NEED_newSVpvn_flags_GLOBAL
+#include "mouse.h"
+
+MODULE = Mouse::Meta::Attribute  PACKAGE = Mouse::Meta::Attribute
+
+PROTOTYPES: DISABLE
+
+BOOT:
+    /* readers */
+    INSTALL_SIMPLE_READER(Attribute, name);
+    INSTALL_SIMPLE_READER(Attribute, associated_class);
+    INSTALL_SIMPLE_READER(Attribute, accessor);
+    INSTALL_SIMPLE_READER(Attribute, reader);
+    INSTALL_SIMPLE_READER(Attribute, writer);
+    INSTALL_SIMPLE_READER(Attribute, predicate);
+    INSTALL_SIMPLE_READER(Attribute, clearer);
+    INSTALL_SIMPLE_READER(Attribute, handles);
+
+    INSTALL_SIMPLE_READER_WITH_KEY(Attribute, _is_metadata, is);
+    INSTALL_SIMPLE_READER_WITH_KEY(Attribute, is_required, required);
+    INSTALL_SIMPLE_READER(Attribute, default);
+    INSTALL_SIMPLE_READER_WITH_KEY(Attribute, is_lazy, lazy);
+    INSTALL_SIMPLE_READER_WITH_KEY(Attribute, is_lazy_build, lazy_build);
+    INSTALL_SIMPLE_READER_WITH_KEY(Attribute, is_weak_ref, weak_ref);
+    INSTALL_SIMPLE_READER(Attribute, init_arg);
+    INSTALL_SIMPLE_READER(Attribute, type_constraint);
+    INSTALL_SIMPLE_READER(Attribute, trigger);
+    INSTALL_SIMPLE_READER(Attribute, builder);
+    INSTALL_SIMPLE_READER_WITH_KEY(Attribute, should_auto_deref, auto_deref);
+    INSTALL_SIMPLE_READER_WITH_KEY(Attribute, should_coerce, coerce);
+    INSTALL_SIMPLE_READER(Attribute, documentation);
+
+    /* predicates */
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_accessor, accessor);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_reader, reader);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_writer, writer);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_predicate, predicate);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_clearer, clearer);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_handles, handles);
+
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_default, default);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_type_constraint, type_constraint);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_trigger, trigger);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_builder, builder);
+    INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_documentation, documentation);
+
+    newCONSTSUB(gv_stashpvs("Mouse::Meta::Attribute", TRUE), "accessor_metaclass",
+        newSVpvs("Mouse::Meta::Method::Accessor::XS"));
+