aboutsummaryrefslogtreecommitdiff
path: root/src/jthread/win32
diff options
context:
space:
mode:
authorIlya Zhuravlev <zhuravlevilya@ya.ru>2014-01-12 22:07:35 +0400
committerIlya Zhuravlev <zhuravlevilya@ya.ru>2014-01-13 03:29:12 +0400
commita4c5f10ecf4fd49cfbf73580b00c0b4f12ee40cf (patch)
treee4a4b754b31211ab8a8d5c7a97ba34e90373d1d3 /src/jthread/win32
parenta358c040f2d6d1fe6825121bf8ab57ceb5865cc9 (diff)
downloadminetest-a4c5f10ecf4fd49cfbf73580b00c0b4f12ee40cf.tar.gz
minetest-a4c5f10ecf4fd49cfbf73580b00c0b4f12ee40cf.tar.bz2
minetest-a4c5f10ecf4fd49cfbf73580b00c0b4f12ee40cf.zip
Fix some errors reported by clang static analyzer.
Diffstat (limited to 'src/jthread/win32')
0 files changed, 0 insertions, 0 deletions
n119' href='#n119'>119 120 121 122 123 124 125 126 127 128 129 130 131
/*
Minetest
Copyright (C) 2015 est31 <MTest31@outlook.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef TERMINAL_CHAT_CONSOLE_H
#define TERMINAL_CHAT_CONSOLE_H

#include "chat.h"
#include "threading/thread.h"
#include "chat_interface.h"
#include "log.h"

#include <sstream>

class TermLogOutput : public ILogOutput {
public:

	void logRaw(LogLevel lev, const std::string &line)
	{
		queue.push_back(std::make_pair(lev, line));
	}

	virtual void log(LogLevel lev, const std::string &combined,
		const std::string &time, const std::string &thread_name,
		const std::string &payload_text)
	{
		std::ostringstream os(std::ios_base::binary);
		os << time << ": [" << thread_name << "] " << payload_text;

		queue.push_back(std::make_pair(lev, os.str()));
	}

	MutexedQueue<std::pair<LogLevel, std::string> > queue;
};

class TerminalChatConsole : public Thread {
public:

	TerminalChatConsole() :
		Thread("TerminalThread"),
		m_log_level(LL_ACTION),
		m_utf8_bytes_to_wait(0),
		m_kill_requested(NULL),
		m_esc_mode(false),
		m_game_time(0),
		m_time_of_day(0)
	{}

	void setup(
		ChatInterface *iface,
		bool *kill_requested,
		const std::string &nick)
	{
		m_nick = nick;
		m_kill_requested = kill_requested;
		m_chat_interface = iface;
	}

	virtual void *run();

	// Highly required!