OSSP CVS Repository

ossp - Check-in [4847]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4847
Date: 2004-Nov-17 14:15:15 (local)
2004-Nov-17 13:15:15 (UTC)
User:rse
Branch:
Comment: implement the Perl API
Tickets:
Inspections:
Files:
ossp-pkg/cfg/perl/cfg.pm      1.4 -> 1.5     97 inserted, 2 deleted

ossp-pkg/cfg/perl/cfg.pm 1.4 -> 1.5

--- cfg.pm       2004/11/17 09:05:47     1.4
+++ cfg.pm       2004/11/17 13:15:15     1.5
@@ -127,7 +127,6 @@
 ##  (just an OO wrapper around the C-style API)
 ##
 
-#   constructor
 sub new {
     my $proto = shift;
     my $class = ref($proto) || $proto;
@@ -142,7 +141,6 @@
     return $self;
 }
 
-#   destructor
 sub DESTROY ($) {
     my ($self) = @_;
     $self->{-rc} = cfg_destroy($self->{-cfg}) if (defined($self->{-cfg}));
@@ -210,6 +208,103 @@
     return cfg_version();
 }
 
+sub node_create ($) {
+    my ($self) = @_;
+    my $node;
+    $self->{-rc} = cfg_node_create($self->{-cfg}, $node);
+    return ($self->{-rc} == $self->CFG_OK ? $node : undef);
+}
+
+sub node_destroy ($$) {
+    my ($self, $node) = @_;
+    $self->{-rc} = cfg_node_destroy($self->{-cfg}, $node);
+    return ($self->{-rc} == $self->CFG_OK);
+}
+
+sub node_clone ($$) {
+    my ($self, $node) = @_;
+    my $node2;
+    $self->{-rc} = cfg_node_clone($self->{-cfg}, $node, $node2);
+    return ($self->{-rc} == $self->CFG_OK ? $node2 : undef);
+}
+
+sub node_set ($$$$) {
+    my ($self, $node, $attr, $arg) = @_;
+    $self->{-rc} = cfg_node_set($self->{-cfg}, $node, $attr, $arg);
+    return ($self->{-rc} == $self->CFG_OK);
+}
+
+sub node_get ($$$) {
+    my ($self, $node, $attr) = @_;
+    my $arg;
+    $self->{-rc} = cfg_node_get($self->{-cfg}, $node, $attr, $arg);
+    return ($self->{-rc} == $self->CFG_OK ? $arg : undef);
+}
+
+sub node_root ($) {
+    my ($self) = @_;
+    my $node;
+    $self->{-rc} = cfg_node_root($self->{-cfg}, $node);
+    return ($self->{-rc} == $self->CFG_OK ? $node : undef);
+}
+
+sub node_select ($$$) {
+    my ($self, $node, $spec) = @_;
+    my $result;
+    $self->{-rc} = cfg_node_select($self->{-cfg}, $node, $result, $spec);
+    return ($self->{-rc} == $self->CFG_OK ? $result : undef);
+}
+
+sub node_find ($$$$) {
+    my ($self, $node, $cb_fct_cmp, $cb_ctx_cmp) = @_;
+    my $cont;
+    $self->{-rc} = cfg_node_find($self->{-cfg}, $node, $cb_fct_cmp, $cb_ctx_cmp, $cont);
+    return ($self->{-rc} == $self->CFG_OK ? $cont : undef);
+}
+
+sub node_apply ($$$$) {
+    my ($self, $node, $cb_fct_cmp, $cb_ctx_cmp, $cb_fct_cb, $cb_ctx_cb) = @_;
+    $self->{-rc} = cfg_node_apply($self->{-cfg}, $node, $cb_fct_cmp, $cb_ctx_cmp, $cb_fct_cb, $cb_ctx_cb);
+    return ($self->{-rc} == $self->CFG_OK);
+}
+
+sub node_cmp ($$$) {
+    my ($self, $node, $token) = @_;
+    $self->{-rc} = cfg_node_cmp($self->{-cfg}, $node, $token);
+    return ($self->{-rc} == $self->CFG_OK);
+}
+
+sub node_link ($$$$) {
+    my ($self, $node, $id, $node2) = @_;
+    $self->{-rc} = cfg_node_link($self->{-cfg}, $node, $id, $node2);
+    return ($self->{-rc} == $self->CFG_OK);
+}
+
+sub node_unlink ($$) {
+    my ($self, $node) = @_;
+    $self->{-rc} = cfg_node_unlink($self->{-cfg}, $node);
+    return ($self->{-rc} == $self->CFG_OK);
+}
+
+sub data_set ($$$$) {
+    my ($self, $data, $attr, $value) = @_;
+    $self->{-rc} = cfg_data_set($data, $attr, $value);
+    return ($self->{-rc} == $self->CFG_OK);
+}
+
+sub data_get ($$$) {
+    my ($self, $data, $attr) = @_;
+    my $value;
+    $self->{-rc} = cfg_data_get($data, $attr, $value);
+    return ($self->{-rc} == $self->CFG_OK ? $value : undef);
+}
+
+sub data_ctrl ($$$;$) {
+    my ($self, $data, $ctrl, $value) = @_;
+    $self->{-rc} = cfg_data_ctrl($data, $ctrl, $value);
+    return ($self->{-rc} == $self->CFG_OK);
+}
+
 ##
 ##  Low-Level Perl XS C-style API
 ##  (actually just the activation of the XS part)

CVSTrac 2.0.1