AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
thriftTransport.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 standard
3 Copyright (C) 2026 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <https://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <algorithm>
23#include <cstdint>
24#include <cstring>
25#include <string>
26#include <utility>
27
28#include <thrift/transport/TVirtualTransport.h>
29
30#include "rest/client.hpp"
31#include "rest/httpError.hpp"
32#include "codec/thrift.hpp"
33
34namespace anch::rest {
35
50 class ThriftTransport: public apache::thrift::transport::TVirtualTransport<ThriftTransport> {
51
52 // Attributes +
53 private:
55 anch::rest::Client& _client;
56
58 std::string _path;
59
61 std::string _contentType;
62
64 std::string _request;
65
67 std::string _response;
68
70 std::size_t _position;
71 // Attributes -
72
73 // Constructors +
74 public:
83 // Constructors -
84
85 // Methods +
86 public:
92 virtual bool isOpen() const override;
93
97 virtual void open() override;
98
102 virtual void close() override;
103
112 uint32_t read(uint8_t* buffer, uint32_t length);
113
120 void write(const uint8_t* buffer, uint32_t length);
121
128 virtual void flush() override;
129 // Methods -
130
131 };
132
133}
134
135#include "rest/impl/thriftTransport.hpp"
Definition client.hpp:303
ThriftTransport(anch::rest::Client &client, std::string path, anch::codec::ThriftProtocol protocol=anch::codec::ThriftProtocol::BINARY)
void write(const uint8_t *buffer, uint32_t length)
virtual void close() override
virtual void flush() override
virtual void open() override
virtual bool isOpen() const override
uint32_t read(uint8_t *buffer, uint32_t length)
ThriftProtocol
Definition thrift.hpp:61
@ BINARY
Definition thrift.hpp:63
AnCH REST library namespace.
Definition auth.hpp:29