Sha256: ab914bc9b4e060056ca447bc0a6b84d26c00aedd891cb223a2c2c9fb1c8251a7

Contents?: true

Size: 1.38 KB

Versions: 10

Compression:

Stored size: 1.38 KB

Contents

/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *     Copyright 2017 Couchbase, Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
#pragma once

#include <array>
#include <cstdint>
#include <string>

namespace couchbase::core::uuid
{

using uuid_t = std::array<std::uint8_t, 16>;

/**
 * Get a random uuid (version 4 of the uuids)
 */
void
random(uuid_t& uuid);

/**
 * Generate a new random uuid and return it
 */
uuid_t
random();

/**
 * Convert a textual version of a UUID to a uuid type
 * @throw std::invalid_argument if the textual uuid is not
 *        formatted correctly
 */
uuid_t
from_string(std::string_view str);

/**
 * Print a textual version of the UUID in the form:
 *
 *     00000000-0000-0000-0000-000000000000
 */
std::string
to_string(const couchbase::core::uuid::uuid_t& uuid);

} // namespace couchbase::core::uuid

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
couchbase-3.5.3 ext/couchbase/core/platform/uuid.h
couchbase-3.5.2 ext/couchbase/core/platform/uuid.h
couchbase-3.5.1 ext/couchbase/core/platform/uuid.h
couchbase-3.5.0 ext/couchbase/core/platform/uuid.h
couchbase-3.4.5 ext/couchbase/core/platform/uuid.h
couchbase-3.4.4 ext/couchbase/core/platform/uuid.h
couchbase-3.4.3 ext/couchbase/core/platform/uuid.h
couchbase-3.4.2 ext/couchbase/core/platform/uuid.h
couchbase-3.4.1 ext/couchbase/core/platform/uuid.h
couchbase-3.4.0 ext/couchbase/core/platform/uuid.h