]>
Commit | Line | Data |
---|---|---|
f95fe6ed | 1 | /* |
4e0938ef | 2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors |
26ac0430 | 3 | * |
4e0938ef AJ |
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. | |
f95fe6ed | 7 | */ |
8 | ||
4e0938ef AJ |
9 | /* DEBUG: section 19 Store Memory Primitives */ |
10 | ||
582c2af2 FC |
11 | #include "squid.h" |
12 | #include "Debug.h" | |
f95fe6ed | 13 | #include "mem_node.h" |
582c2af2 | 14 | #include "stmem.h" |
f95fe6ed | 15 | |
26ac0430 AJ |
16 | class StreamTest |
17 | { | |
18 | public: | |
f95fe6ed | 19 | std::ostream &serialise(std::ostream &); |
58c0b17d | 20 | int getAnInt() const; |
f95fe6ed | 21 | char const *getACString() const; |
22 | }; | |
23 | ||
24 | std::ostream &operator << (std::ostream &aStream, StreamTest &anObject) | |
25 | { | |
26 | return anObject.serialise(aStream); | |
27 | } | |
28 | ||
29 | std::ostream& | |
30 | StreamTest::serialise(std::ostream &aStream) | |
31 | { | |
32 | aStream << "stream test"; | |
33 | return aStream; | |
34 | } | |
35 | ||
58c0b17d | 36 | int |
f95fe6ed | 37 | StreamTest::getAnInt() const |
38 | { | |
d219c387 | 39 | return 5; |
f95fe6ed | 40 | } |
41 | ||
42 | char const * | |
43 | StreamTest::getACString() const | |
44 | { | |
45 | return "ThisIsAStreamTest"; | |
46 | } | |
47 | ||
48 | int | |
b610642c | 49 | main(int argc, char **argv) |
f95fe6ed | 50 | { |
51 | Debug::Levels[1] = 8; | |
52 | debugs (1,1,"test" << "string"); | |
53 | debugs (1,9,"dont show this" << "string"); | |
54 | debugs (1,1,"test" << "string"); | |
55 | debugs (1,1,"test" << "string"); | |
56 | if (true) | |
26ac0430 | 57 | debugs(1,9,"this won't compile if the macro is broken."); |
f95fe6ed | 58 | else |
e0236918 | 59 | debugs(1, DBG_IMPORTANT,"bar"); |
f95fe6ed | 60 | StreamTest aStreamObject; |
61 | StreamTest *streamPointer (&aStreamObject); | |
e0236918 FC |
62 | debugs(1, DBG_IMPORTANT,aStreamObject); |
63 | debugs(1, DBG_IMPORTANT,streamPointer->getAnInt() << " " << aStreamObject.getACString()); | |
f95fe6ed | 64 | return 0; |
65 | } | |
f53969cc | 66 |