static void ShowTagsProperties() { TVITEM tvi; ZeroMemory(&tvi, sizeof(TVITEM)); tvi.hItem = (HTREEITEM) TreeView_GetSelection(g_hTree); tvi.mask = TVIF_PARAM; int err = TreeView_GetItem(g_hTree, &tvi); if (tvi.lParam != NULL) { TreeBuilder* builder = (TreeBuilder*) tvi.lParam; Tag* tag = builder->GetTag(); if (tag != NULL) { std::string str = "Tag Name: " + tag->getFullTag(); str += "\r\nLanguage: " + tag->getLanguage(); str += "\r\nType: " + tag->getType(); str += "\r\nFile: " + tag->getFile(); if (tag->getMemberOf().length() != 0) str += "\r\nMember of: " + tag->getMemberOf(); if (tag->getDetails().length() != 0) str += "\r\nDetails: " + tag->getDetails(); MsgBox(str.c_str()); } } }
bool TagsDatabase::ImportTags() { // Open the file tagFileInfo info; tagFile *const file = tagsOpen(_tagsFile.c_str(), &info); if (file == NULL) { MsgBox("Something went wrong opening generated tags file"); return false; } try { // First delete the old database (if any) Delete(); // Create the new database Open(); // Prepare the statement SqliteStatement stmt(this); stmt.Prepare("INSERT INTO Tags(Tag, File, Line, Pattern, Type, Language, MemberOf, MemberOfType, Inherits, Signature, Access, Implementation, ThisFileOnly, Unrecognized) VALUES (@tag, @file, @line, @pattern, @type, @language, @memberof, @memberoftype, @inherits, @signature, @access, @implementation, @thisfileonly, @unrecognized)"); // Go through the records and save them in the database Tag tag; tagEntry entry; BeginTransaction(); while (tagsNext(file, &entry) == TagSuccess) { // Put it in the array tag = entry; // Is there anything to search for? if (tag.getPattern().length() == 0 && tag.getLine() == 0) continue; // Very long search pattern in JavaScript, minimized? if (tag.getLanguage() == "JavaScript") if (tag.getPattern().length() >= MAX_PATH) continue; tag.SaveToDB(&stmt, _curDir); } stmt.Finalize(); CommitTransaction(); Close(); } catch (SqliteException e) { tagsClose(file); MsgBoxf("Something went wrong convert tags file to database!\n%s", e.what()); return false; } // Close the tags file tagsClose(file); return true; }