Subversion Repositories spk

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
8 cycrow 3
#include "../Utils/StringList.h"
1 cycrow 4
#include <vector>
8 cycrow 5
#include <stdarg.h>
1 cycrow 6
 
8 cycrow 7
 
1 cycrow 8
typedef struct {
8 cycrow 9
	Utils::String	sText;
1 cycrow 10
} SLog;
11
 
7 cycrow 12
class SPKEXPORT CLog
1 cycrow 13
{
14
public:
7 cycrow 15
	typedef std::vector<SLog *> LogList;
16
	typedef LogList::iterator   LogListItr;
17
 
18
protected:
19
	// private constructor
20
	CLog(void);
21
	virtual ~CLog(void);
22
 
23
private:
24
	LogList	m_lLogs;
25
 
26
public:
1 cycrow 27
	static CLog *m_pInstance;
28
	static CLog *create();
29
	static void release();
30
 
8 cycrow 31
	static void log(const Utils::String &sLogText);
7 cycrow 32
	static void logf(const char *sLogText, ...);
8 cycrow 33
	void _log(const Utils::String &sLogText);
7 cycrow 34
	void _logf(const char *sLogText, ...);
1 cycrow 35
 
8 cycrow 36
	virtual void displayLog(const Utils::String &sLogText) const;
1 cycrow 37
 
7 cycrow 38
	void clear();
39
	SLog *firstLog();
1 cycrow 40
};
7 cycrow 41
 
42
//TODO: move this
43
class SPKEXPORT CConsoleLog : public CLog 
44
{
45
public:
46
	static CLog *create()
47
	{
48
		if ( !CLog::m_pInstance ) {
49
			CLog::m_pInstance = new CConsoleLog();
50
		}
51
		return CLog::m_pInstance;
52
	}
53
 
54
	virtual ~CConsoleLog(void)
55
	{
56
	}
8 cycrow 57
	virtual void displayLog(const Utils::String &sLogText) const
7 cycrow 58
	{
8 cycrow 59
		printf("%s\n", sLogText.c_str());
7 cycrow 60
	}
61
};