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; }
/** Initialize attributes. */ Instance::Instance(const Tag &tag) : Node(tag) { Tag linkTag; // Name of group tag.get("of", of, true, true); if (!tag.get("selectable", selectable, false)) { selectable = false; } // Exclusions tag.get("only", only, false); // Create link linkTag.setName("link"); linkTag.setFilename(tag.getFilename()); linkTag.setLine(tag.getLine()); linkTag["to"] = of; link = new Link(linkTag); addChild(link); }