mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
add some UUID support
This commit is contained in:
parent
e590dc7c98
commit
46e08bc040
8 changed files with 136 additions and 1 deletions
|
@ -8,8 +8,15 @@
|
|||
/// for querying and modifying that data.
|
||||
struct Replica;
|
||||
|
||||
/// Uuid is used as a task identifier. Uuids do not contain any pointers and need not be freed.
|
||||
struct Uuid {
|
||||
uint8_t _0[16];
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern const uintptr_t TC_UUID_STRING_BYTES;
|
||||
|
||||
/// Create a new Replica.
|
||||
///
|
||||
/// If path is NULL, then an in-memory replica is created. Otherwise, path is the path to the
|
||||
|
@ -34,4 +41,18 @@ const char *tc_replica_error(Replica *rep);
|
|||
/// Free a Replica.
|
||||
void tc_replica_free(Replica *rep);
|
||||
|
||||
/// Create a new, randomly-generated UUID.
|
||||
Uuid tc_uuid_new_v4();
|
||||
|
||||
/// Create a new UUID with the nil value.
|
||||
Uuid tc_uuid_nil();
|
||||
|
||||
/// Write the string representation of a Uuid into the given buffer, which must be
|
||||
/// at least TC_UUID_STRING_BYTES long. No NUL terminator is added.
|
||||
void tc_uuid_to_str(Uuid uuid, char *out);
|
||||
|
||||
/// Parse the given value as a UUID. The value must be exactly TC_UUID_STRING_BYTES long. Returns
|
||||
/// false on failure.
|
||||
bool tc_uuid_from_str(const char *val, Uuid *out);
|
||||
|
||||
} // extern "C"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue