summaryrefslogtreecommitdiff
path: root/cppe/demo/IceE/chat/LogI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/demo/IceE/chat/LogI.cpp')
-rw-r--r--cppe/demo/IceE/chat/LogI.cpp94
1 files changed, 0 insertions, 94 deletions
diff --git a/cppe/demo/IceE/chat/LogI.cpp b/cppe/demo/IceE/chat/LogI.cpp
deleted file mode 100644
index 1535ecd839c..00000000000
--- a/cppe/demo/IceE/chat/LogI.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice-E is licensed to you under the terms described in the
-// ICEE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#include <stdafx.h>
-#include <LogI.h>
-
-using namespace std;
-
-LogI::LogI() :
- _hwnd(0)
-{
-}
-
-void
-LogI::print(const string& msg)
-{
- string s = msg;
-
- string::size_type idx = 0;
- while((idx = s.find("\n", idx)) != string::npos)
- {
- s.replace(idx, 1, "\r\n ");
- idx += 3;
- }
-
- message(s);
-}
-
-void
-LogI::trace(const string& category, const string& msg)
-{
- string s = "[ " + category + ": " + msg + " ]";
-
- string::size_type idx = 0;
- while((idx = s.find("\n", idx)) != string::npos)
- {
- s.replace(idx, 1, "\r\n ");
- idx += 3;
- }
-
- message(s);
-}
-
-void
-LogI::warning(const string& msg)
-{
- message("warning: " + msg);
-}
-
-void
-LogI::error(const string& msg)
-{
- message("error: " + msg);
-}
-
-void
-LogI::message(const string& msg)
-{
- string line = msg + "\r\n";
- if(_hwnd)
- {
- post(line);
- }
- else
- {
- _buffer.append(line);
- }
-}
-
-void
-LogI::setHandle(HWND hwnd)
-{
- _hwnd = hwnd;
- if(_hwnd != 0 && !_buffer.empty())
- {
- post(_buffer);
- _buffer.clear();
- }
-}
-
-void
-LogI::post(const string& data)
-{
- assert(_hwnd != 0);
- char* text = new char[data.size()+1];
- strcpy_s(text, data.size()+1, data.c_str());
- ::PostMessage(_hwnd, WM_USER, (WPARAM)FALSE, (LPARAM)text);
-}