debug.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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 
9 /* DEBUG: section 19 Store Memory Primitives */
10 
11 #include "squid.h"
12 #include "Debug.h"
13 #include "mem_node.h"
14 #include "stmem.h"
15 
17 {
18 public:
19  std::ostream &serialise(std::ostream &);
20  int getAnInt() const;
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 
36 int
38 {
39  return 5;
40 }
41 
42 char const *
44 {
45  return "ThisIsAStreamTest";
46 }
47 
48 int
49 main(int, char *[])
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)
57  debugs(1,9,"this won't compile if the macro is broken.");
58  else
59  debugs(1, DBG_IMPORTANT,"bar");
60  StreamTest aStreamObject;
61  StreamTest *streamPointer (&aStreamObject);
62  debugs(1, DBG_IMPORTANT,aStreamObject);
63  debugs(1, DBG_IMPORTANT,streamPointer->getAnInt() << " " << aStreamObject.getACString());
64  return EXIT_SUCCESS;
65 }
66 
std::ostream & serialise(std::ostream &)
Definition: debug.cc:30
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
#define DBG_IMPORTANT
Definition: Debug.h:45
std::ostream & operator<<(std::ostream &aStream, StreamTest &anObject)
Definition: debug.cc:24
char const * getACString() const
Definition: debug.cc:43
int getAnInt() const
Definition: debug.cc:37
static int Levels[MAX_DEBUG_SECTIONS]
Definition: Debug.h:81
int main(int, char *[])
Definition: debug.cc:49

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors