string Table::getNameOfSetOfInt(SetOfInt soi) { string out = ""; for(SetOfInt::iterator it = soi.begin(); it != soi.end(); ++it) { out += getNameOfItem(*it); } return out; }
void Table::writeTuple(SetOfInt ens) { //char * filename = getName(); string filename = getName(); if (filename != "") { ofstream fic; // on ouvre le fichier : app => se place a la fin de ce qui est deja ecrit //fic.open(filename, ios::app); fic.open(filename.c_str(), ios::app); if (fic == NULL) { cout << "ben c po ouvert" << endl; } fic << "<" << baliseTuple << ">" << endl; set<int> tmp = ens; set<int>::iterator itSet; //char * tmpItem; string tmpItem; // on doit �rire le NOM correspondant au num�o => mapping // pour cela on utilise la fonction getNameOfItem for (itSet = tmp.begin() ; itSet != tmp.end() ; itSet++) { tmpItem = getNameOfItem(*itSet); fic << "<" << baliseItem << ">" << tmpItem << "</" << baliseItem << ">" << endl; } fic << "</" << baliseTuple << ">" << endl; fic.close(); } }
void T64Archive::dumpDirectory() { Archive::dumpDirectory(); for (unsigned i = 0; i < getNumberOfItems(); i++) { fprintf(stderr, " Item %2d: %s (%d bytes, load address: %d)\n", i, getNameOfItem(i), getSizeOfItem(i), getDestinationAddrOfItem(i)); } }
int Archive::getItemWithName(char *pattern) { int i, j, length, pattern_length, no_of_items = getNumberOfItems(); const char *name; assert(pattern != NULL); pattern_length = strlen(pattern); // Iterate through all directory items for (i = 0; i < no_of_items; i++) { name = getNameOfItem(i); length = strlen(name); // Pattern can't match if it has more characters if (length < pattern_length) { continue; } // Iterate through all characters of the search pattern for (j = 0; j < pattern_length; j++) { // '*' matches everything if (pattern[j] == '*') return i; // '?' matches an arbitrary character if (pattern[j] == '?') continue; if (pattern[j] != name[j]) break; } if (j == length) { return i; } } return -1; }
void Archive::dumpDirectory() { msg("Archive: %s\n", getName()); msg("-------\n"); msg(" Path: %s\n", getPath()); msg(" Items: %d\n", getNumberOfItems()); for (unsigned i = 0; i < getNumberOfItems(); i++) { msg(" Item %2d: %s (%d bytes, load address: %d)\n", i, getNameOfItem(i), getSizeOfItem(i), getDestinationAddrOfItem(i)); msg(" "); selectItem(i); for (unsigned j = 0; j < 8; j++) { int byte = getByte(); if (byte != -1) msg("%02X ", byte); } msg("\n"); } }