userver: userver/utils/encoding/tskv.hpp File Reference
Loading...
Searching...
No Matches
tskv.hpp File Reference

Detailed Description

Encoders, decoders and helpers for TSKV representations.

Definition in file tskv.hpp.

Go to the source code of this file.

#include <array>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <limits>
#include <string_view>
#include <type_traits>
#include <userver/utils/assert.hpp>

Namespaces

namespace  utils
 Utilities.
 

Macros

#define USERVER_IMPL_FORCE_INLINE   __attribute__((always_inline)) inline
 
#define USERVER_IMPL_DISABLE_ASAN   __attribute__((no_sanitize_address))
 

Enumerations

enum class  EncodeTskvMode {
  kKey ,
  kValue ,
  kKeyReplacePeriod
}
 

Functions

template<typename OutIter >
OutIter utils::encoding::EncodeTskv (OutIter destination, char ch, EncodeTskvMode mode)
 Encode according to the TSKV rules, but without escaping the quotation mark (").
 
template<typename Container >
void utils::encoding::EncodeTskv (Container &container, std::string_view str, EncodeTskvMode mode)
 Encode according to the TSKV rules, but without escaping the quotation mark (").
 
template<typename OutIter >
USERVER_IMPL_FORCE_INLINE OutIter utils::encoding::EncodeTskv (OutIter destination, char ch, EncodeTskvMode mode)
 Encode according to the TSKV rules, but without escaping the quotation mark (").
 

Variables

constexpr char utils::encoding::kTskvKeyValueSeparator = '='
 
constexpr char utils::encoding::kTskvPairsSeparator = '\t'
 

Macro Definition Documentation

◆ USERVER_IMPL_DISABLE_ASAN

#define USERVER_IMPL_DISABLE_ASAN   __attribute__((no_sanitize_address))

Definition at line 33 of file tskv.hpp.

◆ USERVER_IMPL_FORCE_INLINE

#define USERVER_IMPL_FORCE_INLINE   __attribute__((always_inline)) inline

Definition at line 26 of file tskv.hpp.

Enumeration Type Documentation

◆ EncodeTskvMode

enum class utils::encoding::EncodeTskvMode
strong

Definition at line 46 of file tskv.hpp.

Function Documentation

◆ EncodeTskv() [1/3]

template<typename Container >
void utils::encoding::EncodeTskv ( Container & container,
std::string_view str,
EncodeTskvMode mode )

Encode according to the TSKV rules, but without escaping the quotation mark (").

Note
New contents are appended at the end of container. Some extra memory is reserved as necessary.
Template Parameters
Containermust be continuous and support at least the following operations: 1) c.data() 2) c.size() 3) c.resize(new_size)

Definition at line 394 of file tskv.hpp.

◆ EncodeTskv() [2/3]

template<typename OutIter >
OutIter utils::encoding::EncodeTskv ( OutIter destination,
char ch,
EncodeTskvMode mode )

Encode according to the TSKV rules, but without escaping the quotation mark (").

Returns
The iterator to after the inserted chars.

Definition at line 67 of file tskv.hpp.

◆ EncodeTskv() [3/3]

template<typename OutIter >
USERVER_IMPL_FORCE_INLINE OutIter utils::encoding::EncodeTskv ( OutIter destination,
char ch,
EncodeTskvMode mode )

Encode according to the TSKV rules, but without escaping the quotation mark (").

Returns
The iterator to after the inserted chars.

Definition at line 67 of file tskv.hpp.

Variable Documentation

◆ kTskvKeyValueSeparator

constexpr char utils::encoding::kTskvKeyValueSeparator = '='
inlineconstexpr

Definition at line 40 of file tskv.hpp.

◆ kTskvPairsSeparator

constexpr char utils::encoding::kTskvPairsSeparator = '\t'
inlineconstexpr

Definition at line 41 of file tskv.hpp.