Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 08:35:02

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements. See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership. The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License. You may obtain a copy of the License at
0009  *
0010  *   http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing,
0013  * software distributed under the License is distributed on an
0014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015  * KIND, either express or implied. See the License for the
0016  * specific language governing permissions and limitations
0017  * under the License.
0018  */
0019 
0020 #ifndef _THRIFT_ASYNC_TQIODEVICE_TRANSPORT_H_
0021 #define _THRIFT_ASYNC_TQIODEVICE_TRANSPORT_H_ 1
0022 
0023 #include <memory>
0024 
0025 #include <thrift/transport/TVirtualTransport.h>
0026 
0027 class QIODevice;
0028 
0029 namespace apache {
0030 namespace thrift {
0031 namespace transport {
0032 
0033 /**
0034  *  Transport that operates on a QIODevice (socket, file, etc).
0035  */
0036 class TQIODeviceTransport
0037     : public apache::thrift::transport::TVirtualTransport<TQIODeviceTransport> {
0038 public:
0039   explicit TQIODeviceTransport(std::shared_ptr<QIODevice> dev);
0040   ~TQIODeviceTransport() override;
0041 
0042   void open() override;
0043   bool isOpen() const override;
0044   bool peek() override;
0045   void close() override;
0046 
0047   uint32_t readAll(uint8_t* buf, uint32_t len);
0048   uint32_t read(uint8_t* buf, uint32_t len);
0049 
0050   void write(const uint8_t* buf, uint32_t len);
0051   uint32_t write_partial(const uint8_t* buf, uint32_t len);
0052 
0053   void flush() override;
0054 
0055   uint8_t* borrow(uint8_t* buf, uint32_t* len);
0056   void consume(uint32_t len);
0057 
0058 private:
0059   TQIODeviceTransport(const TQIODeviceTransport&);
0060   TQIODeviceTransport& operator=(const TQIODeviceTransport&);
0061 
0062   std::shared_ptr<QIODevice> dev_;
0063 };
0064 }
0065 }
0066 } // apache::thrift::transport
0067 
0068 #endif // #ifndef _THRIFT_ASYNC_TQIODEVICE_TRANSPORT_H_