Changeset 190 in dev for trunk/jenga/src/smoothie/Class.cpp
- Timestamp:
- Jun 26, 2007, 12:05:36 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jenga/src/smoothie/Class.cpp
r186 r190 310 310 311 311 312 int Classes:: hash(const char *name) const{312 int Classes::GetHashCode(const char *name) const{ 313 313 int key; 314 314 … … 377 377 { 378 378 int key; 379 key= hash(name.c_str());379 key=GetHashCode(name.c_str()); 380 380 381 381 if( namespaceScopes.size() == 0 && name == "Object" ){ … … 420 420 } 421 421 422 bool Classes::Insert( CClass *pClass ) 423 { 424 ///////////////////////////////// 425 // ハッシュデータに追加 426 ///////////////////////////////// 427 428 int key; 429 key=GetHashCode( pClass->GetName().c_str() ); 430 431 if(pobj_ClassHash[key]){ 432 CClass *pobj_c2; 433 pobj_c2=pobj_ClassHash[key]; 434 while(1){ 435 if( pobj_c2->IsEqualSymbol( *pClass ) ){ 436 //名前空間及びクラス名が重複した場合 437 SmoothieException::Throw(15,pClass->GetName()); 438 return false; 439 } 440 441 if(pobj_c2->pobj_NextClass==0) break; 442 pobj_c2=pobj_c2->pobj_NextClass; 443 } 444 pobj_c2->pobj_NextClass=pClass; 445 } 446 else{ 447 pobj_ClassHash[key]=pClass; 448 } 449 return true; 450 } 422 451 CClass *Classes::Add( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name,int nowLine){ 423 452 ////////////////////////////////////////////////////////////////////////// … … 426 455 ////////////////////////////////////////////////////////////////////////// 427 456 428 CClass *p obj_c= Create(namespaceScopes, importedNamespaces, name);457 CClass *pClass = Create(namespaceScopes, importedNamespaces, name); 429 458 430 459 if(lstrcmp(name,"String")==0){ 431 460 //Stringクラス 432 pStringClass=p obj_c;461 pStringClass=pClass; 433 462 } 434 463 if( lstrcmp( name, "Object" ) == 0 ){ 435 pObjectClass = pobj_c; 436 } 437 438 439 ///////////////////////////////// 440 // ハッシュデータに追加 441 ///////////////////////////////// 442 443 int key; 444 key=hash(name); 445 446 if(pobj_ClassHash[key]){ 447 CClass *pobj_c2; 448 pobj_c2=pobj_ClassHash[key]; 449 while(1){ 450 if( pobj_c2->IsEqualSymbol( namespaceScopes, name ) ){ 451 //名前空間及びクラス名が重複した場合 452 SmoothieException::Throw(15,name,nowLine); 453 return 0; 454 } 455 456 if(pobj_c2->pobj_NextClass==0) break; 457 pobj_c2=pobj_c2->pobj_NextClass; 458 } 459 pobj_c2->pobj_NextClass=pobj_c; 460 } 461 else{ 462 pobj_ClassHash[key]=pobj_c; 463 } 464 465 return pobj_c; 464 pObjectClass = pClass; 465 } 466 467 if( !Insert( pClass ) ) 468 { 469 return NULL; 470 } 471 472 return pClass; 466 473 } 467 474 … … 517 524 ////////////////////// 518 525 519 void Classes::Iterator_Init(void){ 526 void Classes::Iterator_Init() const 527 { 520 528 if(ppobj_IteClass) free(ppobj_IteClass); 521 529 … … 540 548 } 541 549 } 542 void Classes::Iterator_Reset(void){ 550 void Classes::Iterator_Reset() const 551 { 543 552 iIteNextNum = 0; 544 553 } 545 BOOL Classes::Iterator_HasNext(void){ 554 BOOL Classes::Iterator_HasNext() const 555 { 546 556 if(iIteNextNum<iIteMaxNum) return 1; 547 557 return 0; 548 558 } 549 CClass *Classes::Iterator_GetNext(void){ 559 CClass *Classes::Iterator_GetNext() const 560 { 550 561 CClass *pobj_c; 551 562 pobj_c=ppobj_IteClass[iIteNextNum]; … … 553 564 return pobj_c; 554 565 } 555 int Classes::Iterator_GetMaxCount(void){ 566 int Classes::Iterator_GetMaxCount() const 567 { 556 568 return iIteMaxNum; 557 569 }
Note:
See TracChangeset
for help on using the changeset viewer.