]> git.ipfire.org Git - thirdparty/squid.git/blame - src/tests/CapturingStoreEntry.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / tests / CapturingStoreEntry.h
CommitLineData
4e0938ef 1/*
2cd0bda2 2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
4e0938ef
AJ
3 *
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.
7 */
8
a553a5a3 9#ifndef SQUID_TESTS_CAPTURINGSTORE_ENTRY_H
10#define SQUID_TESTS_CAPTURINGSTORE_ENTRY_H
11
a553a5a3 12#include "Store.h"
13
14/* class that captures various call data for test analysis */
15
16class CapturingStoreEntry : public StoreEntry
17{
a553a5a3 18 MEMPROXY_CLASS(CapturingStoreEntry);
19
741c2986 20public:
a553a5a3 21 CapturingStoreEntry() : _buffer_calls(0), _flush_calls(0) {}
22
30abd221 23 String _appended_text;
a553a5a3 24 int _buffer_calls;
25 int _flush_calls;
26
26ac0430 27 virtual void buffer() {
a553a5a3 28 _buffer_calls += 1;
29 }
30
26ac0430 31 virtual void flush() {
a553a5a3 32 _flush_calls += 1;
33 }
34
26ac0430 35 virtual void append(char const * buf, int len) {
d3da4d1a
AJ
36 if (!buf || len < 0) // old 'String' can't handle these cases
37 return;
a553a5a3 38 _appended_text.append(buf, len);
39 }
40};
41
a553a5a3 42#endif
f53969cc 43