1 | #include "stdafx.h"
|
---|
2 |
|
---|
3 | #include <TypeDef.h>
|
---|
4 | #include <Compiler.h>
|
---|
5 |
|
---|
6 | TypeDef::TypeDef( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, const Type &baseType )
|
---|
7 | : Symbol( namespaceScopes, name )
|
---|
8 | , baseName( baseName )
|
---|
9 | , baseType( baseType )
|
---|
10 | {
|
---|
11 | }
|
---|
12 | /*
|
---|
13 | bool TypeDef::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const std::string &name ) const
|
---|
14 | {
|
---|
15 | if( GetName() != name ){
|
---|
16 | return false;
|
---|
17 | }
|
---|
18 | return compiler.GetNamespaceSupporter().IsSameAreaNamespace( this->namespaceScopes, namespaceScopes );
|
---|
19 | }
|
---|
20 | bool TypeDef::IsEqualSymbol( const std::string &fullName ) const
|
---|
21 | {
|
---|
22 | char AreaName[VN_SIZE] = ""; //オブジェクト変数
|
---|
23 | char NestName[VN_SIZE] = ""; //入れ子メンバ
|
---|
24 | bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
|
---|
25 |
|
---|
26 | if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){
|
---|
27 | return true;
|
---|
28 | }
|
---|
29 |
|
---|
30 | if( isNest ){
|
---|
31 | // 静的メンバを考慮
|
---|
32 |
|
---|
33 | char AreaName2[VN_SIZE] = ""; //オブジェクト変数
|
---|
34 | char NestName2[VN_SIZE] = ""; //入れ子メンバ
|
---|
35 | bool isNest = SplitMemberName( AreaName, AreaName2, NestName2 );
|
---|
36 | lstrcat( NestName2, "." );
|
---|
37 | lstrcat( NestName2, NestName );
|
---|
38 |
|
---|
39 | return IsEqualSymbol( NamespaceScopes( AreaName2 ), NestName2 );
|
---|
40 | }
|
---|
41 |
|
---|
42 | return false;
|
---|
43 | }*/
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 | TypeDefCollection::TypeDefCollection(){
|
---|
48 | }
|
---|
49 | TypeDefCollection::~TypeDefCollection(){
|
---|
50 | }
|
---|
51 | void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine ){
|
---|
52 | TypeDef typeDef( namespaceScopes, name, baseName, nowLine );
|
---|
53 | this->push_back( typeDef );
|
---|
54 | }
|
---|
55 |
|
---|
56 | int TypeDefCollection::GetIndex( const NamespaceScopes &namespaceScopes, const std::string &name ) const{
|
---|
57 | int max = (int)(*this).size();
|
---|
58 | for( int i=0; i<max; i++ ){
|
---|
59 | if( (*this)[i].IsEqualSymbol( namespaceScopes, name ) ){
|
---|
60 | return i;
|
---|
61 | }
|
---|
62 | }
|
---|
63 | return -1;
|
---|
64 | }
|
---|
65 | int TypeDefCollection::GetIndex( const std::string &fullName ) const{
|
---|
66 | char AreaName[VN_SIZE] = ""; //オブジェクト変数
|
---|
67 | char NestName[VN_SIZE] = ""; //入れ子メンバ
|
---|
68 | bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
|
---|
69 |
|
---|
70 | return GetIndex( NamespaceScopes( AreaName ), NestName );
|
---|
71 | }
|
---|