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