Index: ossp-pkg/uuid/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v rcsdiff -q -kk '-r1.83' '-r1.84' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v' 2>/dev/null --- ChangeLog 2005/08/31 14:28:28 1.83 +++ ChangeLog 2005/08/31 14:29:56 1.84 @@ -13,6 +13,10 @@ Changes between 1.2.1 and 1.3.0 (30-Aug-2005 to xx-XXX-2005) + o Add an experimental C++ API binding which can be + enabled under build-time with option --with-cxx. + [Ralf S. Engelschall] + o Cleanup the internals of the uuid_create() function and add a new corresponding uuid_clone() API function. [Ralf S. Engelschall] Index: ossp-pkg/uuid/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/Makefile.in,v co -q -kk -p'1.31' '/v/ossp/cvs/ossp-pkg/uuid/Attic/Makefile.in,v' | diff -u /dev/null - -L'ossp-pkg/uuid/Makefile.in' 2>/dev/null --- ossp-pkg/uuid/Makefile.in +++ - 2024-05-09 01:02:47.201053776 +0200 @@ -0,0 +1,281 @@ +## +## OSSP uuid - Universally Unique Identifier +## Copyright (c) 2004-2005 Ralf S. Engelschall +## Copyright (c) 2004-2005 The OSSP Project +## +## This file is part of OSSP uuid, a library for the generation +## of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## +## Makefile.in: make(1) build procedure +## + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +DESTDIR = +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ + +CC = @CC@ +CXX = @CXX@ +CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@ @DEFS@ +CFLAGS = @CFLAGS@ +CXXFLAGS = @CXXFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +RM = rm -f +CP = cp +RMDIR = rmdir +SHTOOL = $(top_srcdir)/shtool +LIBTOOL = ./libtool +TRUE = true +POD2MAN = pod2man +PERL = @PERL@ + +LIB_NAME = libuuid.la +LIB_OBJS = uuid.lo uuid_md5.lo uuid_sha1.lo uuid_prng.lo uuid_mac.lo uuid_ui64.lo uuid_str.lo + +DCE_NAME = libuuid_dce.la +DCE_OBJS = uuid_dce.lo $(LIB_OBJS) + +CXX_NAME = libuuid++.la +CXX_OBJS = uuid++.lo $(LIB_OBJS) + +PRG_NAME = uuid +PRG_OBJS = uuid_cli.o + +MAN_NAME = uuid.3 uuid.1 + +PERL_NAME = perl/blib/lib/OSSP/uuid.pm +PERL_OBJS = perl/uuid.pm + +TARGETS = $(LIB_NAME) @DCE_NAME@ @CXX_NAME@ $(PRG_NAME) @PERL_NAME@ + +WITH_DCE = @WITH_DCE@ +WITH_CXX = @WITH_CXX@ +WITH_PERL = @WITH_PERL@ +WITH_PERL_COMPAT = @WITH_PERL_COMPAT@ + +.SUFFIXES: +.SUFFIXES: .c .cc .o .lo + +all: $(TARGETS) + +.c.o: + $(CC) $(CPPFLAGS) $(CFLAGS) -c $< + +.cc.o: + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< + +.c.lo: + @$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $< + +.cc.lo: + @$(LIBTOOL) --mode=compile $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< + +$(LIB_NAME): $(LIB_OBJS) + @$(LIBTOOL) --mode=link $(CC) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) \ + -version-info `$(SHTOOL) version -l c -d libtool $(top_srcdir)/uuid_vers.h` + +$(DCE_NAME): $(DCE_OBJS) + @$(LIBTOOL) --mode=link $(CC) -o $(DCE_NAME) $(DCE_OBJS) -rpath $(libdir) \ + -version-info `$(SHTOOL) version -l c -d libtool $(top_srcdir)/uuid_vers.h` + +$(CXX_NAME): $(CXX_OBJS) + @$(LIBTOOL) --mode=link $(CXX) -o $(CXX_NAME) $(CXX_OBJS) -rpath $(libdir) \ + -version-info `$(SHTOOL) version -l c -d libtool $(top_srcdir)/uuid_vers.h` + +$(PRG_NAME): $(PRG_OBJS) $(LIB_NAME) + @$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $(PRG_NAME) $(PRG_OBJS) $(LIB_NAME) $(LIBS) + +$(PERL_NAME): $(PERL_OBJS) $(LIB_NAME) + @cd perl && $(PERL) Makefile.PL PREFIX=$(prefix) COMPAT=$(WITH_PERL_COMPAT) && $(MAKE) $(MFLAGS) all + @touch $(PERL_NAME) + +uuid.lo: uuid.c config.h uuid.h uuid_md5.h uuid_sha1.h uuid_prng.h uuid_mac.h uuid_ui64.h uuid_str.h uuid_bm.h uuid_ac.h +uuid_mac.lo: uuid_mac.c config.h uuid_mac.h +uuid_md5.lo: uuid_md5.c uuid_md5.h +uuid_sha1.lo: uuid_sha1.c uuid_sha1.h +uuid_prng.lo: uuid_prng.c uuid_prng.h +uuid_str.lo: uuid_str.c config.h uuid_str.h +uuid_ui64.lo: uuid_ui64.c uuid_ui64.h +uuid_dce.lo: uuid_dce.c uuid.h uuid_dce.h +uuid_cli.o: uuid_cli.c uuid.h +uuid++.lo: uuid++.cc uuid++.hh + +man: uuid.3 uuid-config.1 uuid.1 +uuid.3: uuid.pod + V1=`$(SHTOOL) version -l c -d short $(top_srcdir)/uuid_vers.h`; \ + V2=`$(SHTOOL) version -l c -d long $(top_srcdir)/uuid_vers.h`; \ + D=`$(SHTOOL) version -l c -d long $(top_srcdir)/uuid_vers.h | sed -e 's;.*(;;' -e 's;).*;;'`; \ + $(POD2MAN) --quotes=none \ + --section=3 --center="Universally Unique Identifier" \ + --release="$$D" --date="OSSP uuid $$V1" $(srcdir)/uuid.pod | \ + sed -e "s;UUID_VERSION_STR;$$V2;" >uuid.3 +uuid-config.1: uuid-config.pod + V1=`$(SHTOOL) version -l c -d short $(top_srcdir)/uuid_vers.h`; \ + V2=`$(SHTOOL) version -l c -d long $(top_srcdir)/uuid_vers.h`; \ + D=`$(SHTOOL) version -l c -d long $(top_srcdir)/uuid_vers.h | sed -e 's;.*(;;' -e 's;).*;;'`; \ + $(POD2MAN) --quotes=none \ + --section=1 --center="Universally Unique Identifier" \ + --release="$$D" --date="OSSP uuid $$V1" $(srcdir)/uuid-config.pod | \ + sed -e "s;UUID_VERSION_STR;$$V2;" >uuid-config.1 +uuid.1: uuid_cli.pod + V1=`$(SHTOOL) version -l c -d short $(top_srcdir)/uuid_vers.h`; \ + V2=`$(SHTOOL) version -l c -d long $(top_srcdir)/uuid_vers.h`; \ + D=`$(SHTOOL) version -l c -d long $(top_srcdir)/uuid_vers.h | sed -e 's;.*(;;' -e 's;).*;;'`; \ + $(CP) $(srcdir)/uuid_cli.pod /tmp/uuid.pod; \ + $(POD2MAN) --quotes=none \ + --section=1 --center="Universally Unique Identifier" \ + --release="$$D" --date="OSSP uuid $$V1" /tmp/uuid.pod | \ + sed -e "s;UUID_VERSION_STR;$$V2;" >uuid.1; \ + $(RM) /tmp/uuid.pod + +check: all + @echo "==== UUID version 1 (time and node based): 4 single iterations"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -v1 -n 4 -1 + @echo "==== UUID version 1 (time and node based): 4 subsequent iterations"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -v1 -n 4 + @echo "==== UUID version 3 (name based, MD5): 2 times repeated"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -v3 -n 2 ns:URL http://www.ossp.org/ + @echo "==== UUID version 5 (name based, SHA-1): 2 times repeated"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -v5 -n 2 ns:URL http://www.ossp.org/ + @echo "==== UUID version 4 (random data based): 4 single iterations"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -v4 -n 4 -1 + @echo "==== UUID version 4 (random data based): 4 subsequent iterations"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -v4 -n 4 + @echo "==== UUID version 1 generation and decoding"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v1`; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v1 -m` + @echo "==== UUID version 3 generation and decoding"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v3 ns:URL http://www.ossp.org/` + @echo "==== UUID version 5 generation and decoding"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v5 ns:URL http://www.ossp.org/` + @echo "==== UUID version 3 generation and decoding"; \ + $(LIBTOOL) --mode=execute ./$(PRG_NAME) -d `$(LIBTOOL) --mode=execute ./$(PRG_NAME) -v4` + -@if [ ".$(WITH_PERL)" = .yes ]; then \ + echo "==== Perl bindings to C API"; \ + (cd perl && $(MAKE) $(MFLAGS) test); \ + fi + +install: + $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(prefix) + $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(bindir) + $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(includedir) + $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(libdir)/pkgconfig + $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man3 + $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man1 + $(SHTOOL) install -c -m 755 ./uuid-config $(DESTDIR)$(bindir)/ + $(SHTOOL) install -c -m 644 $(srcdir)/uuid-config.1 $(DESTDIR)$(mandir)/man1/ + $(SHTOOL) install -c -m 644 $(srcdir)/uuid.pc $(DESTDIR)$(libdir)/pkgconfig/ + $(SHTOOL) install -c -m 644 ./uuid.h $(DESTDIR)$(includedir)/ + -@if [ ".$(WITH_DCE)" = .yes ]; then \ + echo "$(SHTOOL) install -c -m 644 $(srcdir)/uuid_dce.h $(DESTDIR)$(includedir)/"; \ + $(SHTOOL) install -c -m 644 $(srcdir)/uuid_dce.h $(DESTDIR)$(includedir)/; \ + fi + -@if [ ".$(WITH_CXX)" = .yes ]; then \ + echo "$(SHTOOL) install -c -m 644 $(srcdir)/uuid++.hh $(DESTDIR)$(includedir)/"; \ + $(SHTOOL) install -c -m 644 $(srcdir)/uuid++.hh $(DESTDIR)$(includedir)/; \ + fi + $(SHTOOL) install -c -m 644 $(srcdir)/uuid.3 $(DESTDIR)$(mandir)/man3/ + @$(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 libuuid.la $(DESTDIR)$(libdir)/ + -@if [ ".$(WITH_DCE)" = .yes ]; then \ + $(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 libuuid_dce.la $(DESTDIR)$(libdir)/; \ + fi + -@if [ ".$(WITH_CXX)" = .yes ]; then \ + $(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 libuuid++.la $(DESTDIR)$(libdir)/; \ + fi + @$(LIBTOOL) --mode=install $(SHTOOL) install -c -s -m 755 uuid $(DESTDIR)$(bindir)/ + $(SHTOOL) install -c -m 644 $(srcdir)/uuid.1 $(DESTDIR)$(mandir)/man1/ + -@if [ ".$(WITH_PERL)" = .yes ]; then \ + (cd perl && $(MAKE) $(MFLAGS) install); \ + fi + +uninstall: + -$(RM) $(DESTDIR)$(mandir)/man1/uuid.1 + -@$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(bindir)/uuid + -@$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libuuid.la + -@if [ ".$(WITH_DCE)" = .yes ]; then \ + $(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libuuid_dce.la; \ + fi + -@if [ ".$(WITH_CXX)" = .yes ]; then \ + $(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libuuid++.la; \ + fi + -$(RM) $(DESTDIR)$(mandir)/man3/uuid.3 + -$(RM) $(DESTDIR)$(includedir)/uuid.h + -@if [ ".$(WITH_DCE)" = .yes ]; then \ + echo "$(RM) $(DESTDIR)$(includedir)/uuid_dce.h"; \ + $(RM) $(DESTDIR)$(includedir)/uuid_dce.h; \ + fi + -@if [ ".$(WITH_CXX)" = .yes ]; then \ + echo "$(RM) $(DESTDIR)$(includedir)/uuid++.hh"; \ + $(RM) $(DESTDIR)$(includedir)/uuid++.hh; \ + fi + -$(RM) $(DESTDIR)$(libdir)/pkgconfig/uuid.pc + -$(RM) $(DESTDIR)$(mandir)/man1/uuid-config.1 + -$(RM) $(DESTDIR)$(bindir)/uuid-config + -$(RMDIR) $(DESTDIR)$(mandir)/man1 >/dev/null 2>&1 || $(TRUE) + -$(RMDIR) $(DESTDIR)$(mandir)/man3 >/dev/null 2>&1 || $(TRUE) + -$(RMDIR) $(DESTDIR)$(mandir) >/dev/null 2>&1 || $(TRUE) + -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig >/dev/null 2>&1 || $(TRUE) + -$(RMDIR) $(DESTDIR)$(libdir) >/dev/null 2>&1 || $(TRUE) + -$(RMDIR) $(DESTDIR)$(includedir) >/dev/null 2>&1 || $(TRUE) + -$(RMDIR) $(DESTDIR)$(bindir) >/dev/null 2>&1 || $(TRUE) + -$(RMDIR) $(DESTDIR)$(prefix) >/dev/null 2>&1 || $(TRUE) + +clean: + -$(RM) $(LIB_NAME) $(LIB_OBJS) + -@if [ ".$(WITH_DCE)" = .yes ]; then \ + echo "$(RM) $(DCE_NAME) $(DCE_OBJS)"; \ + $(RM) $(DCE_NAME) $(DCE_OBJS); \ + fi + -@if [ ".$(WITH_CXX)" = .yes ]; then \ + echo "$(RM) $(CXX_NAME) $(CXX_OBJS)"; \ + $(RM) $(CXX_NAME) $(CXX_OBJS); \ + fi + -$(RM) $(PRG_NAME) $(PRG_OBJS) + -$(RM) -r .libs >/dev/null 2>&1 || $(TRUE) + -$(RM) *.o *.lo + -@if [ ".$(WITH_PERL)" = .yes ]; then \ + (cd perl && $(MAKE) $(MFLAGS) clean || true); \ + fi + +distclean: clean + -$(RM) config.log config.status config.cache + -$(RM) Makefile config.h uuid-config uuid.h + -$(RM) libtool + -@if [ ".$(WITH_PERL)" = .yes ]; then \ + (cd perl && $(MAKE) $(MFLAGS) distclean || true; rm -f Makefile.old); \ + fi + +realclean: distclean + -$(RM) uuid.3 uuid.1 + -$(RM) configure config.h.in + -$(RM) shtool + -$(RM) ltmain.sh libtool.m4 config.guess config.sub + Index: ossp-pkg/uuid/devtool.conf RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/devtool.conf,v rcsdiff -q -kk '-r1.16' '-r1.17' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/devtool.conf,v' 2>/dev/null --- devtool.conf 2005/08/31 09:59:45 1.16 +++ devtool.conf 2005/08/31 14:29:56 1.17 @@ -17,6 +17,7 @@ --prefix=/tmp/uuid \ --disable-shared \ --enable-debug \ + --with-cxx \ --with-perl \ --with-perl-compat \ "$@" Index: ossp-pkg/uuid/uuid++.cc RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid++.cc,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid++.cc,v' | diff -u /dev/null - -L'ossp-pkg/uuid/uuid++.cc' 2>/dev/null --- ossp-pkg/uuid/uuid++.cc +++ - 2024-05-09 01:02:47.208077906 +0200 @@ -0,0 +1,285 @@ +/* +** OSSP uuid - Universally Unique Identifier +** Copyright (c) 2004-2005 Ralf S. Engelschall +** Copyright (c) 2004-2005 The OSSP Project +** +** This file is part of OSSP uuid, a library for the generation +** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ +** +** Permission to use, copy, modify, and distribute this software for +** any purpose with or without fee is hereby granted, provided that +** the above copyright notice and this permission notice appear in all +** copies. +** +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +** +** uuid++.cc: library C++ API implementation +*/ + +#include +#include + +#include "uuid++.hh" + +using namespace std; + +/* +** OBJECT CONSTRUCTORS AND DESTRUCTOR +*/ + +/* standard constructor */ +uuid::uuid() +{ + if (uuid_create(&ctx) != UUID_RC_OK) + throw "unable to create UUID context"; +} + +/* standard destructor */ +uuid::~uuid() +{ + uuid_destroy(ctx); +} + +/* construction: import of other C++ API object (= special C++ copy constructor) */ +uuid::uuid(const uuid &obj) +{ + /* Notice: the copy constructor is the same as the assignment + operator (with the object as the RHS) below, except that (1) no + check for self-assignment is required, (2) no existing internals + have to be destroyed and (3) no return value is given back. */ + if (uuid_clone(obj.ctx, &ctx) != UUID_RC_OK) + throw "unable to clone UUID context"; +} + +/* construction: import of other C API object */ +uuid::uuid(uuid_t *obj) +{ + if (obj != NULL) + ctx = obj; + else { + if (uuid_create(&ctx) != UUID_RC_OK) + throw "unable to create UUID context"; + } +} + +/* construction: import of binary representation */ +uuid::uuid(const unsigned char *bin) +{ + if (uuid_create(&ctx) != UUID_RC_OK) + throw "unable to create UUID context"; + if (bin != NULL) { + if (uuid_import(ctx, UUID_FMT_BIN, bin, UUID_LEN_BIN) != UUID_RC_OK) + throw "unable to import UUID from binary representation"; + } +} + +/* construction: import of string representation */ +uuid::uuid(const char *str) +{ + if (uuid_create(&ctx) != UUID_RC_OK) + throw "unable to create UUID context"; + if (str != NULL) { + if (uuid_import(ctx, UUID_FMT_STR, str, strlen(str)) != UUID_RC_OK) + throw "unable to import UUID from string representation"; + } +} + +/* +** IMPORT METHODS +*/ + +/* assignment: import of other C++ API object */ +uuid &uuid::operator=(const uuid &rhs) +{ + if (this == &rhs) + return *this; + if (uuid_destroy(ctx) != UUID_RC_OK) + throw "failed to destroy old UUID context"; + if (uuid_clone(rhs.ctx, &ctx) != UUID_RC_OK) + throw "unable to clone UUID context"; + return *this; +} + +/* assignment: import of other C API object */ +uuid &uuid::operator=(const uuid_t *rhs) +{ + if (rhs == NULL) + throw "invalid RHS C object"; + if (uuid_clone((uuid_t *)rhs, &ctx) != UUID_RC_OK) + throw "unable to clone UUID context"; + return *this; +} + +/* assignment: import of binary representation */ +uuid &uuid::operator=(const unsigned char *rhs) +{ + if (rhs == NULL) + throw "invalid RHS string"; + if (uuid_import(ctx, UUID_FMT_BIN, (const void *)rhs, UUID_LEN_BIN) != UUID_RC_OK) + throw "unable to import into source UUID context"; + return *this; +} + +/* assignment: import of string representation */ +uuid &uuid::operator=(const char *rhs) +{ + if (rhs == NULL) + throw "invalid RHS string"; + if (uuid_import(ctx, UUID_FMT_STR, (const void *)rhs, strlen(rhs)) != UUID_RC_OK) + throw "unable to import into source UUID context"; + return *this; +} + +/* +** GENERATION METHODS +*/ + +/* generation: loading existing UUID by name */ +void uuid::load(const char *name) +{ + if (name == NULL) + throw "invalid UUID name"; + if (uuid_load(ctx, name) != UUID_RC_OK) + throw "unable to load UUID by name"; + return; +} + +/* generation: making new UUID one from scratch */ +void uuid::make(unsigned int mode, ...) +{ + uuid_rc_t rv; + va_list ap; + + va_start(ap, mode); + if ((mode & UUID_MAKE_V3) || (mode & UUID_MAKE_V5)) { + const char *ns = (const char *)va_arg(ap, char *); + const char *name = (const char *)va_arg(ap, char *); + if (ns == NULL || name == NULL) + throw "invalid arguments"; + rv = uuid_make(ctx, mode, ns, name); + } + else + rv = uuid_make(ctx, mode); + va_end(ap); + if (rv != UUID_RC_OK) + throw "unable to make new UUID"; + return; +} + +/* +** COMPARISON METHODS +*/ + +/* comparison: is-Nil-UUID */ +int uuid::isnil(void) +{ + int rv; + + if (uuid_isnil(ctx, &rv) != UUID_RC_OK) + throw "unable to compare UUID for being Nil-UUID"; + return rv; +} + +/* comparison: equality */ +int uuid::operator==(const uuid &rhs) +{ + int rv; + + if (uuid_compare(ctx, rhs.ctx, &rv) != UUID_RC_OK) + throw "unable to compare UUID contexts"; + return (rv == 0); +} + +/* comparison: inequality */ +int uuid::operator!=(const uuid &rhs) +{ + int rv; + + if (uuid_compare(ctx, rhs.ctx, &rv) != UUID_RC_OK) + throw "unable to compare UUID contexts"; + return (rv != 0); +} + +/* comparison: lower-than */ +int uuid::operator<(const uuid &rhs) +{ + int rv; + + if (uuid_compare(ctx, rhs.ctx, &rv) != UUID_RC_OK) + throw "unable to compare UUID contexts"; + return (rv < 0); +} + +/* comparison: lower-than-or-equal */ +int uuid::operator<=(const uuid &rhs) +{ + int rv; + + if (uuid_compare(ctx, rhs.ctx, &rv) != UUID_RC_OK) + throw "unable to compare UUID contexts"; + return (rv <= 0); +} + +/* comparison: greater-than */ +int uuid::operator>(const uuid &rhs) +{ + int rv; + + if (uuid_compare(ctx, rhs.ctx, &rv) != UUID_RC_OK) + throw "unable to compare UUID contexts"; + return (rv > 0); +} + +/* comparison: greater-than-or-equal */ +int uuid::operator>=(const uuid &rhs) +{ + int rv; + + if (uuid_compare(ctx, rhs.ctx, &rv) != UUID_RC_OK) + throw "unable to compare UUID contexts"; + return (rv >= 0); +} + +/* +** EXPORT METHODS +*/ + +/* export: object representation */ +uuid_t *uuid::object(void) +{ + return ctx; +} + +/* export: binary representation */ +unsigned char *uuid::binary(void) +{ + unsigned char *bin; + + bin = NULL; + if (uuid_export(ctx, UUID_FMT_BIN, (void **)&bin, NULL) != UUID_RC_OK) + throw "unable to export UUID context"; + return bin; +} + +/* export: string representation */ +char *uuid::string(void) +{ + char *str; + + str = NULL; + if (uuid_export(ctx, UUID_FMT_STR, (void **)&str, NULL) != UUID_RC_OK) + throw "unable to export UUID context"; + return str; +} + Index: ossp-pkg/uuid/uuid++.hh RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid++.hh,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid++.hh,v' | diff -u /dev/null - -L'ossp-pkg/uuid/uuid++.hh' 2>/dev/null --- ossp-pkg/uuid/uuid++.hh +++ - 2024-05-09 01:02:47.210814975 +0200 @@ -0,0 +1,74 @@ +/* +** OSSP uuid - Universally Unique Identifier +** Copyright (c) 2004-2005 Ralf S. Engelschall +** Copyright (c) 2004-2005 The OSSP Project +** +** This file is part of OSSP uuid, a library for the generation +** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ +** +** Permission to use, copy, modify, and distribute this software for +** any purpose with or without fee is hereby granted, provided that +** the above copyright notice and this permission notice appear in all +** copies. +** +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +** +** uuid++.hh: library C++ API definition +*/ + +#ifndef __UUIDXX_HH__ +#define __UUIDXX_HH__ + +/* required C API header */ +#include "uuid.h" + +class uuid { + private: + uuid_t *ctx; + public: + /* object constructors and destructor */ + uuid(); /* standard constructor */ + ~uuid(); /* standard destructor */ + uuid(const uuid &obj); /* construction: import of other C++ API object */ + uuid(uuid_t *obj); /* construction: import of other C API object */ + uuid(const unsigned char *str); /* construction: import of binary representation */ + uuid(const char *str); /* construction: import of string representation */ + + /* import methods */ + uuid &operator= (const uuid &rhs); /* assignment: import of other C++ API object */ + uuid &operator= (const uuid_t *rhs); /* assignment: import of other C API object */ + uuid &operator= (const unsigned char *rhs); /* assignment: import of binary representation */ + uuid &operator= (const char *rhs); /* assignment: import of string representation */ + + /* generation methods */ + void load (const char *name); /* generation: loading existing UUID by name */ + void make (unsigned int mode, ...); /* generation: making new UUID one from scratch */ + + /* comparison methods */ + int isnil (void); /* comparison: is-Nil-UUID */ + int operator== (const uuid &rhs); /* comparison: equality */ + int operator!= (const uuid &rhs); /* comparison: inequality */ + int operator< (const uuid &rhs); /* comparison: lower-than */ + int operator<= (const uuid &rhs); /* comparison: lower-than-or-equal */ + int operator> (const uuid &rhs); /* comparison: greater-than */ + int operator>= (const uuid &rhs); /* comparison: greater-than-or-equal */ + + /* export methods */ + uuid_t *object (void); /* export: object representation */ + unsigned char *binary (void); /* export: binary representation */ + char *string (void); /* export: string representation */ +}; + +#endif /* __UUIDXX_HH__ */ + Index: ossp-pkg/uuid/uuid.ac RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.ac,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.ac,v' 2>/dev/null --- uuid.ac 2005/08/31 09:59:45 1.15 +++ uuid.ac 2005/08/31 14:29:56 1.16 @@ -86,6 +86,23 @@ AC_SUBST(WITH_DCE) AC_SUBST(DCE_NAME) + dnl # configure option --with-cxx + AC_ARG_WITH([cxx], + AS_HELP_STRING([--with-cxx], [build C++ bindings to C API]), + [ac_cv_with_cxx=$withval], [ac_cv_with_cxx=no]) + AC_CACHE_CHECK([whether to build C++ bindings to C API], [ac_cv_with_cxx], [ac_cv_with_cxx=no]) + if test ".$ac_cv_with_cxx" = ".yes"; then + AC_DEFINE(WITH_CXX, 1, [whether to build C++ bindings to C API]) + WITH_CXX='yes' + CXX_NAME='$(CXX_NAME)' + AC_PROG_CXX + else + WITH_CXX='no' + CXX_NAME='' + fi + AC_SUBST(CXX_NAME) + AC_SUBST(WITH_CXX) + dnl # configure option --with-perl AC_ARG_WITH([perl], AS_HELP_STRING([--with-perl], [build Perl bindings to C API]), Index: ossp-pkg/uuid/uuid.pod RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.pod,v rcsdiff -q -kk '-r1.27' '-r1.28' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.pod,v' 2>/dev/null --- uuid.pod 2005/08/31 07:28:00 1.27 +++ uuid.pod 2005/08/31 14:29:56 1.28 @@ -246,6 +246,10 @@ Destroy UUID object I. +=item uuid_rc_t B(uuid_t *I, uuid_t **I); + +Clone UUID object I and store new UUID object in I. + =item uuid_rc_t B(uuid_t *I, int *I); Checks whether the UUID in I is the I UUID.