/**************************************************************************** * Copyright (C) 2012-2016 Woboq GmbH * Olivier Goffart * https://woboq.com/codebrowser.html * * This file is part of the Woboq Code Browser. * * Commercial License Usage: * Licensees holding valid commercial licenses provided by Woboq may use * this file in accordance with the terms contained in a written agreement * between the licensee and Woboq. * For further information see https://woboq.com/codebrowser.html * * Alternatively, this work may be used under a Creative Commons * Attribution-NonCommercial-ShareAlike 3.0 (CC-BY-NC-SA 3.0) License. * http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US * This license does not allow you to use the code browser to assist the * development of your commercial software. If you intent to do so, consider * purchasing a commercial licence. ****************************************************************************/ if (!data_path) { // Previous version of the generator (1.7 and before) did not have data_path defined var data_path = root_path + "/../data"; } //Styles: var setStyle = ""; document.write(""); function switchStylestyle(styleName) { setStyle = styleName; $('link[rel*=style][title]').each(function(i) { this.disabled = true; if (this.getAttribute('title').toLowerCase() == styleName.toLowerCase()) { this.disabled = false; } }); } function switchStylestyleAndSetCookie(styleName) { switchStylestyle(styleName); createCookie('style', styleName, 5) } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } var style_match = location.search.match(/.*[?&]style=([^#&]+).*/); if (style_match) { var style = style_match[1]; switchStylestyleAndSetCookie(style); } else { var c = readCookie('style') || "qtcreator"; if (c) switchStylestyle(c); } if (setStyle != "") { //Webkit bug https://bugs.webkit.org/show_bug.cgi?id=115347 document.write(''); } //----------------------------------------------------------------------------------- $(function () { var start = new Date().getTime(); var elapsed; var escape_selector = function (str) { return str.replace(/([ #;&,.+*~\':"!^$[\]()=<>|\/@{}\\])/g,'\\$1') } function escape_html(str) { return $("

").text(str).html(); } var useExplain = { r: "r: The variable is read", w: "w: The variable is modified", a: "a: The address is taken", c: "c: The function is called", m: "m: a member is accessed", "?": "?: The type of use of the variable is unknown" }; // demangle the function name, don't care about the template or the argument function demangleFunctionName(mangle) { if (! mangle) return mangle; if (mangle[0] !== '_') return mangle; if (mangle[1] === 'M' && mangle[2] === '/') return mangle.slice(3); if (mangle[1] !== 'Z') return mangle; mangle = mangle.slice(2); var result; var last = ""; var scoped = false; do { if (!result) result = ""; else result += "::"; if (mangle[0]==='D') { result += "~" + last; break; } if (mangle[0]==='C') { result += last; break; } if (mangle[0]==='N') { mangle = mangle.slice(1); scoped = true; } if (mangle[0]==='K') mangle = mangle.slice(1); if (mangle[0]==='L') mangle = mangle.slice(1); if (mangle.match(/^St/)) { //St mangle = mangle.slice(2); result += "std::"; } if (mangle[0]==='I') { var n = 1; var i; for (i = 1; i < mangle.length && n > 0 ;i++) { if (mangle[i] === 'I') n++; if (mangle[i] === 'E') n--; } mangle = mangle.slice(i); } if (mangle.match(/^[a-z]/)) { result += "operator"; break; } var len = parseInt(mangle); if (!len) return null; var start = ("" + len).length; last = mangle.substr(start, len); result += last; mangle = mangle.slice(start + len) } while(mangle && mangle[0]!='E' && mangle[0]!='B' && scoped); return result; } // ident and highlight code (for macros) function identAndHighlightMacro(origin) { // count the number of slashes before character i in origin function countSlashes(i) { var count = 0; while(count < i && origin.charAt(i-count-1) == '\\') count++; return count; } var len = origin.length; var result = ""; var ident= "\n"; var parenLevel = 0; var string = 0; //0 = none 1=" 2=' var lineLen = 0; for (var i = 0; i < len; ++i) { var c = origin.charAt(i); switch (c) { case '>': lineLen++; result+=">"; break; case '<': lineLen++; result+="<"; break; case '&': lineLen++; result+="&"; break; case ')': result+=")"; if (!string) { parenLevel--; if (parenLevel < 0) parenLevel = 0; } break; case '(': result+="("; if (!string && i > 1) parenLevel++; break; case ';': result+=";"; if (parenLevel==0 && !string) { result += ident; lineLen = 0; } break; case '{': result+="{"; if (parenLevel==0 && !string) { ident+=" "; result+=ident; lineLen = 0; } break; case '}': if (parenLevel==0 && !string) { if (lineLen == 0 && ident.length > 2) result = result.slice(0, -2) result += "}"; ident = ident.slice(0, -2); if (i+1 < len && origin.charAt(i+1) != ';') { result += ident; lineLen = 0; } } else { result+="}"; } break; case '"': if (string == 0) { result += "\"" string = 1; } else if (string == 1 && (countSlashes(i)%2) == 0) { string = 0; result += "\"" } else { result += c; } break; case '\'': if (string == 0) { result += "\'" string = 2; } else if (string == 2 && (countSlashes(i)%2) == 0) { string = 0; result += "\'" } else { result += c; } break; case ' ': if (lineLen != 0) result += " "; break; default: lineLen++; result+=c; break; } } result = result.replace(/\b(auto|void|int|bool|long|uint|unsigned|signed|char|float|double|volatile|const)\b/g,"$1"); result = result.replace(/\b(asm|__attribute__|break|case|catch|class|__finally|__exception|__try|const_cast|continue|copnstexpr|private|public|protected|__declspec|default|delete|deprecated|dllexport|dllimport|do|dynamic_cast|else|enum|explicit|extern|if|for|friend|goto|inline|mutable|naked|namespace|new|noinline|noreturn|nothrow|operator|register|reinterpret_cast|return|selectany|sizeof|static|static_cast|struct|switch|template|this|thread|throw|true|typeof|false|try|typedef|typeid|typename|union|using|uuid|virtual|while)\b/g,"$1"); result = result.replace(/\b(\d+)\b/g,"$1"); result = result.replace(/\b(0x[0-9a-f]+)\b/gi,"$1"); return result; } //compute the length of the common prefix between two strings // duplicated indexscript.js var prefixLen = function( s1 , s2) { var maxMatchLen = Math.min(s1.length, s2.length); var res = -1; while (++res < maxMatchLen) { if (s1.charAt(res) != s2.charAt(res)) break; } return res * 256 + 256 - s1.length; } function absoluteUrl(relative) { var a = document.createElement('a'); a.href = relative; return a.href; } function computeRelativeUrlTo(source, dest) { var src_splitted = source.split("/"); if (src_splitted.length > 0 && src_splitted[src_splitted.length-1] == "") src_splitted.pop(); var dst_splitted = dest.split("/"); var maxMatch = Math.min(src_splitted.length, dst_splitted.length); var pre = 0; while (++pre < maxMatch) { if (src_splitted[pre] != dst_splitted[pre]) break; } // make sure the host is the same (http://xxx/ is 3 parts) if (pre < 3) return dest; var stack = []; for (i = 0; i < src_splitted.length - pre; ++i) { stack.push(".."); } return stack.concat(dst_splitted.slice(pre)).join('/'); } /*// Test function test_cmp(a, b) { if (a!=b) { console.log("ASSERT", a, b); alert("FAIL! \n" + a + " != " + b); } } test_cmp(computeRelativeUrlTo("", ""), ""); test_cmp(computeRelativeUrlTo("http://localhost/abcd", "http://code.woboq.org/abcd/e"), "http://code.woboq.org/abcd/e"); test_cmp(computeRelativeUrlTo("http://localhost/abcd", "http://localhost/abcd/e"), "e"); test_cmp(computeRelativeUrlTo("http://localhost/abcd/e", "http://localhost/abcd/"), "../"); test_cmp(computeRelativeUrlTo("http://localhost/abcd/e/", "http://localhost/abcd/"), "../"); test_cmp(computeRelativeUrlTo("http://localhost/abcd/e/", "http://localhost/abcd/foo"), "../foo"); test_cmp(computeRelativeUrlTo("http://localhost/abcd/e/f", "http://localhost/abcd/f/foo"), "../../f/foo"); test_cmp(computeRelativeUrlTo("http://code.woboq.org/qt5/", "http://code.woboq.org/qt5/hello"), "hello"); */ var tooltip = { ref: "", //the 'ref' of the current symbol displayed showTimerId : null, hideTimerId : null, tooltip : {}, // set when the document is initialized showDelay : 350, normalHideDelay : 200, // time to hide the tooltip if the cursor was not on it focusHideDelay: 700, // time to hide the tooltip after when it was hovered hideDelay : this.normalHideDelay, gap : 12, elem : null, init: function() { $("div#content").append("

"); this.tooltip = $("#tooltip"); var this_ = this; this.tooltip.hover( function () { this_.hideDelay = this_.focusHideDelay; clearTimeout(this_.hideTimerId); }, function () { this_.hideAfterDelay(); } ); }, setUnderElem: function(elem) { var content=$("div#content") var docwidth = content.innerWidth()-15; var contentTop = $("#content").offset().top; var winheight= $(window).height() - 18 - contentTop; var toppos = window.scrollY + contentTop; var twidth=this.tooltip.get(0).offsetWidth; var theight=this.tooltip.get(0).offsetHeight; var tipx=elem.offset().left + elem.width()/2 - twidth/2 ; tipx += content.scrollLeft(); if (tipx+twidth>docwidth) tipx = docwidth - twidth - this.gap; else if (tipx < 0) tipx = this.gap; var tipy=elem.offset().top + elem.height()/2 + this.gap; tipy += content.scrollTop(); tipy=(tipy-toppos+theight>winheight && tipy-theight>toppos) ? tipy-theight-(2*this.gap) : tipy //account for bottom edge this.elem = elem; this.tooltip.css({left: tipx, top: tipy}); }, showAfterDelay: function(elem, additionalFunction) { //this.tooltip.hide(); clearTimeout(this.showTimerId) var tt = this; this.showTimerId = setTimeout( function() { clearTimeout(tt.hideTimerId); if (additionalFunction) additionalFunction(); tt.tooltip.stop(true, true); tt.tooltip.fadeIn(); tt.setUnderElem(elem); tt.hideDelay = tt.normalHideDelay; }, this.showDelay); }, hideAfterDelay: function(e) { clearTimeout(this.showTimerId); clearTimeout(this.hideTimerId); var tooltip = this.tooltip; this.hideTimerId = setTimeout( function() { tooltip.stop(true, true); tooltip.fadeOut(); }, this.hideDelay); }, setHtml: function(html) { this.tooltip.html(html) } }; tooltip.init(); /*-------------------------------------------------------------------------------------*/ //highlight the line numbers of the warnings $(".warning, .error").each(function() { var t = $(this); var l = t.parents("tr").find("th"); l.css( { "border-radius": 3, "background-color": t.css("border-bottom-color") }); l.attr("title", t.attr("title")); } ); // other highlighting stuff var highlighted_items; var highlight_items = function(ref) { if (highlighted_items) highlighted_items.removeClass("highlight"); if (ref) { highlighted_items = $("[data-ref='"+escape_selector(ref)+"']"); highlighted_items.addClass("highlight") } } var anchor_id = location.hash.substr(1); //Get the word after the hash from the url if (/^\d+$/.test(anchor_id)) { highlighted_items = $("#" + anchor_id); highlighted_items.addClass("highlight") } else if (anchor_id != "") { highlight_items(anchor_id); } scrollToAnchor(anchor_id, false); /*-------------------------------------------------------------------------------------*/ var skipHighlightTimerId = null; var onMouseLeave = function(e) { tooltip.hideAfterDelay(e); } var onMouseClick = function(e) { if (e.ctrlKey || e.altKey || e.button != 0) return true; // don't break ctrl+click, open in a new tab if (!this.href) return true; // not clicking on a link var toppos; if (this.parentNode.tagName == "TD") { // The node is part of the code, find out the context from there. toppos = $(this).offset().top } else if (tooltip.tooltip.is(":visible") && tooltip.elem) { // If the tooltip is open, use the item from the tooltip toppos = tooltip.elem.offset().top; } else { // else, from the top. var contentTop = $("#content").offset().top; toppos = window.scrollY + contentTop; } var context = undefined; $('.def').each(function() { var t = $(this); if (t.offset().top > toppos + 1) { return false; } context = t; }); if (context !== undefined) { if (context.hasClass("decl")) { var c = context[0].title_; if (c === undefined) c = context.attr("title"); var ref = context.attr("data-ref"); pushHistoryLog( { url: location.origin + location.pathname + "#" + ref, name: c, ref: ref} ); } } var ref = $(this).attr("data-ref") if (ref && ref.match(/^[^0-9].*/)) { if (ref.match(/^_M\//)) { // Macro var currentLine = $(this).parents("tr").find("th").text(); pushHistoryLog( { url: location.origin + location.pathname + "#" + currentLine, ref: ref } ); } else { pushHistoryLog( { url: this.href, ref: ref } ); } } tooltip.tooltip.hide(); skipHighlightTimerId = setTimeout(function() { skipHighlightTimerId = null }, 600); if (history && history.pushState) { var href = this.href; var hashPos = href.indexOf("#"); if (hashPos >= 0) { var anchor = href.substr(hashPos+1); var url = href.substr(0, hashPos); if (url == "" || url === location.origin + location.pathname) { scrollToAnchor(anchor, true) e.preventDefault(); return false; } } } return true; } // Mouse interaction (tooltip, ...) var onMouseEnterRef = function(e) { if (skipHighlightTimerId) return false; var elem = $(this); var isMacro = elem.hasClass("macro"); var ref = elem.attr("data-ref"); var proj = elem.attr("data-proj"); var proj_root_path = root_path; if (proj) { proj_root_path = projects[proj]; } var url = proj_root_path + "/refs/" + ref; if (!$(this).hasClass("highlight")) { highlight_items(ref); } var computeTooltipContent = function(data, title, id) { var type ="", content =""; var tt = tooltip.tooltip; var showUseFunc = function(e) { e.stopPropagation(); tt.find(".uses").toggle(); return false; }; var symbolUrl; if (data) { // this mean the ref symbol exists var absoluteRoot = absoluteUrl(proj_root_path); var absoluteDataPath = absoluteUrl(data_path); symbolUrl = data_path + "/symbol.html?root=" + computeRelativeUrlTo(absoluteDataPath, absoluteRoot) + "&ref=" + ref; } if (elem.hasClass("local") || elem.hasClass("tu") || elem.hasClass("lbl") || (isMacro && !data && ref)) { type = $("#" + escape_selector(ref)).attr("data-type"); var docs = $("i[data-doc='"+escape_selector(ref)+"']"); docs.each(function() { var comment = $(this).html(); content += "
" + comment + ""; var l = $(this).parent().prev("th").text(); if (l) { var url = "#" + l; content += " "; } }); //var uses = highlighted_items; var uses = $(".code [data-ref='"+escape_selector(ref)+"']"); var usesLis =""; var usesCount = 0; uses.each(function() { var t = $(this); var l = t.parents("td").prev("th").text(); if (t.hasClass("def")) { content += "
Definition"; } else if (t.hasClass("decl") || this.nodeName === "DFN") { content += "
Declaration"; } else { var c; if (elem.hasClass("tu")) { // Find the context: Look at up every line from the current one if // there is a .def, if this definition is a declaration, it is the context var prevLines = t.closest("tr").prevAll(); for (var x = 0; x < prevLines.length; ++x) { var context = $(prevLines[x]).find(".def"); if (!context.length) continue; if (context.length == 1 && context.hasClass("decl")) { c = context[0].title_; if (c === undefined) c = context.attr("title") } break; } } if (!c) c = "line " + l; var useType = ""; var ut = t.attr("data-use"); if (ut) { useType += " ("+escape_html(ut)+")"; } usesLis += "
  • "+ escape_html(c) +""+useType+"
  • " usesCount += 1; } }); if (usesCount > 0) content += "
    Show Uses: (" + usesCount + ")
    " } else if (elem.hasClass("typedef")) { type = elem.attr("data-type"); } else { var res = $(""+data+""); var isType = elem.hasClass("type"); var typePrefixLen = -1; //comments: var seen_comments = []; res.find("doc").each(function() { var comment = $(this).html(); if ($.inArray(comment, seen_comments) !== -1) return; seen_comments.push(comment); if (comment.length > 550) { // FIXME: we should not split in an escape code comment = comment.substr(0, 500) + " [more...]" + comment.substr(500) + ""; } content += "
    " + comment + ""; var f = $(this).attr("f"); var l = $(this).attr("l"); if (f && l) { var url = proj_root_path + "/" + f + ".html#" + l; content += " "; } }); var p = function (label, tag) { var d = res.find(tag); if (!d.length) return false; content += "
    " + label + ": (" + d.length + ")"; if (tag === "inh" && symbolUrl && isType) { content += "   [Show Graph]"; } var shouldCompress = d.length > 15; var dict = { number: 0 }; d.each(function() { var th = $(this); var f = th.attr("f"); var l = th.attr("l"); var t = th.attr("type"); if (t) { var prefixL = prefixLen(f, file) if (prefixL >= typePrefixLen) { typePrefixLen = prefixL; type = t; } } if (shouldCompress) { if (!Object.prototype.hasOwnProperty.call(dict, f)) { dict[f] = []; dict.number++; } dict[f].push(l); } else { var url = proj_root_path + "/" + f + ".html#" + l; content += "
    " + f + ":" + l + ""; if (tag === "ovr" || tag === "inh") { var c = th.attr("c"); if (c) content += " (" + demangleFunctionName(c) + ")"; } } }); if (shouldCompress) { if (dict.number > 40) { content += "
    (Too many)"; return false; } for(var f in dict) { if (!Object.prototype.hasOwnProperty.call(dict,f) || f==="number") continue; var url_begin = proj_root_path + "/" + f + ".html"; content += "
    " + f + ""; var len = dict[f].length; if (len > 100 || (f !== file && len >= 5)) content += " (" + len + " times)"; else { content += ": " + dict[f][0] +""; for(var i = 1; i < len; i++) { content += ", " + dict[f][i] +""; } } } } return true; } p("Definitions", "def"); p("Declarations", "dec"); p(isType ? "Inherit" : "Overrides", "inh"); p(isType ? "Inherited by" : "Overriden by", "ovr"); // Size: var size = res.find("size"); if (size.length === 1) { content += "
    Size: " + escape_html(size.text()) + " bytes"; } var offset = res.find("offset"); if (offset.length === 1) { content += "
    Offset: " + escape_html(offset.text() >> 3) + " bytes"; } // Uses: var uses = res.find("use"); if (uses.length) { var href ="#"; if (symbolUrl) { href = symbolUrl+"#uses"; } content += "
    Show Uses: (" + uses.length + ")
    " } var useShown = false; showUseFunc = function(e) { if (useShown) { tt.find(".uses").toggle(); return false; } var dict = { }; var usesTypeCount = { }; uses.each(function() { var t = $(this); var f = t.attr("f"); var l = t.attr("l"); var c = t.attr("c"); var u = t.attr("u"); //if (!u) u = "?" var url = proj_root_path + "/" + f + ".html#" + l; if (!Object.prototype.hasOwnProperty.call(dict, f)) { dict[f] = { elem: $("
  • ").append($("").attr("href", url).text(f)), contexts: {}, prefixL: prefixLen(file, f), count: 0, f: f, brk: t.attr("brk") }; } c = demangleFunctionName(c) if (!c) c = f + ":" + l; dict[f].count++; usesTypeCount[u||"?"] = (usesTypeCount[u||"?"]||0) + 1; if (!Object.prototype.hasOwnProperty.call(dict[f].contexts, c)) { dict[f].contexts[c] = $("
  • ").append($("").attr("href", url).text(c)); dict[f].contexts[c].count = 1; if (u) { dict[f].contexts[c].usesType = ""+u+""; dict[f].contexts[c].usesRaw = u; } else { dict[f].contexts[c].usesType = ""; dict[f].contexts[c].usesRaw = "?"; } } else { dict[f].contexts[c].count++; if (dict[f].contexts[c].usesRaw.indexOf(u||"?") === -1) { if (u) dict[f].contexts[c].usesType += ""+u+""; dict[f].contexts[c].usesRaw += (u||"?"); } } }); var list = []; for (var xx in dict) { if (Object.prototype.hasOwnProperty.call(dict, xx)) list.push(dict[xx]); } list.sort(function(a,b){ var dif = b.prefixL - a.prefixL; return dif ? dif : a.brk ? 1 : b.f - a.f }); var ul = $("