virtual void vSave(unsigned int* pKey, unsigned int keynum, GPContents* c) { GPASSERT(NULL!=c); GPASSERT(keynum>0); for (int i=0; i<c->size(); ++i) { auto type = c->getType(i); std::string path = generatePath(pKey, keynum, type->name()); GPPtr<GPWStream> writeStream = GPStreamFactory::NewWStream(path.c_str()); type->vSave(c->get(i), writeStream.get()); } }
void interp(void) { char line[256]; char *p; while(1) { putchar('>'); putchar(' '); flushall(); gets(line); // p points to next word after verb on command line p = line; while (*p && *p!=' ') p++; if (!*p) p = 0; else { while(*p && *p==' ') p++; } switch(toupper(line[0])) { case 'B': vVerbose(p); break; case 'C': vCreate(p); break; case 'D': vDisplay(p); break; case 'F': vFind(p); break; case 'H': default: vHelp(line); break; case 'I': vInstall(p); break; case 'K': vPack(p); break; case 'P': vPretend(p); break; case 'R': vRemove(p); break; case 'S': vSave(p); break; case 'T': vTest(p); break; case 'U': vUpdate(p); break; case 'V': vVerify(p); break; case 'Q': case 'X': vSave(0); return; } // switch } // while assert(0); return; // shouldn't get here } // interp