proxygen
HeaderPiece.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
12 #include <deque>
13 #include <folly/Range.h>
14 
15 namespace proxygen { namespace compress {
16 
20 class HeaderPiece {
21  public:
25  HeaderPiece(const char* inData,
26  uint32_t inLen,
27  bool inOwner,
28  bool inMultiValued)
29  : str(inData, inLen),
30  owner(inOwner),
31  multiValued(inMultiValued) {}
32 
34  : str(goner.str),
35  owner(goner.owner),
36  multiValued(goner.multiValued){
37  goner.owner = false;
38  }
39 
41  if (owner) {
42  CHECK_NOTNULL(str.data());
43  delete[] str.data();
44  }
45  }
46 
47  bool isMultiValued() const {
48  return multiValued;
49  }
50 
51  // should be const, but for one use in GzipHeaderCodec
53 
54  private:
55  bool owner;
57 };
58 
59 using HeaderPieceList = std::deque<HeaderPiece>;
60 
61 }}
HeaderPiece(HeaderPiece &&goner) noexcept
Definition: HeaderPiece.h:33
requires E e noexcept(noexcept(s.error(std::move(e))))
HeaderPiece(const char *inData, uint32_t inLen, bool inOwner, bool inMultiValued)
Definition: HeaderPiece.h:25
std::deque< HeaderPiece > HeaderPieceList
Definition: HeaderPiece.h:59
constexpr Iter data() const
Definition: Range.h:446