SNode.C
Loading...
Searching...
No Matches
ContentDecoder.h
Go to the documentation of this file.
1/*
2 * snode.c - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef WEB_HTTP_CONTENTDECODER_H
21#define WEB_HTTP_CONTENTDECODER_H
22
23#ifndef DOXYGEN_SHOULD_SKIP_THIS
24
25#include <cstddef>
26#include <vector>
27
28#endif // DOXYGEN_SHOULD_SKIP_THIS
29
30namespace web::http {
31
32 class ContentDecoder {
33 public:
34 ContentDecoder() = default;
35 ContentDecoder(const ContentDecoder&) = delete;
36
37 ContentDecoder(ContentDecoder&&) noexcept = default;
38
39 ContentDecoder& operator=(const ContentDecoder&) = delete;
40
41 ContentDecoder& operator=(ContentDecoder&&) noexcept = default;
42
43 virtual ~ContentDecoder();
44
45 virtual std::size_t read() = 0;
46
47 bool isComplete() const;
48
49 bool isError() const;
50
51 std::vector<char>&& getContent();
52
53 protected:
54 std::vector<char> content;
55
56 bool completed = false;
57 bool error = false;
58 };
59
60} // namespace web::http
61
62#endif // WEB_HTTP_CONTENTDECODER_H
ParserState parserState
Definition Parser.h:78
virtual void analyzeHeader()
Definition Parser.cpp:138
void parseError(int code, const std::string &reason) override
void parseStartLine(const std::string &line) override