source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/src/TypeDef.cpp@ 542

Last change on this file since 542 was 542, checked in by dai_9181, 16 years ago

CollectTypeDefsメソッドをLexicalAnalyzerクラスに移動した。

File size: 2.1 KB
RevLine 
[206]1#include "stdafx.h"
2
[193]3#include <TypeDef.h>
4#include <Compiler.h>
5
[542]6TypeDef::TypeDef( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, const Type &baseType )
[206]7 : Symbol( namespaceScopes, name )
[193]8 , baseName( baseName )
[542]9 , baseType( baseType )
[193]10{
11}
[206]12/*
[523]13bool TypeDef::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const std::string &name ) const
[193]14{
15 if( GetName() != name ){
16 return false;
17 }
[199]18 return compiler.GetNamespaceSupporter().IsSameAreaNamespace( this->namespaceScopes, namespaceScopes );
[193]19}
[523]20bool TypeDef::IsEqualSymbol( const std::string &fullName ) const
[193]21{
22 char AreaName[VN_SIZE] = ""; //オブジェクト変数
23 char NestName[VN_SIZE] = ""; //入れ子メンバ
[206]24 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
[193]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] = ""; //入れ子メンバ
[206]35 bool isNest = SplitMemberName( AreaName, AreaName2, NestName2 );
[193]36 lstrcat( NestName2, "." );
37 lstrcat( NestName2, NestName );
38
39 return IsEqualSymbol( NamespaceScopes( AreaName2 ), NestName2 );
40 }
41
42 return false;
[206]43}*/
[193]44
45
46
47TypeDefCollection::TypeDefCollection(){
48}
49TypeDefCollection::~TypeDefCollection(){
50}
[523]51void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine ){
[193]52 TypeDef typeDef( namespaceScopes, name, baseName, nowLine );
53 this->push_back( typeDef );
54}
[542]55
[523]56int TypeDefCollection::GetIndex( const NamespaceScopes &namespaceScopes, const std::string &name ) const{
[193]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}
[523]65int TypeDefCollection::GetIndex( const std::string &fullName ) const{
[193]66 char AreaName[VN_SIZE] = ""; //オブジェクト変数
67 char NestName[VN_SIZE] = ""; //入れ子メンバ
[206]68 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
[193]69
70 return GetIndex( NamespaceScopes( AreaName ), NestName );
71}
Note: See TracBrowser for help on using the repository browser.