Changeset 256 in Sophya for trunk/SophyaLib/BaseTools/ppersist.cc
- Timestamp:
- Apr 23, 1999, 2:38:18 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/ppersist.cc
r251 r256 150 150 s.GetRawByte(ppstype); 151 151 if (ppstype != PInPersist::PPS_OBJECT) { 152 throw TypeMismatchExc("PPersist::Read : not an object in flow");152 throw FileFormatExc("PPersist::Read : not an object in flow"); 153 153 } 154 154 … … 157 157 s.GetRawU8(classId); 158 158 if (classId != PIOPersist::Hash(typeid(*this).name())) { 159 throw TypeMismatchExc("PPersist::Read : not the same object type");159 throw FileFormatExc("PPersist::Read : not the same object type"); 160 160 } 161 161 … … 302 302 303 303 304 int 305 PInPersist::NbTags() 306 { 307 return tags.size(); 308 } 309 304 310 bool 305 311 PInPersist::GotoTag(string const& name) … … 312 318 return(true); 313 319 } 320 321 bool 322 PInPersist::GotoTagNum(int itag) 323 { 324 if (itag<0 || itag >= tags.size()) return false; 325 map<string, int_8>::iterator i = tags.begin(); 326 for (int j=0; j<itag; j++) i++; 327 s->seekg((*i).second); 328 return(true); 329 } 330 314 331 315 332 //++ … … 419 436 GetRawByte(ppstype); 420 437 if (ppstype != PPS_SIMPLE + datasz) 421 throw TypeMismatchExc("PInPersist::CheckTag bad type in ppersist file");438 throw FileFormatExc("PInPersist::CheckTag bad type in ppersist file"); 422 439 } 423 440 … … 430 447 if (sz <= 0x7fff) { 431 448 if (ppstype != PPS_SIMPLE_ARRAY + datasz) 432 throw TypeMismatchExc("PInPersist::CheckTag bad type in ppersist file");449 throw FileFormatExc("PInPersist::CheckTag bad type in ppersist file"); 433 450 int_2 ff; 434 451 GetRawI2(ff); filesz=ff; 435 452 } else if (sz <= 0x7fffffff) { 436 453 if (ppstype != PPS_SIMPLE_ARRAY4 + datasz) 437 throw TypeMismatchExc("PInPersist::CheckTag bad type in ppersist file");454 throw FileFormatExc("PInPersist::CheckTag bad type in ppersist file"); 438 455 int_4 ff; 439 456 GetRawI4(ff); filesz=ff; 440 457 } else { 441 458 if (ppstype != PPS_SIMPLE_ARRAY8 + datasz) 442 throw TypeMismatchExc("PInPersist::CheckTag bad type in ppersist file");459 throw FileFormatExc("PInPersist::CheckTag bad type in ppersist file"); 443 460 uint_8 ff; 444 461 GetRawU8(ff); filesz=ff; 445 462 } 446 463 if (filesz != sz) 447 throw TypeMismatchExc("PInPersist::CheckTag bad array size in ppersist file");464 throw FileFormatExc("PInPersist::CheckTag bad array size in ppersist file"); 448 465 } 449 466 … … 646 663 GetRawByte(ppstype); 647 664 if (ppstype != PPS_LINE) 648 throw TypeMismatchExc("PInPersist::GetLine bad type in ppersist file");665 throw FileFormatExc("PInPersist::GetLine bad type in ppersist file"); 649 666 s->getline(ptr, len, '\n'); 650 667 } … … 656 673 GetRawByte(ppstype); 657 674 if (ppstype != PPS_STRING) 658 throw TypeMismatchExc("PInPersist::GetLine bad type in ppersist file");675 throw FileFormatExc("PInPersist::GetLine bad type in ppersist file"); 659 676 int_2 len; 660 677 GetRawI2(len); … … 673 690 GetRawByte(ppstype); 674 691 if (ppstype != PPS_OBJECT && ppstype != PPS_REFERENCE && ppstype != PPS_NULL) { 675 throw TypeMismatchExc("PInPersist::ReadObject : not an object in flow");692 throw FileFormatExc("PInPersist::ReadObject : not an object in flow"); 676 693 } 677 694
Note:
See TracChangeset
for help on using the changeset viewer.