Changeset 256 in Sophya for trunk/SophyaLib/BaseTools/ppersist.cc


Ignore:
Timestamp:
Apr 23, 1999, 2:38:18 PM (26 years ago)
Author:
ansari
Message:

reorg exc, ppersist tags...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/ppersist.cc

    r251 r256  
    150150  s.GetRawByte(ppstype);
    151151  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");
    153153  }
    154154 
     
    157157  s.GetRawU8(classId);
    158158  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");
    160160  }
    161161
     
    302302
    303303
     304int
     305PInPersist::NbTags()
     306{
     307  return tags.size();
     308}
     309
    304310bool
    305311PInPersist::GotoTag(string const& name)
     
    312318  return(true);
    313319}
     320
     321bool
     322PInPersist::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
    314331
    315332//++
     
    419436  GetRawByte(ppstype);
    420437  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");
    422439}
    423440
     
    430447  if (sz <= 0x7fff) {
    431448    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");
    433450    int_2 ff;
    434451    GetRawI2(ff); filesz=ff;
    435452  } else if (sz <= 0x7fffffff) {
    436453    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");
    438455    int_4 ff;
    439456    GetRawI4(ff); filesz=ff;
    440457  } else {
    441458    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");
    443460    uint_8 ff;
    444461    GetRawU8(ff); filesz=ff;
    445462  }
    446463  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");
    448465}
    449466
     
    646663  GetRawByte(ppstype);
    647664  if (ppstype != PPS_LINE)
    648     throw TypeMismatchExc("PInPersist::GetLine   bad type in ppersist file");
     665    throw FileFormatExc("PInPersist::GetLine   bad type in ppersist file");
    649666  s->getline(ptr, len, '\n');
    650667}
     
    656673  GetRawByte(ppstype);
    657674  if (ppstype != PPS_STRING)
    658     throw TypeMismatchExc("PInPersist::GetLine   bad type in ppersist file");
     675    throw FileFormatExc("PInPersist::GetLine   bad type in ppersist file");
    659676  int_2 len;
    660677  GetRawI2(len);
     
    673690  GetRawByte(ppstype);
    674691  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");
    676693  }
    677694
Note: See TracChangeset for help on using the changeset viewer.