Sha256: af9a6a5fd7e0695bcb6ff08b5e8fbd64c70f7f74ddd6635e39eb10a20437faec

Contents?: true

Size: 1.35 KB

Versions: 35

Compression:

Stored size: 1.35 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::uuid
{

using uuid_t = std::array<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::uuid::uuid_t& uuid);

} // namespace couchbase::uuid

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
couchbase-3.3.0 ext/couchbase/couchbase/platform/uuid.h
couchbase-3.2.0-universal-darwin-20 ext/couchbase/platform/uuid.h
couchbase-3.2.0 ext/couchbase/platform/uuid.h
couchbase-3.1.1 ext/couchbase/platform/uuid.h
couchbase-3.1.1-universal-darwin-20 ext/couchbase/platform/uuid.h
couchbase-3.1.0 ext/couchbase/platform/uuid.h
couchbase-3.0.3 ext/couchbase/platform/uuid.h
couchbase-3.0.3-universal-darwin-20 ext/couchbase/platform/uuid.h
couchbase-3.0.2 ext/couchbase/platform/uuid.h
couchbase-3.0.1-universal-darwin-19 ext/couchbase/platform/uuid.h
couchbase-3.0.1 ext/couchbase/platform/uuid.h
couchbase-3.0.0-universal-darwin-19 ext/couchbase/platform/uuid.h
couchbase-3.0.0 ext/couchbase/platform/uuid.h
couchbase-3.0.0.beta.1-universal-darwin-19 ext/couchbase/platform/uuid.h
couchbase-3.0.0.beta.1 ext/couchbase/platform/uuid.h
couchbase-3.0.0.alpha.5-x86_64-linux ext/couchbase/platform/uuid.h
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/couchbase/platform/uuid.h
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/couchbase/platform/uuid.h
couchbase-3.0.0.alpha.5 ext/couchbase/platform/uuid.h
couchbase-3.0.0.alpha.4-x86_64-linux ext/couchbase/platform/uuid.h