mummy
1.0.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
MummyGenerator.cxx
Go to the documentation of this file.
1
//----------------------------------------------------------------------------
2
//
3
// $Id: MummyGenerator.cxx 2 2007-12-17 18:15:56Z david.cole $
4
//
5
// $Author: david.cole $
6
// $Date: 2007-12-17 13:15:56 -0500 (Mon, 17 Dec 2007) $
7
// $Revision: 2 $
8
//
9
// Copyright (C) 2006-2007 Kitware, Inc.
10
//
11
//----------------------------------------------------------------------------
12
13
#include "
MummyGenerator.h
"
14
#include "
MummyLineOrientedTextFileReader.h
"
15
#include "
MummyLog.h
"
16
#include "
MummySettings.h
"
17
18
#include "cableClass.h"
19
20
#include "gxsys/RegularExpression.hxx"
21
22
23
//----------------------------------------------------------------------------
24
MummyGenerator::MummyGenerator
()
25
{
26
this->
Settings
= 0;
27
this->
TargetClass
= 0;
28
this->
HeaderFileReader
= 0;
29
}
30
31
32
//----------------------------------------------------------------------------
33
MummyGenerator::~MummyGenerator
()
34
{
35
if
(this->
HeaderFileReader
)
36
{
37
delete
this->
HeaderFileReader
;
38
this->
HeaderFileReader
= 0;
39
}
40
}
41
42
43
//----------------------------------------------------------------------------
44
MummySettings
*
MummyGenerator::GetSettings
()
45
{
46
return
this->
Settings
;
47
}
48
49
50
//----------------------------------------------------------------------------
51
void
MummyGenerator::SetSettings
(
MummySettings
* settings)
52
{
53
this->
Settings
= settings;
54
}
55
56
57
//----------------------------------------------------------------------------
58
const
cable::Class*
MummyGenerator::GetTargetClass
()
59
{
60
return
this->
TargetClass
;
61
}
62
63
64
//----------------------------------------------------------------------------
65
void
MummyGenerator::SetTargetClass
(
const
cable::Class *c)
66
{
67
this->
TargetClass
= c;
68
}
69
70
71
//----------------------------------------------------------------------------
72
bool
MummyGenerator::FundamentalTypeIsWrappable
(
const
cable::Type*)
73
{
74
return
false
;
75
}
76
77
78
//----------------------------------------------------------------------------
79
bool
MummyGenerator::TypeIsWrappable
(
const
cable::Type*)
80
{
81
return
false
;
82
}
83
84
85
//----------------------------------------------------------------------------
86
bool
MummyGenerator::FunctionTypeIsWrappable
(
const
cable::FunctionType*)
87
{
88
return
false
;
89
}
90
91
92
//----------------------------------------------------------------------------
93
bool
MummyGenerator::MethodIsWrappable
(
const
cable::Method*,
const
cable::Context::Access&)
94
{
95
return
false
;
96
}
97
98
99
//----------------------------------------------------------------------------
100
bool
MummyGenerator::ClassIsWrappable
(
const
cable::Class* c)
101
{
102
MummySettings
* settings = this->
GetSettings
();
103
if
(settings)
104
{
105
return
settings->
ClassIsWrappable
(c);
106
}
107
108
return
false
;
109
}
110
111
112
//----------------------------------------------------------------------------
113
MummyLineOrientedTextFileReader
*
MummyGenerator::GetHeaderFileReader
(
const
cable::Class* c)
114
{
115
if
(0 == this->
HeaderFileReader
)
116
{
117
this->
HeaderFileReader
=
new
MummyLineOrientedTextFileReader
;
118
119
MummySettings
* settings = this->
GetSettings
();
120
if
(settings)
121
{
122
ClassWrappingSettings
cws;
123
124
if
(settings->
FindClassWrappingSettings
(
GetFullyQualifiedNameForCPlusPlus
(c).c_str(), &cws))
125
{
126
this->
HeaderFileReader
->
SetExcludeMarkedLines
(cws.
excludeMarkedLines
);
127
this->
HeaderFileReader
->
SetBeginExcludeRegex
(cws.
beginExcludeRegex
);
128
this->
HeaderFileReader
->
SetEndExcludeRegex
(cws.
endExcludeRegex
);
129
}
130
else
131
{
132
LogError
(
me_NoClassWrappingSettings
,
133
<<
"Could not find class wrapping settings for class '"
<<
GetFullyQualifiedNameForCPlusPlus
(c).c_str() <<
"'"
);
134
}
135
}
136
137
this->
HeaderFileReader
->
SetFileName
(c->GetFile());
138
}
139
else
140
{
141
if
(this->
HeaderFileReader
->
GetFileName
() != c->GetFile())
142
{
143
LogError
(
me_InternalError
,
144
<<
"Trying to open a different file for HeaderFileReader..."
<< gxsys_stl::endl
145
<<
" class: "
<<
GetFullyQualifiedNameForCPlusPlus
(c).c_str() << gxsys_stl::endl
146
<<
" c->GetFile(): "
<< c->GetFile() << gxsys_stl::endl
147
<<
" this->HeaderFileReader->GetFileName(): "
<< this->
HeaderFileReader
->
GetFileName
() << gxsys_stl::endl
148
);
149
}
150
}
151
152
return
this->
HeaderFileReader
;
153
}
154
155
156
//----------------------------------------------------------------------------
157
void
MummyGenerator::EmitMummyVersionComments
(gxsys_ios::ostream &os,
const
char
*lineCommentString)
158
{
159
gxsys_stl::string mummy_version(this->
GetSettings
()->GetMummyVersion());
160
161
if
(!lineCommentString)
162
{
163
lineCommentString =
"//"
;
164
}
165
166
Emit
(os, lineCommentString);
167
Emit
(os,
"----------------------------------------------------------------------------\n"
);
168
Emit
(os, lineCommentString);
169
Emit
(os,
"\n"
);
170
Emit
(os, lineCommentString);
171
Emit
(os,
" This file was machine generated by:\n"
);
172
Emit
(os, lineCommentString);
173
Emit
(os,
" "
);
174
Emit
(os, mummy_version.c_str());
175
Emit
(os,
"\n"
);
176
Emit
(os, lineCommentString);
177
Emit
(os,
"\n"
);
178
Emit
(os, lineCommentString);
179
Emit
(os,
" Manual changes to this file may be overwritten by the next build.\n"
);
180
Emit
(os, lineCommentString);
181
Emit
(os,
"\n"
);
182
}
Generated on Sun Apr 28 2013 22:52:33 for mummy by
1.8.3.1