blob: 46fd9b9ef3a9572de0a408f2546182cce330cc68 (
plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// file : CCF/IDL2/SemanticGraph/Struct.cpp
// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
// cvs-id : $Id$
#include "CCF/IDL2/SemanticGraph/Struct.hpp"
#include "CCF/IDL2/SemanticGraph/Member.hpp"
namespace CCF
{
namespace IDL2
{
namespace SemanticGraph
{
using Introspection::TypeInfo;
using Introspection::Access;
namespace
{
TypeInfo
struct_init_ ()
{
TypeInfo ti (typeid (Struct));
ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
return ti;
}
TypeInfo struct_ (struct_init_ ());
}
TypeInfo const& Struct::
static_type_info () { return struct_; }
bool Struct::
complete () const
{
if (defined ())
{
CompilerElements::Context& ctx (
const_cast<CompilerElements::Context&> (context ()));
if (ctx.count ("struct-complete-test"))
return true;
ctx.set ("struct-complete-test", true);
bool c (true);
for (Scope::NamesIterator i (names_begin ());
c && i != names_end ();
++i)
{
Member const& m (dynamic_cast<Member&> ((*i)->named ()));
Type const& t (m.belongs ().type ());
if (!t.complete ())
c = false;
}
ctx.remove ("struct-complete-test");
return c;
}
return false;
}
}
}
}
|