chromium/net/third_party/quiche/src/quiche/common/http/http_header_storage.h

#ifndef QUICHE_COMMON_HTTP_HTTP_HEADER_STORAGE_H_
#define QUICHE_COMMON_HTTP_HTTP_HEADER_STORAGE_H_

#include "absl/container/inlined_vector.h"
#include "absl/strings/string_view.h"
#include "quiche/common/platform/api/quiche_export.h"
#include "quiche/common/quiche_simple_arena.h"

namespace quiche {

Fragments;

// This class provides a backing store for absl::string_views. It previously
// used custom allocation logic, but now uses an UnsafeArena instead. It has the
// property that absl::string_views that refer to data in HttpHeaderStorage are
// never invalidated until the HttpHeaderStorage is deleted or Clear() is
// called.
//
// Write operations always append to the last block. If there is not enough
// space to perform the write, a new block is allocated, and any unused space
// is wasted.
class QUICHE_EXPORT HttpHeaderStorage {};

// Writes |fragments| to |dst|, joined by |separator|. |dst| must be large
// enough to hold the result. Returns the number of bytes written.
QUICHE_EXPORT size_t Join(char* dst, const Fragments& fragments,
                          absl::string_view separator);

}  // namespace quiche

#endif  // QUICHE_COMMON_HTTP_HTTP_HEADER_STORAGE_H_