DEADSOFTWARE

Reader split into files
[odcread.git] / reader / readAlien.cc
1 #include "reader/reader.ih"
3 namespace odc {
5 void Reader::readAlien(Alien *alien, std::streampos down, std::streampos end) {
6 std::streampos next = down != 0 ? down : end;
7 while (d_rider.tellg() < end) {
8 if (d_rider.tellg() < next) { // for some reason, this means its a piece (unstructured)
9 size_t len = next - d_rider.tellg();
10 char *buf = new char[len];
11 d_rider.read(buf, len);
12 AlienComponent *comp = new AlienPiece(buf, len);
13 alien->getComponents().push_back(comp);
14 } else { // that means we've got a store
15 d_rider.seekg(next);
16 AlienComponent *comp = new AlienPart(readStore());
17 alien->getComponents().push_back(comp);
18 next = d_state->next > 0 ? d_state->next : end;
19 }
20 }
21 }
23 } // namespace odc