]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/StoreIOBuffer.h
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_STOREIOBUFFER_H
10 #define SQUID_STOREIOBUFFER_H
12 /* TODO: move this and the range() method into a .cci */
20 StoreIOBuffer():length(0), offset (0), data (NULL
) {flags
.error
= 0;}
22 StoreIOBuffer(size_t aLength
, int64_t anOffset
, char *someData
) :
23 length (aLength
), offset (anOffset
), data (someData
) {
27 /* Create a StoreIOBuffer from a MemBuf and offset */
28 /* NOTE that MemBuf still "owns" the pointers, StoreIOBuffer is just borrowing them */
29 StoreIOBuffer(MemBuf
*aMemBuf
, int64_t anOffset
) :
30 length(aMemBuf
->contentSize()),
32 data(aMemBuf
->content()) {
36 StoreIOBuffer(MemBuf
*aMemBuf
, int64_t anOffset
, size_t anLength
) :
39 data(aMemBuf
->content()) {
43 Range
<int64_t> range() const {
44 return Range
<int64_t>(offset
, offset
+ length
);
48 if (fwrite(data
, length
, 1, stderr
)) {}
49 if (fwrite("\n", 1, 1, stderr
)) {}
62 operator <<(std::ostream
&os
, const StoreIOBuffer
&b
)
64 return os
<< "ioBuf(@" << b
.offset
<< ", len=" << b
.length
<< ", " <<
65 (void*)b
.data
<< (b
.flags
.error
? ", ERR" : "") << ')';
68 #endif /* SQUID_STOREIOBUFFER_H */