void moth_gui::show_index() { stop_show_search_res(); if (!has_index()) { std::string info("\"This book has no index\""); moth_dialog dialog; dialog.info(info); return; } moth_index_gui *gui = new moth_index_gui; int stat = gui->show(this); if (stat != SUCCESS) std::cerr << "index gui failed" << std::endl; delete gui; }
void Table::deleterow( streampos pos, string tuple, string col ) { //cout << col << endl; ifstream ifs( get_path( ) ); string temp_file; if( !ifs.is_open() ) { cerr << "ERROR opening file in Executor::deleterow(). " << endl; return; } string s; string line; while ( ifs.tellg() != pos ) { getline( ifs, line ); temp_file.append( line + string( "\n") ); } getline( ifs, line ); //temp_file.append( line + string( "\n") ); //cout << line << endl; // update btree index if( has_index( col ) ) { map<string, BTree*>::iterator map_itr = keys.find( col ); BTree * btree = map_itr->second; //construct tuple int type; string entry( get_entry( line, get_col_pos( col ) ) ); if( is_number( entry ) ) btree->remove( Tuple ( atoi( entry.c_str() ), pos ) ); else btree->remove( Tuple ( entry.c_str(), pos ) ); dump_tree( col, btree->get_first() ); } line[0] = '@'; temp_file.append( line + string( "\n") ); while ( getline( ifs, line ) ) temp_file.append( line + string( "\n") ); ifs.close(); // rewrite the whole file ofstream ofs ( get_path( ), std::ofstream::out | std::ofstream::trunc ); if( !ofs.is_open() ) { cerr << "ERROR opening out file in Executor::deleterow(). " << endl; return; } ofs << temp_file; ofs.close(); }
Index index() { CGAL_assertion(has_index()); return index_.get(); }
int index() const { assert(has_index(), "must have index");; return _value.i; }