Couchbase C++ SDK 1.0.4 (rev. 5355b0f)
Loading...
Searching...
No Matches
couchbase::codec::codec_flags Namespace Reference

Enumerations

enum class  common_flags : std::uint32_t {
  reserved = 0x00 , client_specific = 0x01 , json = 0x02 , binary = 0x03 ,
  string = 0x04
}
 

Functions

constexpr auto create_common_flags (common_flags flags) -> std::uint32_t
 Takes a enum representation of common flags and moves them to the common flags MSBs.
 
constexpr auto extract_common_flags (std::uint32_t flags) -> common_flags
 Returns only the common flags from the full flags.
 
constexpr auto has_common_flags (std::uint32_t flags) -> bool
 Checks whether the upper 8 bits are set, indicating common flags presence.
 
constexpr auto has_common_flags (std::uint32_t flags, std::uint32_t expected_common_flag) -> bool
 Checks that flags has common flags bits set and that they correspond to expected common flags format.
 
constexpr auto has_common_flags (std::uint32_t flags, common_flags expected_common_flag) -> bool
 Checks that flags has common flags bits set and that they correspond to expected common flags value.
 
constexpr auto has_compression_flags (std::uint32_t flags) -> bool
 Checks whether the upper 3 bits are set, indicating compression presence.
 

Variables

constexpr std::uint32_t common_format_mask = 0x0F000000
 32bit flag is composed of:
 
constexpr std::uint32_t private_common_flags = create_common_flags(common_flags::client_specific)
 
constexpr std::uint32_t json_common_flags = create_common_flags(common_flags::json)
 
constexpr std::uint32_t binary_common_flags = create_common_flags(common_flags::binary)
 
constexpr std::uint32_t string_common_flags = create_common_flags(common_flags::string)
 

Enumeration Type Documentation

◆ common_flags

enum class common_flags : std::uint32_t
strong
Enumerator
reserved 
client_specific 
json 
binary 
string 

Function Documentation

◆ create_common_flags()

auto create_common_flags ( common_flags flags) -> std::uint32_t
constexpr

Takes a enum representation of common flags and moves them to the common flags MSBs.

Parameters
flagsthe flags to shift.
Returns
an integer having the common flags set.

◆ extract_common_flags()

auto extract_common_flags ( std::uint32_t flags) -> common_flags
constexpr

Returns only the common flags from the full flags.

Note
it returns common_flags::reserved for unknown flags structure.
Parameters
flagsthe flags to check.
Returns
only the common flags simple representation (8 bits).

◆ has_common_flags() [1/3]

auto has_common_flags ( std::uint32_t flags) -> bool
constexpr

Checks whether the upper 8 bits are set, indicating common flags presence.

It does this by shifting bits to the right until only the most significant bits are remaining and then checks if one of them is set.

Parameters
flagsthe flags to check.
Returns
true if set, false otherwise.

◆ has_common_flags() [2/3]

auto has_common_flags ( std::uint32_t flags,
common_flags expected_common_flag ) -> bool
constexpr

Checks that flags has common flags bits set and that they correspond to expected common flags value.

Parameters
flagsthe 32 bits flags to check
expected_common_flagthe expected common flags enum value
Returns
true if common flags bits are set and correspond to expected_common_flag format

◆ has_common_flags() [3/3]

auto has_common_flags ( std::uint32_t flags,
std::uint32_t expected_common_flag ) -> bool
constexpr

Checks that flags has common flags bits set and that they correspond to expected common flags format.

Parameters
flagsthe 32 bits flags to check
expected_common_flagthe expected common flags format bits
Returns
true if common flags bits are set and correspond to expected_common_flag format

◆ has_compression_flags()

auto has_compression_flags ( std::uint32_t flags) -> bool
constexpr

Checks whether the upper 3 bits are set, indicating compression presence.

It does this by shifting bits to the right until only the most significant bits are remaining and then checks if one of them is set.

Parameters
flagsthe flags to check.
Returns
true if compression set, false otherwise.

Variable Documentation

◆ binary_common_flags

std::uint32_t binary_common_flags = create_common_flags(common_flags::binary)
constexpr

◆ common_format_mask

std::uint32_t common_format_mask = 0x0F000000
constexpr

32bit flag is composed of:

  • 3 compression bits
  • 1 bit reserved for future use
  • 4 format flags bits. those 8 upper bits make up the common flags
  • 8 bits reserved for future use
  • 16 bits for legacy flags

This mask allows to compare a 32 bits flags with the 4 common flag format bits ("00001111 00000000 00000000 00000000").

See also
extract_common_flags()
has_common_flags()
has_compression_flags()

◆ json_common_flags

std::uint32_t json_common_flags = create_common_flags(common_flags::json)
constexpr

◆ private_common_flags

std::uint32_t private_common_flags = create_common_flags(common_flags::client_specific)
constexpr

◆ string_common_flags

std::uint32_t string_common_flags = create_common_flags(common_flags::string)
constexpr