Logo
~Sockets~
~Examples~
~Contact~


Debug.h

Go to the documentation of this file.
00001 #ifndef _SOCKETS_Debug_H
00002 #define _SOCKETS_Debug_H
00003 
00004 #include "sockets-config.h"
00005 #include <string>
00006 
00007 #ifdef SOCKETS_NAMESPACE
00008 namespace SOCKETS_NAMESPACE {
00009 #endif
00010 
00011 
00012 class Debug
00013 {
00014 public:
00015         Debug(const std::string& x) : m_id(0), m_text(x) {
00016                 fprintf(stderr, "%s\n", x.c_str());
00017         }
00018         Debug(int id, const std::string& x) : m_id(id), m_text(x) {
00019                 fprintf(stderr, "%d> %s\n", m_id, x.c_str());
00020         }
00021         ~Debug() {
00022                 if (m_id)
00023                         fprintf(stderr, "%d> /%s\n", m_id, m_text.c_str());
00024                 else
00025                         fprintf(stderr, "/%s\n", m_text.c_str());
00026                 fflush(stderr);
00027         }
00028 private:
00029         int m_id;
00030         std::string m_text;
00031 };
00032 
00033 
00034 #ifdef SOCKETS_NAMESPACE
00035 } // namespace SOCKETS_NAMESPACE {
00036 #endif
00037 
00038 #endif // _SOCKETS_Debug_H
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4