254 lines
6.7 KiB
Plaintext
254 lines
6.7 KiB
Plaintext
##
|
|
## OSSP uuid - Universally Unique Identifier
|
|
## Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com>
|
|
## Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/>
|
|
##
|
|
## 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++.pod: manual page for C++ API
|
|
##
|
|
|
|
=pod
|
|
|
|
=head1 NAME
|
|
|
|
B<OSSP uuid> - B<Universally Unique Identifier> (C++ API)
|
|
|
|
=head1 VERSION
|
|
|
|
OSSP uuid UUID_VERSION_STR
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
B<uuid++> is the ISO-C++ language binding of the B<OSSP uuid> C API.
|
|
It provides a thin ISO-C++ class B<uuid> wrapping the ISO-C API type
|
|
B<uuid_t>.
|
|
|
|
=head1 APPLICATION PROGRAMMING INTERFACE
|
|
|
|
The ISO-C++ Application Programming Interface (API) of B<OSSP uuid>
|
|
consists of the following components:
|
|
|
|
=head2 CONSTANTS
|
|
|
|
The constants are the same to those provided by the ISO-C API.
|
|
See uuid(3) for details.
|
|
|
|
=head2 CLASSES
|
|
|
|
The following classes are provided:
|
|
|
|
=over 4
|
|
|
|
=item B<uuid>
|
|
|
|
This is the class corresponding to the C API type B<uuid_t>.
|
|
It is the main object.
|
|
|
|
=item B<uuid_error_t>
|
|
|
|
This is the class corresponding to the C API function B<uuid_error>.
|
|
It is the object thrown as an exception in case of any errors.
|
|
|
|
=back
|
|
|
|
=head2 METHODS
|
|
|
|
The following methods are provided:
|
|
|
|
=over 4
|
|
|
|
=item B<uuid>();
|
|
|
|
The standard constructor.
|
|
|
|
=item B<uuid>(const uuid &_obj);
|
|
|
|
The copy constructor for B<uuid> class.
|
|
|
|
=item B<uuid>(const uuid_t *_obj);
|
|
|
|
The import constructor for C API objects.
|
|
|
|
=item B<uuid>(const void *_bin);
|
|
|
|
The import constructor for binary representation.
|
|
|
|
=item B<uuid>(const char *_str);
|
|
|
|
The import constructor for string representation.
|
|
|
|
=item ~B<uuid>();
|
|
|
|
The standard destructor for B<uuid> class.
|
|
|
|
=item uuid &B<uuid::operator=>(const uuid &_obj);
|
|
|
|
The assignment operator corresponding to the copy constructor.
|
|
|
|
=item uuid &B<uuid::operator=>(const uuid_t *_obj);
|
|
|
|
The assignment operator corresponding to the import constructor for C API objects.
|
|
|
|
=item uuid &B<uuid::operator=>(const void *_bin);
|
|
|
|
The assignment operator corresponding to the import constructor for binary representation.
|
|
|
|
=item uuid &B<uuid::operator=>(const char *_str);
|
|
|
|
The assignment operator corresponding to the import constructor for string and single integer value representation.
|
|
|
|
=item uuid B<uuid::clone>(void);
|
|
|
|
Regular method corresponding to the C API function B<uuid_clone>.
|
|
|
|
=item void B<uuid::load>(const char *_name);
|
|
|
|
Regular method corresponding to the C API function B<uuid_load>.
|
|
|
|
=item void B<uuid::make>(unsigned int _mode, ...);
|
|
|
|
Regular method corresponding to the C API function B<uuid_make>.
|
|
|
|
=item int B<uuid::isnil>(void);
|
|
|
|
Regular method corresponding to the C API function B<uuid_isnil>.
|
|
|
|
=item int B<uuid::compare>(const uuid &_obj);
|
|
|
|
Regular method corresponding to the C API function B<uuid_compare>.
|
|
|
|
=item int B<uuid::operator==>(const uuid &_obj);
|
|
|
|
The comparison operator corresponding to B<uuid_compare> usage for equality.
|
|
|
|
=item int B<uuid::operator!=>(const uuid &_obj);
|
|
|
|
The comparison operator corresponding to B<uuid_compare> usage for inequality.
|
|
|
|
=item int B<uuid::operatorE<lt>>(const uuid &_obj);
|
|
|
|
The comparison operator corresponding to B<uuid_compare> usage for less-than.
|
|
|
|
=item int B<uuid::operatorE<lt>=>(const uuid &_obj);
|
|
|
|
The comparison operator corresponding to B<uuid_compare> usage for less-than-or-equal.
|
|
|
|
=item int B<uuid::operatorE<gt>>(const uuid &_obj);
|
|
|
|
The comparison operator corresponding to B<uuid_compare> usage for greater-than.
|
|
|
|
=item int B<uuid::operatorE<gt>=>(const uuid &_obj);
|
|
|
|
The comparison operator corresponding to B<uuid_compare> usage for greater-than-or-equal.
|
|
|
|
=item void B<uuid::import>(const void *_bin);
|
|
|
|
Regular method corresponding to the C API function B<uuid_import> for binary representation usage.
|
|
|
|
=item void B<uuid::import>(const char *_str);
|
|
|
|
Regular method corresponding to the C API function B<uuid_import> for string representation usage.
|
|
|
|
=item void *B<uuid::binary>(void);
|
|
|
|
Regular method corresponding to the C API function B<uuid_export> for binary representation usage.
|
|
|
|
=item char *B<uuid::string>(void);
|
|
|
|
Regular method corresponding to the C API function B<uuid_export> for string representation usage.
|
|
|
|
=item char *B<uuid::integer>(void);
|
|
|
|
Regular method corresponding to the C API function B<uuid_export> for single integer value representation usage.
|
|
|
|
=item char *B<uuid::summary>(void);
|
|
|
|
Regular method corresponding to the C API function B<uuid_export> for textual summary representation usage.
|
|
|
|
=item unsigned long B<uuid::version>(void);
|
|
|
|
Regular method corresponding to the C API function B<uuid_version>.
|
|
|
|
=item B<uuid_error_t>()
|
|
|
|
The standard constructor for B<uuid_error_t> class.
|
|
|
|
=item B<uuid_error_t>(uuid_rc_t _code)
|
|
|
|
The standard constructor for B<uuid_error_t> class with return code initialization.
|
|
|
|
=item ~B<uuid_error_t>()
|
|
|
|
The standard destructor for B<uuid_error_t> class.
|
|
|
|
=item void B<uuid_error_t::code>(uuid_rc_t _code)
|
|
|
|
Regular method for setting the return code.
|
|
|
|
=item uuid_rc_t B<uuid_error_t::code>(void)
|
|
|
|
Regular method for fetching the return code.
|
|
|
|
=item char *B<uuid_error_t::string>(void)
|
|
|
|
Regular method for fetching the string corresponding to the current return code.
|
|
|
|
=back
|
|
|
|
=head1 EXAMPLE
|
|
|
|
The following shows an example usage of the C++ API. Exception handling is
|
|
omitted for code simplification and has to be re-added for production
|
|
code.
|
|
|
|
/* generate a DCE 1.1 v1 UUID from system environment */
|
|
char *uuid_v1(void)
|
|
{
|
|
uuid id;
|
|
char *str;
|
|
|
|
id.make(UUID_MAKE_V1);
|
|
str = id.string();
|
|
return str;
|
|
}
|
|
|
|
/* generate a DCE 1.1 v3 UUID from an URL */
|
|
char *uuid_v3(const char *url)
|
|
{
|
|
uuid id;
|
|
uuid id_ns;
|
|
char *str;
|
|
|
|
id_ns.load("ns:URL");
|
|
id.make(UUID_MAKE_V3, &id_ns, url);
|
|
str = id.string();
|
|
return str;
|
|
}
|
|
|
|
=head1 SEE ALSO
|
|
|
|
uuid(3).
|
|
|
|
=cut
|
|
|