Documentation for CFCPerlClass

Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/2473af78
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/2473af78
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/2473af78

Branch: refs/heads/cfc-pod-wip2
Commit: 2473af78f9650999e74e51113dfce4ac8503e90c
Parents: 2380454
Author: Nick Wellnhofer <[email protected]>
Authored: Wed Jun 25 17:42:28 2014 +0200
Committer: Nick Wellnhofer <[email protected]>
Committed: Wed Jun 25 17:45:00 2014 +0200

----------------------------------------------------------------------
 .../buildlib/Clownfish/CFC/Build/Binding.pm     | 40 ++++++++++++++++++++
 compiler/src/CFCPerlClass.h                     |  9 ++++-
 2 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2473af78/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm 
b/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm
index fc4d8d9..8c5d9a4 100644
--- a/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm
+++ b/compiler/perl/buildlib/Clownfish/CFC/Build/Binding.pm
@@ -18,6 +18,46 @@ use strict;
 
 sub bind_all {
     my $class = shift;
+    $class->bind_perlclass;
+}
+
+sub bind_perlclass {
+    class_from_c('CFCPerlClass', 'Clownfish::CFC::Binding::Perl::Class');
+
+    my @exposed = qw(
+        Add_To_Registry
+        Bind_Constructor
+        Bind_Method
+        Exclude_Constructor
+        Exclude_Method
+        Create_Pod
+        Get_Client
+        Get_Class_Name
+        Append_Xs
+        Get_Xs_Code
+        Set_Pod_Spec
+        Get_Pod_Spec
+    );
+    # TODO: Generate docs for functions
+    #my @exposed_functions = qw(
+    #    singleton
+    #    registry
+    #    clear_registry
+    #    method_bindings
+    #    constructor_bindings
+    #);
+
+    my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
+    $pod_spec->add_constructor( alias => 'new' );
+    $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
+
+    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
+        parcel     => 'Clownfish',
+        class_name => 'Clownfish::CFC::Binding::Perl::Class',
+    );
+    $binding->set_pod_spec($pod_spec);
+
+    Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
 # Quick and dirty hack to create a CFC class from a C header.

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2473af78/compiler/src/CFCPerlClass.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlClass.h b/compiler/src/CFCPerlClass.h
index 7051b82..f23b6d0 100644
--- a/compiler/src/CFCPerlClass.h
+++ b/compiler/src/CFCPerlClass.h
@@ -29,8 +29,7 @@ struct CFCPerlPod;
 struct CFCPerlMethod;
 struct CFCPerlConstructor;
 
-/** Clownfish::CFC::Binding::Perl::Class - Generate Perl binding code for a
- * Clownfish::CFC::Model::Class.
+/** Generate Perl binding code for a Clownfish::CFC::Model::Class.
  */
 
 /** 
@@ -90,6 +89,8 @@ CFCPerlClass_bind_constructor(CFCPerlClass *self, const char 
*alias,
                               const char *initializer);
 
 /** Block the automatic generation of a method binding.
+ *
+ * @param method The Clownfish name for the method.
  */
 void
 CFCPerlClass_exclude_method(CFCPerlClass *self, const char *method);
@@ -128,6 +129,8 @@ const char*
 CFCPerlClass_get_class_name(CFCPerlClass *self);
 
 /** Concatenate verbatim XS code.
+ *
+ * @param xs A string containing the XS code.
  */
 void
 CFCPerlClass_append_xs(CFCPerlClass *self, const char *xs);
@@ -139,6 +142,8 @@ CFCPerlClass_get_xs_code(CFCPerlClass *self);
 
 /** Supply a specification which will cause POD to be generated for this class
  * binding.
+ *
+ * @param method A Clownfish::CFC::Binding::Perl::Pod object.
  */
 void
 CFCPerlClass_set_pod_spec(CFCPerlClass *self, struct CFCPerlPod *pod_spec);

Reply via email to