table of contents
.::uuid++(3) | Universally Unique Identifier | .::uuid++(3) |
NAME¶
OSSP uuid - Universally Unique Identifier (C++ API)
VERSION¶
OSSP uuid 1.6.2 (04-Jul-2008)
DESCRIPTION¶
uuid++ is the ISO-C++ language binding of the OSSP uuid C API. It provides a thin ISO-C++ class uuid wrapping the ISO-C API type uuid_t.
APPLICATION PROGRAMMING INTERFACE¶
The ISO-C++ Application Programming Interface (API) of OSSP
uuid consists of the following components:
CONSTANTS
The constants are the same to those provided by the ISO-C API. See
uuid(3) for details.
CLASSES
The following classes are provided:
- uuid
- This is the class corresponding to the C API type uuid_t. It is the main object.
- uuid_error_t
- This is the class corresponding to the C API function uuid_error.
It is the object thrown as an exception in case of any errors.
METHODS
The following methods are provided:
- uuid();
- The standard constructor.
- uuid(const uuid &_obj);
- The copy constructor for uuid class.
- uuid(const uuid_t *_obj);
- The import constructor for C API objects.
- uuid(const void *_bin);
- The import constructor for binary representation.
- uuid(const char *_str);
- The import constructor for string representation.
- ~uuid();
- The standard destructor for uuid class.
- uuid &uuid::operator=(const uuid &_obj);
- The assignment operator corresponding to the copy constructor.
- uuid &uuid::operator=(const uuid_t *_obj);
- The assignment operator corresponding to the import constructor for C API objects.
- uuid &uuid::operator=(const void *_bin);
- The assignment operator corresponding to the import constructor for binary representation.
- uuid &uuid::operator=(const char *_str);
- The assignment operator corresponding to the import constructor for string and single integer value representation.
- uuid uuid::clone(void);
- Regular method corresponding to the C API function uuid_clone.
- void uuid::load(const char *_name);
- Regular method corresponding to the C API function uuid_load.
- void uuid::make(unsigned int _mode, ...);
- Regular method corresponding to the C API function uuid_make.
- int uuid::isnil(void);
- Regular method corresponding to the C API function uuid_isnil.
- int uuid::compare(const uuid &_obj);
- Regular method corresponding to the C API function uuid_compare.
- int uuid::operator==(const uuid &_obj);
- The comparison operator corresponding to uuid_compare usage for equality.
- int uuid::operator!=(const uuid &_obj);
- The comparison operator corresponding to uuid_compare usage for inequality.
- int uuid::operator<(const uuid &_obj);
- The comparison operator corresponding to uuid_compare usage for less-than.
- int uuid::operator<=(const uuid &_obj);
- The comparison operator corresponding to uuid_compare usage for less-than-or-equal.
- int uuid::operator>(const uuid &_obj);
- The comparison operator corresponding to uuid_compare usage for greater-than.
- int uuid::operator>=(const uuid &_obj);
- The comparison operator corresponding to uuid_compare usage for greater-than-or-equal.
- void uuid::import(const void *_bin);
- Regular method corresponding to the C API function uuid_import for binary representation usage.
- void uuid::import(const char *_str);
- Regular method corresponding to the C API function uuid_import for string representation usage.
- void *uuid::binary(void);
- Regular method corresponding to the C API function uuid_export for binary representation usage.
- char *uuid::string(void);
- Regular method corresponding to the C API function uuid_export for string representation usage.
- char *uuid::integer(void);
- Regular method corresponding to the C API function uuid_export for single integer value representation usage.
- char *uuid::summary(void);
- Regular method corresponding to the C API function uuid_export for textual summary representation usage.
- unsigned long uuid::version(void);
- Regular method corresponding to the C API function uuid_version.
- uuid_error_t()
- The standard constructor for uuid_error_t class.
- uuid_error_t(uuid_rc_t _code)
- The standard constructor for uuid_error_t class with return code initialization.
- ~uuid_error_t()
- The standard destructor for uuid_error_t class.
- void uuid_error_t::code(uuid_rc_t _code)
- Regular method for setting the return code.
- uuid_rc_t uuid_error_t::code(void)
- Regular method for fetching the return code.
- char *uuid_error_t::string(void)
- Regular method for fetching the string corresponding to the current return code.
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; }
SEE ALSO¶
OSSP uuid 1.6.2 | 04-Jul-2008 |