Author: rhs
Date: Mon Oct 22 02:26:33 2012
New Revision: 1400749

URL: http://svn.apache.org/viewvc?rev=1400749&view=rev
Log:
completed amqp to php data binding

Modified:
    qpid/proton/trunk/proton-c/bindings/php/php.i
    qpid/proton/trunk/proton-c/bindings/php/proton.php

Modified: qpid/proton/trunk/proton-c/bindings/php/php.i
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/php/php.i?rev=1400749&r1=1400748&r2=1400749&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/php/php.i (original)
+++ qpid/proton/trunk/proton-c/bindings/php/php.i Mon Oct 22 02:26:33 2012
@@ -69,6 +69,22 @@
   ZVAL_STRINGL($result, $1.start, $1.size, 1);
 }
 
+%typemap(in) pn_uuid_t {
+  memmove($1.bytes, Z_STRVAL_PP($input), 16);
+}
+
+%typemap(out) pn_uuid_t {
+  ZVAL_STRINGL($result, $1.bytes, 16, 1);
+}
+
+%typemap(in) pn_decimal128_t {
+  memmove($1.bytes, Z_STRVAL_PP($input), 16);
+}
+
+%typemap(out) pn_decimal128_t {
+  ZVAL_STRINGL($result, $1.bytes, 16, 1);
+}
+
 // The PHP SWIG typedefs define the typemap STRING, LENGTH to be binary safe 
(allow
 // embedded \0's).
 //

Modified: qpid/proton/trunk/proton-c/bindings/php/proton.php
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/php/proton.php?rev=1400749&r1=1400748&r2=1400749&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/php/proton.php (original)
+++ qpid/proton/trunk/proton-c/bindings/php/proton.php Mon Oct 22 02:26:33 2012
@@ -76,6 +76,10 @@ class Messenger
       return pn_messenger_get_password($this->impl);
     case "trusted_certificates":
       return pn_messenger_get_trusted_certificates($this->impl);
+    case "incoming":
+      return $this->incoming();
+    case "outgoing":
+      return $this->outgoing();
     default:
       throw new Exception("unknown property: " . $name);
     }
@@ -740,7 +744,7 @@ class Data {
 
   public function get_uuid() {
     if (pn_data_type($this->impl) == Data::UUID)
-      return uuid.UUID($bytes=pn_data_get_uuid($this->impl));
+      return pn_data_get_uuid($this->impl);
     else
       return null;
   }
@@ -779,7 +783,56 @@ class Data {
     pn_data_dump($this->impl);
   }
 
-  public function put_php_array($ary) {
+  public function get_null() {
+    return null;
+  }
+
+  public function get_php_described() {
+    if ($this->enter()) {
+      try {
+        $result = array();
+        while ($this->next()) {
+          $result[] = $this->get_object();
+        }
+      } catch (Exception $e) {
+        $this->exit();
+        throw $e;
+      }
+      return $result;
+    }
+  }
+
+  public function get_php_array() {
+    if ($this->enter()) {
+      try {
+        $result = array();
+        while ($this->next()) {
+          $result[] = $this->get_object();
+        }
+      } catch (Exception $e) {
+        $this->exit();
+        throw $e;
+      }
+      return $result;
+    }
+  }
+
+  public function get_php_list() {
+    if ($this->enter()) {
+      try {
+        $result = array();
+        while ($this->next()) {
+          $result[] = $this->get_object();
+        }
+      } catch (Exception $e) {
+        $this->exit();
+        throw $e;
+      }
+      return $result;
+    }
+  }
+
+  public function put_php_map($ary) {
     $this->put_map();
     $this->enter();
     try {
@@ -794,7 +847,7 @@ class Data {
     }
   }
 
-  public function get_php_array() {
+  public function get_php_map() {
     if ($this->enter()) {
       try {
         $result = array();
@@ -823,18 +876,31 @@ class Data {
      "double" => "put_double");
   private $get_mappings = array
     (Data::NULL => "get_null",
-     Data::MAP => "get_php_array",
-     Data::STRING => "get_string",
-     Data::BYTE => "get_byte",
+     Data::BOOL => "get_bool",
      Data::UBYTE => "get_ubyte",
-     Data::SHORT => "get_short",
+     Data::BYTE => "get_byte",
      Data::USHORT => "get_ushort",
-     Data::INT => "get_int",
+     Data::SHORT => "get_short",
      Data::UINT => "get_uint",
-     Data::LONG => "get_long",
+     Data::INT => "get_int",
+     Data::CHAR => "get_char",
      Data::ULONG => "get_ulong",
+     Data::LONG => "get_long",
+     Data::TIMESTAMP => "get_timestamp",
      Data::FLOAT => "get_float",
-     Data::DOUBLE => "get_double");
+     Data::DOUBLE => "get_double",
+     Data::DECIMAL32 => "get_decimal32",
+     Data::DECIMAL64 => "get_decimal64",
+     Data::DECIMAL128 => "get_decimal128",
+     Data::UUID => "get_uuid",
+     Data::BINARY => "get_binary",
+     Data::STRING => "get_string",
+     Data::SYMBOL => "get_symbol",
+     Data::DESCRIBED => "get_php_described",
+     Data::ARY => "get_php_array",
+     Data::LST => "get_php_list",
+     Data::MAP => "get_php_map"
+     );
 
   public function put_object($obj) {
     $type = gettype($obj);
@@ -848,8 +914,6 @@ class Data {
     $type = $this->type();
     if ($type == null) return null;
     $getter = $this->get_mappings[$type];
-    if ($getter == null)
-      return new DataException("unknown type: $type");
     return $this->$getter();
   }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to