Sha256: 05d7cbbd534c3e41601ac568c5ec831187c49d6bc7aed12fb7ed6e850ac13cb2

Contents?: true

Size: 2 KB

Versions: 8

Compression:

Stored size: 2 KB

Contents

/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
 *   Copyright 2020-Present 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 "command.hxx"

#include <cinttypes>
#include <cstddef>
#include <string>

namespace couchbase::core::impl::subdoc
{
/**
 * Should non-existent intermediate paths be created
 */
constexpr std::byte path_flag_create_parents{ 0b0000'0001U };

/**
 * If set, the path refers to an Extended Attribute (XATTR).
 * If clear, the path refers to a path inside the document body.
 */
constexpr std::byte path_flag_xattr{ 0b0000'0100U };

/**
 * Expand macro values inside extended attributes. The request is
 * invalid if this flag is set without `path_flag_create_parents` being set.
 */
constexpr std::byte path_flag_expand_macros{ 0b0001'0000U };

constexpr std::byte
build_mutate_in_path_flags(bool xattr, bool create_path, bool expand_macro)
{
    std::byte flags{ 0 };
    if (xattr) {
        flags |= path_flag_xattr;
    }
    if (create_path) {
        flags |= path_flag_create_parents;
    }
    if (expand_macro) {
        flags |= path_flag_expand_macros;
    }
    return flags;
}

constexpr std::byte
build_lookup_in_path_flags(bool xattr)
{
    std::byte flags{ 0U };
    if (xattr) {
        flags |= path_flag_xattr;
    }
    return flags;
}

constexpr bool
has_xattr_path_flag(std::byte flags)
{
    return (flags & path_flag_xattr) == path_flag_xattr;
}

} // namespace couchbase::core::impl::subdoc

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
couchbase-3.5.1 ext/couchbase/core/impl/subdoc/path_flags.hxx
couchbase-3.5.0 ext/couchbase/core/impl/subdoc/path_flags.hxx
couchbase-3.4.5 ext/couchbase/core/impl/subdoc/path_flags.hxx
couchbase-3.4.4 ext/couchbase/core/impl/subdoc/path_flags.hxx
couchbase-3.4.3 ext/couchbase/core/impl/subdoc/path_flags.hxx
couchbase-3.4.2 ext/couchbase/core/impl/subdoc/path_flags.hxx
couchbase-3.4.1 ext/couchbase/core/impl/subdoc/path_flags.hxx
couchbase-3.4.0 ext/couchbase/core/impl/subdoc/path_flags.hxx