libsaltpack
Loading...
Searching...
No Matches
ArmoredInputStream.h
1/*
2 * Copyright 2016-2024 Luca Zanconato
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef SALTPACK_ARMOREDINPUTSTREAM_H
18#define SALTPACK_ARMOREDINPUTSTREAM_H
19
20#include <iostream>
21#include <sstream>
22#include "types.h"
23
24namespace saltpack {
25
31 class ArmoredInputStream : public std::istream, std::streambuf {
32
33 public:
43 ArmoredInputStream(std::istream &in, const std::string& app);
44
52 explicit ArmoredInputStream(std::istream &in);
53
58
64 int underflow() override;
65
66 private:
67 char ch{};
68 std::string app;
69 std::istream &input;
70 std::stringstream buffer;
71 BYTE_ARRAY dataBuffer;
72 size_t index;
73 bool dataReady;
74 bool footerReached;
75 bool footerVerified;
76 std::string mode;
77 };
78}
79
80#endif //SALTPACK_ARMOREDINPUTSTREAM_H
Input Stream to parse BaseX armored content.
Definition ArmoredInputStream.h:31
ArmoredInputStream(std::istream &in, const std::string &app)
ArmoredInputStream(std::istream &in)
The saltpack library namespace.
Definition ArmoredInputStream.h:24
std::vector< BYTE > BYTE_ARRAY
Definition types.h:30