1<?php 2## 3## OSSP uuid - Universally Unique Identifier 4## Copyright (c) 2004-2007 Ralf S. Engelschall <rse@engelschall.com> 5## Copyright (c) 2004-2007 The OSSP Project <http://www.ossp.org/> 6## 7## This file is part of OSSP uuid, a library for the generation 8## of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ 9## 10## Permission to use, copy, modify, and distribute this software for 11## any purpose with or without fee is hereby granted, provided that 12## the above copyright notice and this permission notice appear in all 13## copies. 14## 15## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 16## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 19## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 22## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26## SUCH DAMAGE. 27## 28## uuid.php: PHP/Zend API (language: php 4.x) 29## 30 31class UUID { 32 var $uuid = null; 33 function UUID() { 34 uuid_create(&$this->uuid); 35 } 36 function clone() { 37 $clone = new UUID; 38 uuid_clone($this->uuid, &$clone->uuid); 39 return $clone; 40 } 41 function load($name) { 42 uuid_load($this->uuid, $name); 43 } 44 function make($fmt, $ns = null, $url = null) { 45 if (func_num_args() == 3) { 46 uuid_make($this->uuid, $fmt, $ns->uuid, $url); 47 } 48 else { 49 uuid_make($this->uuid, $fmt); 50 } 51 } 52 function isnil() { 53 $result = 0; 54 uuid_isnil($this->uuid, &$result); 55 return $result; 56 } 57 function compare($other) { 58 $result = 0; 59 uuid_compare($this->uuid, $other->uuid, &$result); 60 return $result; 61 } 62 function import($fmt, $data) { 63 uuid_import($this->uuid, $fmt, $data); 64 } 65 function export($fmt) { 66 $data = ""; 67 uuid_export($this->uuid, $fmt, &$data); 68 return $data; 69 } 70 function error($rc) { 71 return uuid_error($this->uuid, $rc); 72 } 73 function version() { 74 return uuid_version(); 75 } 76} 77 78?> 79