GtkWidget *extended_dive_info_widget(void) { GtkWidget *vbox, *hbox; vbox = gtk_vbox_new(FALSE, 6); gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); location = text_entry(vbox, "Location"); hbox = gtk_hbox_new(FALSE, 3); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); divemaster = text_entry(hbox, "Divemaster"); buddy = text_entry(hbox, "Buddy"); notes = text_view(vbox, "Notes"); return vbox; }
GtkWidget *extended_dive_info_frame(void) { GtkWidget *frame; GtkWidget *vbox; frame = gtk_frame_new("Extended dive info"); gtk_widget_show(frame); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); location = text_entry(vbox, "Location", FALSE); notes = text_entry(vbox, "Notes", TRUE); /* Add extended info here: name, description, yadda yadda */ update_dive_info(current_dive); return frame; }
GtkWidget *extended_dive_info_widget(void) { GtkWidget *vbox; vbox = gtk_vbox_new(FALSE, 6); location = text_entry(vbox, "Location"); gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); notes = text_view(vbox, "Notes", TRUE); /* Add extended info here: name, description, yadda yadda */ update_dive_info(current_dive); return vbox; }
std::pair<bool, std::vector<target_text> > QueryEngine::query(StringPiece source_phrase){ bool found; std::vector<target_text> translation_entries; const Entry * entry; //Convert source frase to VID std::vector<uint64_t> source_phrase_vid = getVocabIDs(source_phrase); //TOO SLOW //uint64_t key = util::MurmurHashNative(&source_phrase_vid[0], source_phrase_vid.size()); uint64_t key = 0; for (int i = 0; i < source_phrase_vid.size(); i++){ key += source_phrase_vid[i]; } found = table.Find(key, entry); if (found){ //The phrase that was searched for was found! We need to get the translation entries. //We will read the largest entry in bytes and then filter the unnecesarry with functions //from line_splitter uint64_t initial_index = entry -> GetValue(); uint64_t end_index = initial_index + largest_entry; //At the end of the file we can't readd + largest_entry cause we get a segfault. //Instead read till the end of the file. if (end_index > binary_filesize){ end_index = binary_filesize; } std::string text_entry(&binary_mmaped[initial_index] , &binary_mmaped[end_index]); StringPiece raw_string = StringPiece(text_entry); //Get only the translation entries necessary translation_entries = splitTargetLine(raw_string); } std::pair<bool, std::vector<target_text> > output (found, translation_entries); return output; }