| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#ifndef TEST_STD_INPUT_OUTPUT_SYNCSTREAM_SYNCBUF_SYNCSTREAM_SYNCBUF_MEMBERS_H |
| 10 |
#define TEST_STD_INPUT_OUTPUT_SYNCSTREAM_SYNCBUF_SYNCSTREAM_SYNCBUF_MEMBERS_H |
| 11 |
|
| 12 |
#include <streambuf> |
| 13 |
#include <syncstream> |
| 14 |
|
| 15 |
template <class T> |
| 16 |
class test_buf : public std::basic_streambuf<T> { |
| 17 |
public: |
| 18 |
int id; |
| 19 |
|
| 20 |
test_buf(int _id = 0) : id(_id) {} |
| 21 |
|
| 22 |
T* _pptr() { return this->pptr(); } |
| 23 |
}; |
| 24 |
|
| 25 |
template <class T, class Alloc = std::allocator<T>> |
| 26 |
class test_syncbuf : public std::basic_syncbuf<T, std::char_traits<T>, Alloc> { |
| 27 |
public: |
| 28 |
test_syncbuf(test_buf<T>* buf, Alloc alloc) : std::basic_syncbuf<T, std::char_traits<T>, Alloc>(buf, alloc) {} |
| 29 |
|
| 30 |
void _setp(T* begin, T* end) { return this->setp(begin, end); } |
| 31 |
}; |
| 32 |
|
| 33 |
template <class T> |
| 34 |
struct test_allocator : std::allocator<T> { |
| 35 |
int id; |
| 36 |
test_allocator(int _id = 0) : id(_id) {} |
| 37 |
}; |
| 38 |
|
| 39 |
#endif // TEST_STD_INPUT_OUTPUT_SYNCSTREAM_SYNCBUF_SYNCSTREAM_SYNCBUF_MEMBERS_H |