Changeset 803 in dev for branches/egtra/ab5.0/abdev/ab_common
- Timestamp:
- Feb 11, 2011, 10:05:14 PM (14 years ago)
- Location:
- branches/egtra/ab5.0/abdev/ab_common/src/Lexical
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/egtra/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
r750 r803 777 777 778 778 std::vector<const CClass *> classes; 779 const CClass *pClass = GetHashArrayElement( symbol.GetName().c_str() );780 while( pClass )781 {782 if( pClass->IsEqualSymbol( symbol.GetNamespaceScopes(), symbol.GetName() ) ){779 foreach (auto pClass, GetHashArrayElement(symbol.GetName())) 780 { 781 if ( pClass->IsEqualSymbol(symbol.GetNamespaceScopes(), symbol.GetName())) 782 { 783 783 //名前空間とクラス名が一致した 784 784 classes.push_back( pClass ); 785 785 } 786 pClass = pClass->GetChainNext();787 786 } 788 787 if( classes.size() > 0 ) 789 788 { 790 789 // 複数の名前空間の中に同一のクラス名が存在する場合があるので、アクセス可能で尚且つ階層が一番深いものをチョイスする 791 pClass = classes.front();790 auto pClass = classes.front(); 792 791 793 792 foreach( const CClass *pTempClass, classes ) -
branches/egtra/ab5.0/abdev/ab_common/src/Lexical/Const.cpp
r700 r803 29 29 CConst *Consts::GetObjectPtr( const Symbol &symbol ) 30 30 { 31 CConst *pConst = GetHashArrayElement( symbol.GetName().c_str() ); 32 while( pConst ) 33 { 34 if( pConst->IsEqualSymbol( symbol ) ) 35 { 36 break; 37 } 38 pConst = pConst->GetChainNext(); 39 } 40 41 return pConst; 31 auto c = GetHashArrayElement(symbol.GetName()); 32 auto it = std::find_if(c.begin(), c.end(), 33 [&](CConst* t) {return t->IsEqualSymbol(symbol);}); 34 return it != c.end() 35 ? *it 36 : nullptr; 42 37 } 43 38 … … 131 126 ConstMacro *ConstMacros::Find( const Symbol &symbol ) 132 127 { 133 ConstMacro *pConstMacro = GetHashArrayElement( symbol.GetName().c_str() ); 134 while( pConstMacro ) 135 { 136 if( pConstMacro->IsEqualSymbol( symbol ) ) 137 { 138 break; 139 } 140 pConstMacro = pConstMacro->GetChainNext(); 141 } 142 143 return pConstMacro; 128 auto c = GetHashArrayElement(symbol.GetName()); 129 auto it = std::find_if(c.begin(), c.end(), 130 [&](ConstMacro* t) {return t->IsEqualSymbol(symbol);}); 131 return it != c.end() 132 ? *it 133 : nullptr; 144 134 } -
branches/egtra/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp
r750 r803 46 46 47 47 // 関数・メソッド 48 meta.GetUserProcs().Iterator_Reset(); 49 while( meta.GetUserProcs().Iterator_HasNext() ) 50 { 51 UserProc *pUserProc = meta.GetUserProcs().Iterator_GetNext(); 48 foreach (auto pUserProc, meta.GetUserProcs()) 49 { 52 50 if( pUserProc->IsExternal() ) 53 51 { … … 65 63 66 64 // DLL関数 67 meta.GetDllProcs().Iterator_Reset(); 68 while( meta.GetDllProcs().Iterator_HasNext() ) 69 { 70 DllProc *pDllProc = meta.GetDllProcs().Iterator_GetNext(); 65 foreach (auto pDllProc, meta.GetDllProcs()) 66 { 71 67 if( pDllProc->IsExternal() ) 72 68 { … … 81 77 82 78 // クラス 83 meta.GetClasses().Iterator_Reset(); 84 while( meta.GetClasses().Iterator_HasNext() ) 85 { 86 CClass *pClass = meta.GetClasses().Iterator_GetNext(); 79 foreach (auto pClass, meta.GetClasses()) 80 { 87 81 if( pClass->IsExternal() ) 88 82 { … … 132 126 133 127 // グローバル定数 134 meta.GetGlobalConsts().Iterator_Reset(); 135 while( meta.GetGlobalConsts().Iterator_HasNext() ) 136 { 137 CConst *pConst = meta.GetGlobalConsts().Iterator_GetNext(); 128 foreach (auto pConst, meta.GetGlobalConsts()) 129 { 138 130 if( pConst->IsExternal() ) 139 131 { … … 148 140 149 141 // グローバル定数マクロ 150 meta.GetGlobalConstMacros().Iterator_Reset(); 151 while( meta.GetGlobalConstMacros().Iterator_HasNext() ) 152 { 153 ConstMacro *pConstMacro = meta.GetGlobalConstMacros().Iterator_GetNext(); 142 foreach (auto pConstMacro, meta.GetGlobalConstMacros()) 143 { 154 144 if( pConstMacro->IsExternal() ) 155 145 { … … 200 190 201 191 // デリゲート 202 meta.GetDelegates().Iterator_Reset(); 203 while( meta.GetDelegates().Iterator_HasNext() ) 204 { 205 Delegate *pDelegate = meta.GetDelegates().Iterator_GetNext(); 192 foreach (auto pDelegate, meta.GetDelegates()) 193 { 206 194 if( pDelegate->IsExternal() ) 207 195 { … … 218 206 const ::Delegate &Meta::ToDelegate( const CClass &_class ) 219 207 { 220 const ::Delegate *dg = this->GetDelegates().GetHashArrayElement( _class.GetName().c_str());221 while( dg)222 { 223 if( dg->IsEqualSymbol( _class.GetNamespaceScopes(), _class.GetName() ) ){208 auto dg = this->GetDelegates().GetHashArrayElement(_class.GetName()); 209 foreach (auto t, dg) 210 { 211 if( t->IsEqualSymbol( _class.GetNamespaceScopes(), _class.GetName() ) ){ 224 212 //名前空間とクラス名が一致した 225 return *dg; 226 } 227 dg = dg->GetChainNext(); 228 } 229 230 throw; 213 return *t; 214 } 215 } 216 217 throw std::runtime_error("Meta::ToDelegate"); 231 218 } 232 219 … … 256 243 { 257 244 // 関数・メソッド 258 this->GetUserProcs().Iterator_Init(); 259 this->GetUserProcs().Iterator_Reset(); 260 while( this->GetUserProcs().Iterator_HasNext() ) 261 { 262 UserProc *pUserProc = this->GetUserProcs().Iterator_GetNext(); 245 foreach (auto pUserProc, this->GetUserProcs()) 246 { 263 247 pUserProc->Resolve( resolver, resolveErrors ); 264 248 } 265 249 266 250 // DLL関数 267 this->GetDllProcs().Iterator_Init(); 268 this->GetDllProcs().Iterator_Reset(); 269 while( this->GetDllProcs().Iterator_HasNext() ) 270 { 271 DllProc *pDllProc = this->GetDllProcs().Iterator_GetNext(); 251 foreach (auto pDllProc, this->GetDllProcs()) 252 { 272 253 pDllProc->Resolve( resolver, resolveErrors ); 273 254 } 274 255 275 256 // クラス 276 this->GetClasses().Iterator_Init(); 277 this->GetClasses().Iterator_Reset(); 278 while( this->GetClasses().Iterator_HasNext() ) 279 { 280 CClass *pClass = this->GetClasses().Iterator_GetNext(); 257 foreach (auto pClass, this->GetClasses()) 258 { 281 259 pClass->Resolve( resolver, resolveErrors ); 282 260 } … … 289 267 290 268 // グローバル定数 291 this->GetGlobalConsts().Iterator_Init(); 292 this->GetGlobalConsts().Iterator_Reset(); 293 while( this->GetGlobalConsts().Iterator_HasNext() ) 294 { 295 CConst *pConst = this->GetGlobalConsts().Iterator_GetNext(); 269 foreach (auto pConst, this->GetGlobalConsts()) 270 { 296 271 pConst->Resolve( resolver, resolveErrors ); 297 272 } 298 273 299 274 // グローバル定数マクロ 300 this->GetGlobalConstMacros().Iterator_Init(); 301 this->GetGlobalConstMacros().Iterator_Reset(); 302 while( this->GetGlobalConstMacros().Iterator_HasNext() ) 303 { 304 ConstMacro *pConstMacro = this->GetGlobalConstMacros().Iterator_GetNext(); 275 foreach (auto pConstMacro, this->GetGlobalConstMacros()) 276 { 305 277 pConstMacro->Resolve( resolver, resolveErrors ); 306 278 } … … 325 297 326 298 // デリゲート 327 this->GetDelegates().Iterator_Init(); 328 this->GetDelegates().Iterator_Reset(); 329 while( this->GetDelegates().Iterator_HasNext() ) 330 { 331 Delegate *pDelegate = this->GetDelegates().Iterator_GetNext(); 299 foreach (auto pDelegate, this->GetDelegates()) 300 { 332 301 pDelegate->Resolve( resolver, resolveErrors ); 333 302 } -
branches/egtra/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp
r750 r803 243 243 244 244 // ハッシュ値を取得 245 UserProc *pUserProc = GetHashArrayElement( simpleName );246 while(pUserProc){245 foreach (auto pUserProc, GetHashArrayElement( simpleName )) 246 { 247 247 if( pUserProc->IsGlobalProcedure() ){ 248 248 if( pUserProc->IsEqualSymbol( localSymbol ) ){ … … 250 250 } 251 251 } 252 253 pUserProc=pUserProc->GetChainNext();254 252 } 255 253 }
Note:
See TracChangeset
for help on using the changeset viewer.