File: debug.h

package info (click to toggle)
sms-pl 2.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 376 kB
  • ctags: 355
  • sloc: cpp: 2,618; perl: 109; makefile: 103; sh: 26
file content (34 lines) | stat: -rw-r--r-- 624 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef __debug_h
#define __debug_h

#include <iostream>
#include <string>

/*
class Log
{
	ostream &os;
	bool enabled;
public:
	Log(ostream &os) : os(os), enabled(true) {};
	void Enable(bool state) { enabled = state; };
	Log &operator<<(const std::string &msg) {
		if (enabled) os << msg << std::endl;
		return *this;
	};
};
*/
class Exception
{
      std::string what;
public:
      Exception(const std::string &str) : what(str) {};
      const std::string &Info() const { return what; };

      friend std::ostream& operator<<(std::ostream &os, Exception &e) {
	      os << e.Info();
	      return os;
      }
};

#endif