Sese Framework
x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
DynamicTable.h
浏览该文件的文档.
1
// Copyright 2024 libsese
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
23
#pragma once
24
25
#include <deque>
26
#include <optional>
27
#include <string>
28
29
namespace
sese::net::http
{
30
32
class
DynamicTable
{
33
public
:
34
using
Header
= std::pair<std::string, std::string>;
35
36
explicit
DynamicTable
(
size_t
max
= 4096) noexcept;
37
38
virtual ~
DynamicTable
() noexcept = default;
39
40
void
resize
(
size_t
max
) noexcept;
41
42
[[nodiscard]]
size_t
getMaxSize
() const noexcept {
return
max
; }
43
44
[[nodiscard]]
size_t
getCount
() const noexcept {
return
queue
.size(); }
45
46
[[nodiscard]]
size_t
getSize
() const noexcept {
return
size
; }
47
48
bool
set
(
const
std::string &key,
const
std::string &value)
noexcept
;
49
50
[[nodiscard]] std::optional<Header>
get
(
size_t
index)
const
noexcept
;
51
52
[[nodiscard]]
auto
begin
()
const
{
return
queue
.begin(); }
53
54
[[nodiscard]]
auto
end
()
const
{
return
queue
.end(); }
55
56
protected
:
57
size_t
max
;
58
size_t
size
= 0;
59
std::deque<Header>
queue
;
60
};
61
}
// namespace sese::net::http
sese
net
http
DynamicTable.h
生成于 2024年 十一月 4日 星期一 09:58:01 , 为 Sese Framework使用
1.11.0