.::uuid++(3)

πŸ“¦ version 1.6.2, in fedora 43, fedora 44

πŸ’– .::uuid++ β€” the C++ glow-up of OSSP uuid πŸ’–

okay bestie, sit DOWN, because this is uuid++, the ISO-C++ language binding of the OSSP uuid C API. πŸ¦‹ It's a thin ISO-C++ class uuid that wraps the ISO-C API type uuid_t, and honestly? It's giving "same energy, cuter wrapper." πŸ’…


✨ VERSION ✨

OSSP uuid 1.6.2 (04-Jul-2008) β€” yeah she's vintage, she's iconic, she's still working. πŸ‘‘


🌸 DESCRIPTION 🌸

uuid++ is the ISO-C++ language binding of the OSSP uuid C API. It hands you a thin ISO-C++ class uuid that wraps the ISO-C API type uuid_t. That's the whole vibe: no drama, no bloat, just C++ manners on top of C bones. 🫢


πŸ‘‘ APPLICATION PROGRAMMING INTERFACE πŸ‘‘

The ISO-C++ Application Programming Interface (API) of OSSP uuid is made up of these components, and we're going through every single one, no skips, no cap. πŸ’œ

πŸŽ€ CONSTANTS πŸŽ€

The constants are the same to those provided by the ISO-C API. See uuid(3) for details. iykyk. ✨

🧚 CLASSES 🧚

Here's the roster, bestie:

  • uuid β€” This is the class corresponding to the C API type uuid_t. It is the main object. Main character energy, fr fr. πŸ‘‘
  • 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. She's the drama, but the useful drama. 😭

πŸ’… METHODS πŸ’…

Here's every method, in order, exactly as promised:

  • uuid(); β€” The standard constructor. πŸŽ€
  • uuid(const uuid &_obj); β€” The copy constructor for uuid class. Copy-paste, but make it classy. ✨
  • 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. She cleans up after herself. 🧹
  • 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 πŸ”₯

Here's the C++ API in action. Real talk though β€” exception handling is omitted for code simplification and has to be re-added for production code. Do not be out here shipping the simplified version, bestie, I'm begging. 😭

/* 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;
}
🫢 Note bestie: exception handling was skipped up there for simplicity, and you have to add it back for production code. Non-negotiable.

🌈 SEE ALSO 🌈


and that's the whole page, bestie. πŸ’œ this was written up as OSSP uuid 1.6.2, dated 04-Jul-2008 β€” yeah, 2008, and she still ate. πŸŽ€βœ¨ bye now, go generate some UUIDs. πŸ’–

πŸ“¦ where this page comes from