119 FieldLookupTable(quint32 maxTableSize,
bool useIndex);
121 bool prependField(
const QByteArray &name,
const QByteArray &value);
124 quint32 numberOfEntries()
const;
125 quint32 numberOfStaticEntries()
const;
126 quint32 numberOfDynamicEntries()
const;
127 quint32 dynamicDataSize()
const;
128 void clearDynamicTable();
130 bool indexIsValid(quint32 index)
const;
131 quint32 indexOf(
const QByteArray &name,
const QByteArray &value)
const;
132 quint32 indexOf(
const QByteArray &name)
const;
133 bool field(quint32 index, QByteArray *name, QByteArray *value)
const;
134 bool fieldName(quint32 index, QByteArray *dst)
const;
135 bool fieldValue(quint32 index, QByteArray *dst)
const;
137 bool updateDynamicTableSize(quint32 size);
138 void setMaxDynamicTableSize(quint32 size);
140 static const std::vector<HeaderField> &staticPart();
145 quint32 maxTableSize;
150 quint32 tableCapacity;
152 using Chunk = std::vector<HeaderField>;
153 using ChunkPtr = std::unique_ptr<Chunk>;
154 std::deque<ChunkPtr> chunks;
155 using size_type = std::deque<ChunkPtr>::size_type;
158 friend struct SearchEntry;
163 SearchEntry(
const HeaderField *f,
const Chunk *c,
164 quint32 o,
const FieldLookupTable *t);
166 const HeaderField *field;
168 const quint32 offset;
169 const FieldLookupTable *table;
171 bool operator < (
const SearchEntry &rhs)
const;
175 std::set<SearchEntry> searchIndex;
177 SearchEntry frontKey()
const;
178 SearchEntry backKey()
const;
180 bool fieldAt(quint32 index, HeaderField *field)
const;
182 const HeaderField &front()
const;
183 HeaderField &front();
184 const HeaderField &back()
const;
191 quint32 indexOfChunk(
const Chunk *chunk)
const;
192 quint32 keyToIndex(
const SearchEntry &key)
const;
194 enum class CompareMode {
199 static std::vector<HeaderField>::const_iterator findInStaticPart(
const HeaderField &field, CompareMode mode);
201 mutable QByteArray dummyDst;
203 Q_DISABLE_COPY_MOVE(FieldLookupTable)