]> git.cworth.org Git - apitrace/blob - log.hpp
Fix the font family.
[apitrace] / log.hpp
1 /****************************************************************************
2  *
3  * Copyright 2008 Jose Fonseca
4  *
5  * This program is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published
7  * by the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  ****************************************************************************/
19
20 #ifndef _LOG_HPP_
21 #define _LOG_HPP_
22
23 #include <windows.h>
24 #include <tchar.h>
25 #include <stdio.h>
26
27
28 class File
29 {
30 public:
31     File(const TCHAR *szName, const TCHAR *szExtension);
32     ~File();
33
34     void Open(const TCHAR *szName, const TCHAR *szExtension);
35     void ReOpen(void);
36     void Close(void);
37     void Write(const char *szText);
38     
39 private:
40     HANDLE m_hFile;
41     TCHAR szFileName[MAX_PATH];
42 };
43
44
45 class Log : public File
46 {
47 public:
48     Log(const TCHAR *szName);
49     ~Log();
50     
51     void NewLine(void);
52     void Tag(const char *name);
53     void BeginTag(const char *name);
54     void BeginTag(const char *name, 
55                   const char *attr1, const char *value1);
56     void BeginTag(const char *name, 
57                   const char *attr1, const char *value1,
58                   const char *attr2, const char *value2);
59     void EndTag(const char *name);
60     void Text(const char *text);
61     void TextF(const char *format, ...);
62     void BeginCall(const char *function);
63     void EndCall(void);
64     void BeginParam(const char *name, const char *type);
65     void EndParam(void);
66     void BeginReturn(const char *type);
67     void EndReturn(void);
68     
69 protected:
70     void Escape(const char *s);
71 };
72
73
74 extern Log * g_pLog;
75
76
77 #endif /* _LOG_HPP_ */