forked from bat67/python-source-code-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwriter.h
More file actions
49 lines (41 loc) · 665 Bytes
/
writer.h
File metadata and controls
49 lines (41 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __SPY_WRITER_H_
#define __SPY_WRITER_H_
#include <fstream>
using namespace std;
class Writer
{
public:
Writer()
{
}
~Writer()
{
if(m_OutFile)
{
m_OutFile << "</PycFile>" << endl;
m_OutFile.close();
}
}
public:
template<typename T>
void Write(T value, bool newLine = true)
{
m_OutFile << value;
if(newLine)
{
m_OutFile << "\n";
}
}
void open(const char* pycFileName) {
string name = pycFileName;
size_t length = name.length();
name[length-3] = 'x';
name[length-2] = 'm';
name[length-1] = 'l';
m_OutFile.open(name.c_str());
m_OutFile << "<PycFile>" << endl;
}
private:
ofstream m_OutFile;
};
#endif