Permalink
Browse files

Add DDoc

  • Loading branch information...
1 parent 5572160 commit e43c215e8b34a88b0bcd8f33d124c8c8ee59d940 @repeatedly repeatedly committed Jul 1, 2012
View
52 ddoc/candydoc/candy.ddoc
@@ -0,0 +1,52 @@
+D = $(B $0)
+
+DDOC =
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta content="text/javascript" http-equiv="content-script-type">
+<title>$(TITLE)</title>
+<link rel="stylesheet" type="text/css" href="candydoc/style.css">
+<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="candydoc/ie56hack.css"><![endif]-->
+<script language="JavaScript" src="candydoc/util.js" type="text/javascript"></script>
+<script language="JavaScript" src="candydoc/tree.js" type="text/javascript"></script>
+<script language="JavaScript" src="candydoc/explorer.js" type="text/javascript"></script>
+</head><body>
+<div id="tabarea"></div><div id="explorerclient"></div>
+<div id="content"><script>explorer.initialize("$(TITLE)");</script>
+ <table class="content">
+ <tr><td id="docbody"><h1>$(TITLE)</h1>$(BODY)</td></tr>
+ <tr><td id="docfooter">
+ Page was generated with
+ <img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px">
+ on $(DATETIME)
+ </td></tr>
+ </table>
+</div>
+$(ADD_MODULES)
+</body></html>
+
+
+DDOC_DECL =
+<script>explorer.outline.writeEnabled = true;</script>
+$(DT <span class="decl">$0</span>)
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+DDOC_PSYMBOL =
+<span class="currsymbol">$0</span>
+<script>explorer.outline.addDecl('$0');</script>
+
+
+DDOC_MEMBERS =
+<script>explorer.outline.incSymbolLevel();</script>
+$(DL $0)
+<script>explorer.outline.decSymbolLevel();</script>
+
+
+DDOC_PARAM_ID =
+<td nowrap valign="top" style="padding-right: 8px">$0</td>
+
+
+DDOC_PARAM =<span class="funcparam">$0</span>
+ADD_MODULES =<script>$(MODULES)</script>
+MODULE =explorer.packageExplorer.addModule("$0");
View
305 ddoc/candydoc/explorer.js
@@ -0,0 +1,305 @@
+/* This file is a part of CanDyDOC fileset.
+ File is written by Victor Nakoryakov and placed into the public domain.
+
+ This file is javascript with classes that represents explorer window.
+ And things related to navigation. */
+
+var explorer = new Explorer();
+
+///////////////////////////////////////////////////////////////////////////////
+// Current symbol marker class constructor
+///////////////////////////////////////////////////////////////////////////////
+function Marker()
+{
+ this.top = document.createElement("div");
+ this.middle = document.createElement("div");
+ this.bottom = document.createElement("div");
+ this.container = document.createElement("div");
+
+ this.setTo = function(term)
+ {
+ // find definition related to `term`
+ var def = term.nextSibling;
+ while (def && def.nodeName != "DD")
+ def = def.nextSibling;
+
+ var defHeight = 0;
+ var childrenHeight = 0; // children of current declaration
+ if (def)
+ {
+ defHeight = def.offsetHeight;
+ var child = def.firstChild;
+
+ // traverse until DL tag, until children definition
+ while (child && child.nodeName != "DL")
+ child = child.nextSibling;
+
+ if (child)
+ childrenHeight = child.offsetHeight;
+ }
+
+ this.top.style.height = term.offsetHeight;
+ this.middle.style.height = defHeight - childrenHeight;
+ this.bottom.style.height = childrenHeight;
+
+ if (childrenHeight == 0)
+ this.bottom.style.display = "none";
+ else
+ this.bottom.style.display = "";
+
+ this.container.style.left = getLeft(term) - 8;
+ this.container.style.top = getTop(term);
+ this.container.style.display = "";
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ this.container.style.position = "absolute";
+ this.container.style.display = "none";
+
+ this.top.className = "markertop";
+ this.middle.className = "markermiddle";
+ this.bottom.className = "markerbottom";
+
+ this.container.appendChild(this.top);
+ this.container.appendChild(this.middle);
+ this.container.appendChild(this.bottom);
+
+ //document.body.appendChild( this.container );
+
+ // Workaround bug in IE 5/6. We can not append anything to document body until
+ // full page load.
+ window.marker = this;
+ if (window.addEventListener)
+ window.addEventListener("load", new Function("document.body.appendChild( window.marker.container );"), false);
+ else if (window.attachEvent)
+ window.attachEvent("onload", new Function("document.body.appendChild( window.marker.container );"));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Outline class constructor
+///////////////////////////////////////////////////////////////////////////////
+function Outline()
+{
+ this.tree = new TreeView();
+ this.mountPoint = null;
+ this.writeEnabled = false;
+ this.marker = new Marker();
+ this.classRegExp = new RegExp;
+ this.structRegExp = new RegExp;
+ this.enumRegExp = new RegExp;
+ this.templateRegExp = new RegExp;
+ this.aliasRegExp = new RegExp;
+ this.funcRegExp = new RegExp;
+
+ this.incSymbolLevel = function()
+ {
+ if (this.mountPoint == null)
+ this.mountPoint = this.tree.children[ 0 ];
+ else
+ this.mountPoint = this.mountPoint.lastChild();
+ }
+
+ this.decSymbolLevel = function()
+ {
+ // place icons near items according to extracted below type
+ for (var i = 0; i < this.mountPoint.children.length; ++i)
+ {
+ child = this.mountPoint.children[i];
+ var term = child.termRef;
+
+ // find first span node
+ var n = term.firstChild;
+ while (n && n.nodeName != "SPAN")
+ n = n.nextSibling;
+
+ if (!n) // shouldn't happen
+ continue;
+
+ var iconSrc;
+ if (n.firstChild.nodeName == "#text")
+ {
+ var text = n.firstChild.data; // text before declaration
+
+ if ( this.classRegExp.test(text) )
+ iconSrc = "candydoc/img/outline/class.gif";
+ else if ( this.structRegExp.test(text) )
+ iconSrc = "candydoc/img/outline/struct.gif";
+ else if ( this.enumRegExp.test(text) )
+ iconSrc = "candydoc/img/outline/enum.gif";
+ else if ( this.templateRegExp.test(text) )
+ iconSrc = "candydoc/img/outline/template.gif";
+ else if ( this.aliasRegExp.test(text) )
+ iconSrc = "candydoc/img/outline/alias.gif";
+ else // function or variable? check whether '(' ')' exists on the right
+ {
+ var np = n.firstChild;
+ while (np && np.nodeName != "SCRIPT") // find our script "onDecl"
+ np = np.nextSibling;
+
+ if (np && np.nextSibling && np.nextSibling.nodeName == "#text" &&
+ this.funcRegExp.test(np.nextSibling.data))
+ {
+ iconSrc = "candydoc/img/outline/func.gif";
+ }
+ else
+ iconSrc = "candydoc/img/outline/var.gif";
+ }
+ }
+ else // enum member ?
+ iconSrc = "candydoc/img/outline/var.gif";
+
+ child.icon.src = iconSrc;
+ child.icon.width = 16;
+ child.icon.height = 16;
+ }
+
+ this.mountPoint = this.mountPoint.parentNode;
+ }
+
+ this.addDecl = function(decl)
+ {
+ function getLastLeaf(elem)
+ {
+ if (elem.childNodes.length > 0)
+ return getLastLeaf(elem.lastChild);
+ else
+ return elem;
+ }
+
+ function getCurrentTerm()
+ {
+ var ret = getLastLeaf( document.getElementById("content") );
+ while (ret && ret.nodeName != "DT")
+ ret = ret.parentNode;
+
+ return ret;
+ }
+
+ if (this.writeEnabled)
+ {
+ var node = this.mountPoint.createChild(decl);
+ node.termRef = getCurrentTerm();
+ node.setOnclick( new Function("explorer.outline.mark(this.termRef);") );
+ }
+ }
+
+ this.mark = function(term)
+ {
+ this.marker.setTo(term);
+ window.scrollTo(0, getTop(term) - getWindowHeight() / 6);
+ }
+
+
+ this.classRegExp.compile("(.*\b)?class(\b.*)?");
+ this.structRegExp.compile("(.*\b)?struct(\b.*)?");
+ this.enumRegExp.compile("(.*\b)?enum(\b.*)?");
+ this.templateRegExp.compile("(.*\b)?template(\b.*)?");
+ this.aliasRegExp.compile("(.*\b)?alias(\b.*)?");
+ this.funcRegExp.compile(/.*\(.*/);
+}
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Package explorer class constructor
+///////////////////////////////////////////////////////////////////////////////
+function PackageExplorer()
+{
+ this.tree = new TreeView(true);
+
+ this.addModule = function(mod)
+ {
+ var moduleIco = "candydoc/img/outline/module.gif";
+ var packageIco = "candydoc/img/outline/package.gif";
+
+ var path = mod.split("\.");
+ var node = this.tree.branch(path[0]);
+ if ( !node )
+ node = this.tree.createBranch(path[0], (path.length == 1) ? moduleIco : packageIco);
+
+ for (var i = 1; i < path.length; ++i)
+ {
+ var prev = node;
+ node = node.child(path[i]);
+ if (!node)
+ node = prev.createChild(path[i], (path.length == i + 1) ? moduleIco : packageIco);
+
+ if (path.length == i + 1)
+ node.setRef(path[i] + ".html");
+ }
+ }
+}
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Explorer class constructor
+///////////////////////////////////////////////////////////////////////////////
+function Explorer()
+{
+ this.outline = new Outline();
+ this.packageExplorer = new PackageExplorer();
+ this.tabs = new Array();
+ this.tabCount = 0;
+
+ this.initialize = function(moduleName)
+ {
+ this.tabArea = document.getElementById("tabarea");
+ this.clientArea = document.getElementById("explorerclient");
+
+ // prevent text selection
+ this.tabArea.onmousedown = new Function("return false;");
+ this.tabArea.onclick = new Function("return true;");
+ this.tabArea.onselectstart = new Function("return false;");
+ this.clientArea.onmousedown = new Function("return false;");
+ this.clientArea.onclick = new Function("return true;");
+ this.clientArea.onselectstart = new Function("return false;");
+
+ this.outline.tree.createBranch( moduleName, "candydoc/img/outline/module.gif" );
+
+ // create tabs
+ this.createTab("Outline", this.outline.tree.domEntry);
+ this.createTab("Package", this.packageExplorer.tree.domEntry);
+ }
+
+ this.createTab = function(name, domEntry)
+ {
+ var tab = new Object();
+ this.tabs[name] = tab;
+ this.tabCount++;
+
+ tab.domEntry = domEntry;
+ tab.labelSpan = document.createElement("span");
+
+ if (this.tabCount > 1)
+ {
+ tab.labelSpan.className = "inactivetab";
+ tab.domEntry.style.display = "none";
+ }
+ else
+ {
+ tab.labelSpan.className = "activetab";
+ tab.domEntry.style.display = "";
+ }
+
+ tab.labelSpan.appendChild( document.createTextNode(name) );
+ tab.labelSpan.owner = this;
+ tab.labelSpan.onclick = new Function("this.owner.setSelection('" + name + "');");
+
+ this.tabArea.appendChild( tab.labelSpan );
+ this.clientArea.appendChild( domEntry );
+ }
+
+ this.setSelection = function(tabName)
+ {
+ for (name in this.tabs)
+ {
+ this.tabs[name].labelSpan.className = "inactivetab";
+ this.tabs[name].domEntry.style.display = "none";
+ }
+
+ this.tabs[tabName].labelSpan.className = "activetab";
+ this.tabs[tabName].domEntry.style.display = "";
+ }
+}
View
21 ddoc/candydoc/ie56hack.css
@@ -0,0 +1,21 @@
+/* This file is a part of CanDyDOC fileset.
+ File is written by Victor Nakoryakov and placed into the public domain.
+
+ This file is CSS to work around IE6 and earlier bugs. It's included just
+ in these browsers. */
+
+
+/* Some magic to emulate unsupported "position: fixed" style. */
+#tabarea
+{
+ _position: absolute;
+ _top: expression(eval(document.body.scrollTop+8));
+}
+
+/* ditto */
+#explorerclient
+{
+ _position: absolute;
+ _top: expression(eval(document.body.scrollTop+24));
+ _height: expression(eval(document.body.clientHeight-48));
+}
View
BIN ddoc/candydoc/img/bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/candydoc.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/alias.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/class.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/enum.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/func.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/module.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/package.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/struct.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/template.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/outline/var.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/package/bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/tree/shim.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/tree/tb.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/tree/tbr.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/tree/tbrm.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/tree/tbrp.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/tree/tr.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/tree/trm.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN ddoc/candydoc/img/tree/trp.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 ddoc/candydoc/modules.ddoc
@@ -0,0 +1,8 @@
+MODULES =
+$(MODULE msgpack.buffer)
+$(MODULE msgpack.common)
+$(MODULE msgpack.msgpack)
+$(MODULE msgpack.object)
+$(MODULE msgpack.packer)
+$(MODULE msgpack.unpacker)
+$(MODULE msgpack.util)
View
169 ddoc/candydoc/style.css
@@ -0,0 +1,169 @@
+/* This file is a part of CanDyDOC fileset.
+ File is written by Victor Nakoryakov and placed into the public domain.
+
+ This file is main CSS file of CanDyDOC. You may adjust some part of
+ parameters to control how result documentation would looks like. See
+ further documentation for details. */
+
+
+
+/* This controls how background would looks like and
+ sets some document-scope defaults. */
+body
+{
+ /* These parameters control default font. */
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10pt;
+ color: #666666;
+
+ /* These control look of background. Note that you have to use
+ fixed background to keep documentation good-looking in
+ IE6 and earlier. Otherwise whole *explorer* will jerk while
+ scrolling. If you do not want to use background at all use
+ some invalid url, e.g. url(foo). */
+ background-color: #e6fcea;
+ background: url(img/bg.gif) fixed;
+
+ /* Don't touch. Necessary for IE6 and earlier. */
+ height: 100%;
+}
+
+
+
+/* Style applied to all tables. Actualy there are two: one table is
+ that contains contant and footer with CanDyDOC logo, and others
+ are that contains functions' parameters description. */
+table
+{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10pt;
+ color: #666666;
+ text-align: justify;
+}
+
+
+/* Style used for all hyperlinks. */
+a:link { color: #009900; text-decoration: none }
+a:visited { color: #009999; text-decoration: none }
+a:hover { color: #0033cc; text-decoration: none }
+a:active { color: #0033cc; text-decoration: none }
+
+/*
+table.matrix
+{
+ border-left: double 3px #666666;
+ border-right: double 3px #666666;
+ margin-left: 3em;
+}
+*/
+
+/* Style appled to declarations. E.g. 'void foo(int a, float b);' */
+span.decl { font-size: 10pt; font-weight: bold; color: #000000; text-align: left }
+/* Style appled to current declaration's symbol. E.g. 'foo' in 'void foo(int a, float b);' */
+span.currsymbol { font-size: 12pt; color: #009900 }
+/* Style appled to function's parameters. E.g. 'a' and 'b' in 'void foo(int a, float b);' */
+span.funcparam { font-style: italic; font-weight: normal; color: #331200 }
+
+/* Style for div that actualy contains documenation. */
+#content
+{
+ padding-right: 8px;
+ position: absolute;
+ left: 245px;
+ top: 8px;
+ text-align: justify;
+}
+
+/* Style for table that is inside div considered above. Contains documentaton
+ itself and footer with CanDyDOC logo. */
+table.content
+{
+ margin-bottom: 8px;
+ border-spacing: 0px;
+ border-collapse: collapse;
+ background-color: #ffffff;
+}
+
+/* Style for cell of above considered table that contains documentation itself. */
+#docbody
+{
+ padding: 8px 20px 8px 20px;
+ border: solid 1px #009900;
+}
+
+/* Style for cell that contains CanDyDOC logo. */
+#docfooter
+{
+ height: 16px;
+ background-color: #ddeedd;
+ padding: 0px 8px 0px 8px;
+ border: solid 1px #009900;
+}
+
+/* Style applied to currently active tab of explorer window. */
+span.activetab
+{
+ background-color: #0033cc;
+ border-top: solid 2px #009900;
+ color: #ffffff;
+ font-weight: bold;
+ padding-left: 4px;
+ padding-right: 4px;
+ padding-top: 1px;
+ margin-right: 1px;
+}
+
+/* Style applied to currently inactive tab of explorer window. */
+span.inactivetab
+{
+ background-color: #000066;
+ color: #cccccc;
+ font-weight: normal;
+ padding-left: 4px;
+ padding-right: 4px;
+ padding-top: 0px;
+ margin-right: 1px;
+}
+
+/* Style applied to div that contains tabs of explorer. Note that if
+ you want to change it's position you have to change position of
+ #explorerclient, #content and corresponding values in ie56hack.css */
+#tabarea
+{
+ position: fixed;
+ top: 8px;
+ width: 205px;
+ height: 16px;
+ cursor: default;
+}
+
+
+/* Style applied to div that contains tree in explorer. Note that if
+ you want to change it's position you have to change position of
+ #tabarea, #content and corresponding values in ie56hack.css */
+#explorerclient
+{
+ position: fixed;
+ top: 24px;
+ bottom: 8px;
+ width: 205px;
+ overflow: auto;
+ background-color: #fcfffc;
+ border: solid 2px #0033cc;
+ padding: 4px;
+ cursor: default;
+ color: Black;
+}
+
+/* Following 3 styles control appearance of marker that appears
+ if you click some entity in outline window. */
+div.markertop { border-left: solid 2px #0033cc;}
+div.markermiddle{ border-left: dotted 2px #0033cc;}
+div.markerbottom{ border-left: dotted 2px #66cc66;}
+
+/* Style applied to preformated text used to show examples. */
+pre.d_code
+{
+ border: dotted 1px #9c9;
+ background-color: #eeffee;
+}
View
374 ddoc/candydoc/tree.js
@@ -0,0 +1,374 @@
+/* This file is a part of CanDyDOC fileset.
+ File is written by Victor Nakoryakov and placed into the public domain.
+
+ This file is javascript with classes that represents native style tree control. */
+
+var pmNone = 0;
+var pmPlus = 1;
+var pmMinus = 2;
+
+var hlNone = 0;
+var hlGrey = 1;
+var hlSelected = 2;
+
+function TreeView(hrefMode)
+{
+ this.domEntry = document.createElement("div");
+ this.children = new Array();
+ this.selection = null;
+ this.hrefMode = hrefMode;
+
+ this.createBranch = function(text, iconSrc)
+ {
+ var root = new TreeNode(text, iconSrc, this.hrefMode);
+ root.owner = this;
+ this.children[ this.children.length ] = root;
+ this.domEntry.appendChild( root.domEntry );
+ return root;
+ }
+
+ this.branch = function(text)
+ {
+ var ret = null;
+ for (var i = 0; i < this.children.length; ++i)
+ if (this.children[i].textElement.data == text)
+ {
+ ret = this.children[i];
+ break;
+ }
+
+ return ret;
+ }
+
+ this.domEntry.style.fontSize = "10px";
+ this.domEntry.style.cursor = "default";
+ this.domEntry.style.whiteSpace = "nowrap";
+}
+
+var idCounter = 0;
+function TreeNode(text, iconSrc, hrefMode)
+{
+ this.id = idCounter++;
+ this.parentNode = null;
+ this.children = new Array();
+ this.domEntry = document.createElement("div");
+ this.icon = document.createElement("img");
+ this.textElement = document.createTextNode(text);
+ this.textSpan = document.createElement("span");
+ this.lineDiv = document.createElement("div");
+ this.hierarchyImgs = new Array();
+ this.onclick = null;
+
+ function createIcon()
+ {
+ var img = document.createElement("img");
+ img.style.verticalAlign = "middle";
+ img.style.position = "relative";
+ img.style.top = "-1px";
+ img.width = 16;
+ img.height = 16;
+ return img;
+ }
+
+ function createHierarchyImage()
+ {
+ var img = createIcon();
+ img.pointsTop = false;
+ img.pointsBottom = false;
+ img.pointsRight = false;
+ img.pmState = pmNone;
+ return img;
+ }
+
+ function genHierarchyImageSrc(hierarchyImg)
+ {
+ var name = "";
+ if (hierarchyImg.pointsTop)
+ name += "t";
+
+ if (hierarchyImg.pointsBottom)
+ name += "b";
+
+ if (hierarchyImg.pointsRight)
+ name += "r";
+
+ if (hierarchyImg.pmState == pmPlus)
+ name += "p";
+ else if (hierarchyImg.pmState == pmMinus)
+ name += "m";
+
+ if (name == "")
+ name = "shim";
+
+ return "candydoc/img/tree/" + name + ".gif";
+ }
+
+ function setSrc(icon, src)
+ {
+ icon.src = src;
+ // After src change width and height are reseted in IE.
+ // Bug workaround:
+ icon.width = 16;
+ icon.height = 16;
+ }
+
+ this.createChild = function(text, iconSrc)
+ {
+ var child = new TreeNode(text, iconSrc, this.owner.hrefMode);
+ this.children[ this.children.length ] = child;
+ this.domEntry.appendChild( child.domEntry );
+ child.parentNode = this;
+ child.owner = this.owner;
+
+ // insert hierarchy images according to deepness level
+ // of created child.
+
+ if (this.children.length > 1)
+ {
+ // there were already added child before. So copy `level-1`
+ // hierarchy images from it.
+
+ var prevAddedChild = this.children[ this.children.length - 2 ];
+
+ for (var i = 0; i < prevAddedChild.hierarchyImgs.length - 1; ++i)
+ {
+ var prevAddedChildImg = prevAddedChild.hierarchyImgs[i];
+ var img = createHierarchyImage();
+ setSrc(img, prevAddedChildImg.src);
+ img.pointsTop = prevAddedChildImg.pointsTop;
+ img.pointsBottom = prevAddedChildImg.pointsBottom;
+ img.pointsRight = prevAddedChildImg.pointsRight;
+ img.pmState = prevAddedChildImg.pmState;
+
+ child.hierarchyImgs[ child.hierarchyImgs.length ] = img;
+ child.lineDiv.insertBefore(img, child.icon);
+ }
+
+ // change last hierarchy image of prevAddedChild from |_ to |-
+ var lastHierarchyImg = prevAddedChild.hierarchyImgs[ prevAddedChild.hierarchyImgs.length - 1 ];
+ lastHierarchyImg.pointsBottom = true;
+ setSrc(lastHierarchyImg, genHierarchyImageSrc(lastHierarchyImg));
+
+ // change hierarchy images of prevAddedChild's children on it's last
+ // level to |
+ prevAddedChild.addHierarchyTBLine(prevAddedChild.hierarchyImgs.length - 1);
+ }
+ else
+ {
+ // this is a first child. So copy `level-2`
+ // hierarchy images from parent, i.e. this.
+
+ for (var i = 0; i < this.hierarchyImgs.length - 1; ++i)
+ {
+ var parentImg = this.hierarchyImgs[i];
+ var img = createHierarchyImage();
+ setSrc(img, parentImg.src);
+ img.pointsTop = parentImg.pointsTop;
+ img.pointsBottom = parentImg.pointsBottom;
+ img.pointsRight = parentImg.pointsRight;
+ img.pmState = parentImg.pmState;
+
+ child.hierarchyImgs[ child.hierarchyImgs.length ] = img;
+ child.lineDiv.insertBefore(img, child.icon);
+ }
+
+ if (this.hierarchyImgs.length > 0) // we are not root
+ {
+ // change last hierarchy image of parent (i.e. this): add minus to it
+ var lastHierarchyImg = this.hierarchyImgs[ this.hierarchyImgs.length - 1];
+ lastHierarchyImg.pmState = pmMinus;
+ setSrc(lastHierarchyImg, genHierarchyImageSrc(lastHierarchyImg));
+ lastHierarchyImg.owner = this;
+ lastHierarchyImg.onclick = new Function("e", "this.owner.processPMClick(e);");
+
+ // make decision on image on `level-1`. It depends on parent's (ie this)
+ // image on same level.
+ var parentL1HierarchyImg = lastHierarchyImg;
+ var l1HierarchyImg = createHierarchyImage();
+ if (parentL1HierarchyImg.pointsBottom)
+ {
+ l1HierarchyImg.pointsTop = true;
+ l1HierarchyImg.pointsBottom = true;
+ }
+ setSrc(l1HierarchyImg, genHierarchyImageSrc(l1HierarchyImg));
+ child.hierarchyImgs[ child.hierarchyImgs.length ] = l1HierarchyImg;
+ child.lineDiv.insertBefore(l1HierarchyImg, child.icon);
+ }
+ }
+
+ // in any case on last level our child will have icon |_
+ var img = createHierarchyImage();
+ img.pointsTop = true;
+ img.pointsRight = true;
+ setSrc(img, genHierarchyImageSrc(img));
+
+ child.hierarchyImgs[ child.hierarchyImgs.length ] = img;
+ child.lineDiv.insertBefore(img, child.icon);
+
+ return child;
+ }
+
+ this.lastChild = function()
+ {
+ return this.children[ this.children.length - 1 ];
+ }
+
+ this.child = function(text)
+ {
+ var ret = null;
+ for (var i = 0; i < this.children.length; ++i)
+ if (this.children[i].textElement.data == text)
+ {
+ ret = this.children[i];
+ break;
+ }
+
+ return ret;
+ }
+
+ this.addHierarchyTBLine = function(level)
+ {
+ for (var i = 0; i < this.children.length; ++i)
+ {
+ var img = this.children[i].hierarchyImgs[level];
+ img.pointsTop = true;
+ img.pointsBottom = true;
+ setSrc(img, genHierarchyImageSrc(img));
+ this.children[i].addHierarchyTBLine(level);
+ }
+ }
+
+ this.expand = function()
+ {
+ var img = this.hierarchyImgs[ this.hierarchyImgs.length - 1 ];
+
+ if (img.pmState == pmPlus)
+ {
+ img.pmState = pmMinus;
+ setSrc(img, genHierarchyImageSrc(img));
+
+ for (var i = 0; i < this.children.length; ++i)
+ this.children[i].domEntry.style.display = "";
+ }
+ }
+
+ this.collapse = function()
+ {
+ var img = this.hierarchyImgs[ this.hierarchyImgs.length - 1 ];
+
+ if (img.pmState == pmMinus)
+ {
+ img.pmState = pmPlus;
+ setSrc(img, genHierarchyImageSrc(img));
+
+ for (var i = 0; i < this.children.length; ++i)
+ this.children[i].domEntry.style.display = "none";
+ }
+ }
+
+ this.toggle = function()
+ {
+ var img = this.hierarchyImgs[ this.hierarchyImgs.length - 1 ];
+ if (img.pmState == pmMinus)
+ this.collapse();
+ else
+ this.expand();
+ }
+
+ this.select = function()
+ {
+ if (this.owner.selection != this)
+ {
+ if (this.owner.selection)
+ this.owner.selection.setHighlight(hlNone);
+
+ this.owner.selection = this;
+ this.setHighlight(hlSelected);
+ }
+ }
+
+ this.setHighlight = function(mode)
+ {
+ if (mode == hlNone)
+ {
+ this.textSpan.style.backgroundColor = "";
+ this.textSpan.style.color = "";
+ this.textSpan.style.border = "";
+ }
+ else if (mode == hlGrey)
+ {
+ this.textSpan.style.backgroundColor = "#aaaaaa";
+ this.textSpan.style.color = "";
+ this.textSpan.style.border = "";
+ }
+ else if (mode == hlSelected)
+ {
+ this.textSpan.style.backgroundColor = "3399cc";
+ this.textSpan.style.color = "white";
+ this.textSpan.style.border = "dotted 1px red";
+ }
+ }
+
+ this.setOnclick = function(proc)
+ {
+ this.onclick = proc;
+ }
+
+ this.setRef = function(url)
+ {
+ if (this.anchor)
+ this.anchor.href = url;
+ }
+
+ this.processPMClick = function(e)
+ {
+ this.toggle();
+
+ // prevent this line selection, stop bubbling
+ if (e)
+ e.stopPropagation(); // Mozilla way
+ if (window.event)
+ window.event.cancelBubble = true; // IE way
+ }
+
+ this.processOnclick = function()
+ {
+ this.select();
+ if (this.onclick instanceof Function)
+ this.onclick();
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ if (iconSrc)
+ this.icon.src = iconSrc;
+ else
+ {
+ this.icon.width = 0;
+ this.icon.height = 0;
+ }
+
+ this.icon.style.verticalAlign = "middle";
+ this.icon.style.position = "relative";
+ this.icon.style.top = "-1px";
+ this.icon.style.paddingRight = "2px";
+
+ if (!hrefMode)
+ {
+ this.textSpan.appendChild( this.textElement );
+ }
+ else
+ {
+ this.anchor = document.createElement("a");
+ this.anchor.appendChild( this.textElement );
+ this.textSpan.appendChild( this.anchor );
+ }
+
+ this.lineDiv.appendChild( this.icon );
+ this.lineDiv.appendChild( this.textSpan );
+ this.domEntry.appendChild( this.lineDiv );
+
+ this.lineDiv.owner = this;
+
+ if (!hrefMode)
+ this.lineDiv.onclick = new Function("this.owner.processOnclick();");
+}
View
41 ddoc/candydoc/util.js
@@ -0,0 +1,41 @@
+/* This file is a part of CanDyDOC fileset.
+ File is written by Victor Nakoryakov and placed into the public domain.
+
+ This file is javascript with cross-browser utility functions. */
+
+function getLeft(elem)
+{
+ var ret = 0;
+ while (elem.offsetParent)
+ {
+ ret += elem.offsetLeft;
+ elem = elem.offsetParent;
+ }
+
+ return ret;
+}
+
+function getTop(elem)
+{
+ var ret = 0;
+ while (elem.offsetParent)
+ {
+ ret += elem.offsetTop;
+ elem = elem.offsetParent;
+ }
+
+ return ret;
+}
+
+function getWindowHeight()
+{
+ var ret = 0;
+ if (typeof(window.innerHeight) == "number")
+ ret = window.innerHeight;
+ else if (document.documentElement && document.documentElement.clientHeight)
+ ret = document.documentElement.clientHeight;
+ else if (document.body && document.body.clientHeight)
+ ret = document.body.clientHeight;
+
+ return ret;
+}
View
2,232 ddoc/index.html
@@ -0,0 +1,2232 @@
+
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<meta content="text/javascript" http-equiv="content-script-type">
+<title>msgpack</title>
+<link rel="stylesheet" type="text/css" href="candydoc/style.css">
+<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="candydoc/ie56hack.css"><![endif]-->
+<script language="JavaScript" src="candydoc/util.js" type="text/javascript"></script>
+<script language="JavaScript" src="candydoc/tree.js" type="text/javascript"></script>
+<script language="JavaScript" src="candydoc/explorer.js" type="text/javascript"></script>
+</head><body>
+<div id="tabarea"></div><div id="explorerclient"></div>
+<div id="content"><script>explorer.initialize("msgpack");</script>
+ <table class="content">
+ <tr><td id="docbody"><h1>msgpack</h1><!-- Generated by Ddoc from src/msgpack.d -->
+MessagePack serializer and deserializer implementation.
+<br><br>
+MessagePack is a binary-based serialization specification.
+
+<br><br>
+<b>Example:</b><br>
+<pre class="d_code"> <font color=blue>auto</font> data = tuple(<font color=red>"MessagePack!"</font>, [1, 2], <font color=blue>true</font>);
+
+ <font color=blue>auto</font> serialized = pack(data);
+
+ <font color=green>// ...
+</font>
+ <font color=blue>typeof</font>(data) deserialized;
+
+ unpack(serialized, deserialized);
+
+ <font color=blue>assert</font>(data == deserialized);
+</pre>
+
+<br><br>
+<b>See Also:</b><br>
+<a href="http://msgpack.org/">The MessagePack Project</a><br>
+ <a href="http://wiki.msgpack.org/display/MSGPACK/Design+of+Serialization">MessagePack Design concept</a><br>
+ <a href="http://wiki.msgpack.org/display/MSGPACK/Format+specification">MessagePack data format</a>
+
+<br><br>
+<b>License:</b><br>
+<a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
+<br><br>
+<b>Authors:</b><br>
+Masahiro Nakagawa<br><br>
+
+
+<script>explorer.outline.incSymbolLevel();</script>
+<dl>
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">struct
+<span class="currsymbol">RefBuffer</span>
+<script>explorer.outline.addDecl('RefBuffer');</script>
+
+;
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd><b>
+<span class="currsymbol">RefBuffer</span>
+<script>explorer.outline.addDecl('RefBuffer');</script>
+
+</b>
+ is a reference stored buffer for more efficient serialization
+<br><br>
+<b>Example:</b><br>
+<pre class="d_code"> <font color=blue>auto</font> packer = packer(<u>RefBuffer</u>(16)); <font color=green>// threshold is 16
+</font>
+ <font color=green>// packs data
+</font>
+ writev(fd, <font color=blue>cast</font>(<font color=blue>void</font>*)packer.buffer.vector.ptr, packer.buffer.vector.length);
+</pre>
+<br><br>
+
+
+<script>explorer.outline.incSymbolLevel();</script>
+<dl>
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">@safe this(const(ulong) <span class="funcparam">threshold</span>, const(ulong) <span class="funcparam">chunkSize</span> = cast(const(ulong))8192);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Constructs a buffer.
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">const(ulong) <span class="funcparam">threshold</span></td>
+
+
+<td>the <span class="funcparam">threshold</span> of writing value or stores reference.</td></tr>
+<tr>
+<td nowrap valign="top" style="padding-right: 8px">const(ulong) <span class="funcparam">chunkSize</span></td>
+
+
+<td>the default size of chunk for allocation.</td></tr>
+</table><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">nothrow @property @safe ubyte[]
+<span class="currsymbol">data</span>
+<script>explorer.outline.addDecl('data');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Returns the buffer contents that excluding references.
+<br><br>
+<b>Returns:</b><br>
+the non-contiguous copied contents.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">nothrow @property ref @safe iovec[]
+<span class="currsymbol">vector</span>
+<script>explorer.outline.addDecl('vector');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Forwards to all buffer contents.
+<br><br>
+<b>Returns:</b><br>
+the array of iovec struct that stores references.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">@safe void
+<span class="currsymbol">put</span>
+<script>explorer.outline.addDecl('put');</script>
+
+(in ubyte <span class="funcparam">value</span>);
+<br>@safe void
+<span class="currsymbol">put</span>
+<script>explorer.outline.addDecl('put');</script>
+
+(in ubyte[] <span class="funcparam">value</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Writes the argument to buffer and stores the reference of writed content
+ if the argument size is smaller than threshold,
+ otherwise stores the reference of argument directly.
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">ubyte <span class="funcparam">value</span></td>
+
+
+<td>the content to write.</td></tr>
+</table><br>
+
+</dd>
+</dl>
+<script>explorer.outline.decSymbolLevel();</script>
+
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">class
+<span class="currsymbol">MessagePackException</span>
+<script>explorer.outline.addDecl('MessagePackException');</script>
+
+: object.Exception;
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd><b>
+<span class="currsymbol">MessagePackException</span>
+<script>explorer.outline.addDecl('MessagePackException');</script>
+
+</b>
+ is a root Exception for MessagePack related operation.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">struct
+<span class="currsymbol">Packer</span>
+<script>explorer.outline.addDecl('Packer');</script>
+
+(Stream) if (isOutputRange!(Stream,ubyte) &amp;&amp; isOutputRange!(Stream,ubyte[]));
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd><b>
+<span class="currsymbol">Packer</span>
+<script>explorer.outline.addDecl('Packer');</script>
+
+</b>
+ is a <b>MessagePack</b>
+ serializer
+<br><br>
+<b>Example:</b><br>
+<pre class="d_code"> <font color=blue>auto</font> packer = packer(Appender!(<font color=blue>ubyte</font>[])());
+
+ packer.packArray(<font color=blue>false</font>, 100, 1e-10, <font color=blue>null</font>);
+
+ stdout.rawWrite(packer.buffer.data);
+</pre>
+
+<br><br>
+<b>NOTE:</b><br>
+Current implementation can't deal with a circular reference.
+ If you try to serialize a object that has circular reference, runtime raises 'Stack Overflow'.<br><br>
+
+
+<script>explorer.outline.incSymbolLevel();</script>
+<dl>
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">this(Stream <span class="funcparam">stream</span>, bool <span class="funcparam">withFieldName</span> = false);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Constructs a packer with <i><span class="funcparam">stream</span></i>.
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">Stream <span class="funcparam">stream</span></td>
+
+
+<td>the <span class="funcparam">stream</span> to write.</td></tr>
+<tr>
+<td nowrap valign="top" style="padding-right: 8px">bool <span class="funcparam">withFieldName</span></td>
+
+
+<td>serialize a field name at class or struct</td></tr>
+</table><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Stream
+<span class="currsymbol">stream</span>
+<script>explorer.outline.addDecl('stream');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Forwards to
+<span class="currsymbol">stream</span>
+<script>explorer.outline.addDecl('stream');</script>
+
+.
+<br><br>
+<b>Returns:</b><br>
+the
+<span class="currsymbol">stream</span>
+<script>explorer.outline.addDecl('stream');</script>
+
+.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">value</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">value</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">value</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">value</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">value</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Serializes argument and writes to stream.
+<br><br>
+If the argument is the pointer type, dereferences the pointer and serializes pointed value.
+<pre class="d_code"> <font color=blue>int</font> a = 10;
+ <font color=blue>int</font>* b = &amp;b;
+
+ packer.<u>pack</u>(b); <font color=green>// serializes 10, not address of a
+</font></pre>
+ Serializes nil if the argument of nullable type is <b>null</b>.
+
+<br><br>
+<b>NOTE:</b><br>
+MessagePack doesn't define <font color=blue>real</font> type format.
+ Don't serialize <font color=blue>real</font> if you communicate with other languages.
+ Transfer <font color=blue>double</font> serialization if <font color=blue>real</font> on your environment equals <font color=blue>double</font>.
+
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">value</td>
+
+
+<td>the content to serialize.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+self, i.e. for method chaining.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">value</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">value</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">array</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">array</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(Types...)(auto ref const Types <span class="funcparam">objects</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Overload for
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(<b>null</b>) for 2.057 or later<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(in T <span class="funcparam">object</span>);
+<br>Packer
+<span class="currsymbol">pack</span>
+<script>explorer.outline.addDecl('pack');</script>
+
+(T)(auto ref T <span class="funcparam">object</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Serializes <i>object</i> and writes to stream.
+<br><br>
+Calling <b>toMsgpack</b>
+ if <font color=blue>class</font> and <font color=blue>struct</font> implement <b>toMsgpack</b>
+ method. <b>toMsgpack</b>
+ signature is:
+<pre class="d_code"> <font color=blue>void</font> toMsgpack(Packer)(<font color=blue>ref</font> Packer packer) <font color=blue>const</font>
+</pre>
+ This method serializes all members of T object if <font color=blue>class</font> and <font color=blue>struct</font> don't implement <b>toMsgpack</b>
+.
+<br><br>
+
+ An object that doesn't implement <b>toMsgpack</b>
+ is serialized to Array type.
+<pre class="d_code"> packer.<u>pack</u>(tuple(<font color=blue>true</font>, 1, <font color=red>"Hi!"</font>)) <font color=green>// -&gt; '[true, 1, "Hi!"]', not 'ture, 1, "Hi!"'
+</font>
+ <font color=blue>struct</font> Foo
+ {
+ <font color=blue>int</font> num = 10;
+ string msg = <font color=red>"D!"</font>;
+ }
+ packer.<u>pack</u>(Foo()); <font color=green>// -&gt; '[10, "D!"]'
+</font>
+ <font color=blue>class</font> Base
+ {
+ <font color=blue>bool</font> flag = <font color=blue>true</font>;
+ }
+ <font color=blue>class</font> Derived : Base
+ {
+ <font color=blue>double</font> = 0.5f;
+ }
+ packer.<u>pack</u>(<font color=blue>new</font> Derived()); <font color=green>// -&gt; '[true, 0.5f]'
+</font></pre>
+
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">object</td>
+
+
+<td>the content to serialize.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+self, i.e. for method chaining.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Packer
+<span class="currsymbol">packArray</span>
+<script>explorer.outline.addDecl('packArray');</script>
+
+(Types...)(auto ref const Types <span class="funcparam">objects</span>);
+<br>Packer
+<span class="currsymbol">packMap</span>
+<script>explorer.outline.addDecl('packMap');</script>
+
+(Types...)(auto ref const Types <span class="funcparam">objects</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Serializes the arguments as container to stream.
+<br><br>
+<pre class="d_code"> packer.<u>packArray</u>(<font color=blue>true</font>, 1); <font color=green>// -&gt; [true, 1]
+</font> packer.packMap(<font color=red>"Hi"</font>, 100); <font color=green>// -&gt; ["Hi":100]
+</font></pre>
+
+ In packMap, the number of arguments must be even.
+
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">objects</td>
+
+
+<td>the contents to serialize.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+self, i.e. for method chaining.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Packer
+<span class="currsymbol">beginArray</span>
+<script>explorer.outline.addDecl('beginArray');</script>
+
+(in size_t <span class="funcparam">length</span>);
+<br>Packer
+<span class="currsymbol">beginMap</span>
+<script>explorer.outline.addDecl('beginMap');</script>
+
+(in size_t <span class="funcparam">length</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Serializes the type-information to stream.
+<br><br>
+These methods don't serialize contents.
+ You need to call pack method to serialize contents at your own risk.
+<pre class="d_code"> packer.<u>beginArray</u>(3).pack(<font color=blue>true</font>, 1); <font color=green>// -&gt; [true, 1,
+</font>
+ <font color=green>// other operation
+</font>
+ packer.pack(<font color=red>"Hi!"</font>); <font color=green>// -&gt; [true, 1, "Hi!"]
+</font></pre>
+
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">size_t <span class="funcparam">length</span></td>
+
+
+<td>the <span class="funcparam">length</span> of container.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+self, i.e. for method chaining.<br><br>
+
+</dd>
+</dl>
+<script>explorer.outline.decSymbolLevel();</script>
+
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Packer!(Stream)
+<span class="currsymbol">packer</span>
+<script>explorer.outline.addDecl('packer');</script>
+
+(Stream)(Stream <span class="funcparam">stream</span>, bool <span class="funcparam">withFieldName</span> = false);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Helper for <b>Packer</b>
+ construction.
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">stream</td>
+
+
+<td>the stream to write.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+a <b>Packer</b>
+ object instantiated and initialized according to the arguments.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">class
+<span class="currsymbol">UnpackException</span>
+<script>explorer.outline.addDecl('UnpackException');</script>
+
+: msgpack.MessagePackException;
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd><b>
+<span class="currsymbol">UnpackException</span>
+<script>explorer.outline.addDecl('UnpackException');</script>
+
+</b>
+ is thrown on deserialization failure<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">template
+<span class="currsymbol">InternalBuffer</span>
+<script>explorer.outline.addDecl('InternalBuffer');</script>
+
+()</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Internal buffer and related operations for Unpacker
+<br><br>
+Following Unpackers mixin this template. So, Unpacker can use following methods.
+<br><br>
+
+<pre class="d_code"> <font color=green>//buffer image:
+</font> +-------------------------------------------+
+ | [object] | [obj | unparsed... | unused... |
+ +-------------------------------------------+
+ ^ offset
+ ^ current
+ ^ used
+ ^ buffer.length
+</pre>
+
+ This mixin template is a private.<br><br>
+
+
+<script>explorer.outline.incSymbolLevel();</script>
+<dl>
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">ubyte[]
+<span class="currsymbol">buffer</span>
+<script>explorer.outline.addDecl('buffer');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Forwards to internal
+<span class="currsymbol">buffer</span>
+<script>explorer.outline.addDecl('buffer');</script>
+
+.
+<br><br>
+<b>Returns:</b><br>
+the reference of internal
+<span class="currsymbol">buffer</span>
+<script>explorer.outline.addDecl('buffer');</script>
+
+.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">void
+<span class="currsymbol">feed</span>
+<script>explorer.outline.addDecl('feed');</script>
+
+(in ubyte[] <span class="funcparam">target</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Fills internal buffer with <i><span class="funcparam">target</span></i>.
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">ubyte[] <span class="funcparam">target</span></td>
+
+
+<td>new serialized buffer to deserialize.</td></tr>
+</table><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">void
+<span class="currsymbol">bufferConsumed</span>
+<script>explorer.outline.addDecl('bufferConsumed');</script>
+
+(in size_t <span class="funcparam">size</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Consumes buffer. This method is helper for buffer property.
+ You must use this method if you write bytes to buffer directly.
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">size_t <span class="funcparam">size</span></td>
+
+
+<td>the number of consuming.</td></tr>
+</table><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">void
+<span class="currsymbol">removeUnparsed</span>
+<script>explorer.outline.addDecl('removeUnparsed');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Removes unparsed buffer.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">const size_t
+<span class="currsymbol">size</span>
+<script>explorer.outline.addDecl('size');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd><b>Returns:</b><br>
+the total
+<span class="currsymbol">size</span>
+<script>explorer.outline.addDecl('size');</script>
+
+ including unparsed buffer
+<span class="currsymbol">size</span>
+<script>explorer.outline.addDecl('size');</script>
+
+.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">const size_t
+<span class="currsymbol">parsedSize</span>
+<script>explorer.outline.addDecl('parsedSize');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd><b>Returns:</b><br>
+the parsed size of buffer.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">const size_t
+<span class="currsymbol">unparsedSize</span>
+<script>explorer.outline.addDecl('unparsedSize');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd><b>Returns:</b><br>
+the unparsed size of buffer.<br><br>
+
+</dd>
+</dl>
+<script>explorer.outline.decSymbolLevel();</script>
+
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">struct
+<span class="currsymbol">Unpacker</span>
+<script>explorer.outline.addDecl('Unpacker');</script>
+
+;
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>This <b>
+<span class="currsymbol">Unpacker</span>
+<script>explorer.outline.addDecl('Unpacker');</script>
+
+</b>
+ is a <b>MessagePack</b>
+ direct-conversion deserializer
+<br><br>
+This implementation is suitable for fixed data.
+
+<br><br>
+<b>Example:</b><br>
+<pre class="d_code"> <font color=green>// serializedData is [10, 0.1, false]
+</font> <font color=blue>auto</font> unpacker = <u>Unpacker</u>(serializedData);
+
+ <font color=blue>uint</font> n;
+ <font color=blue>double</font> d;
+ <font color=blue>bool</font> b;
+
+ unpacker.unpackArray(n, d, b);
+
+ <font color=green>// using Tuple
+</font> Tuple!(<font color=blue>uint</font>, <font color=blue>double</font>, <font color=blue>bool</font>) record;
+ unpacker.unpack(record); <font color=green>// record is [10, 0.1, false]
+</font></pre>
+
+<br><br>
+<b>NOTE:</b><br>
+
+<span class="currsymbol">Unpacker</span>
+<script>explorer.outline.addDecl('Unpacker');</script>
+
+ becomes template struct if Phobos supports truly IO module.<br><br>
+
+
+<script>explorer.outline.incSymbolLevel();</script>
+<dl>
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">@safe this(const(ubyte[]) <span class="funcparam">target</span>, const(ulong) <span class="funcparam">bufferSize</span> = cast(const(ulong))8192);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Constructs a <b>Unpacker</b>
+.
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">const(ubyte[]) <span class="funcparam">target</span></td>
+
+
+<td>byte buffer to deserialize</td></tr>
+<tr>
+<td nowrap valign="top" style="padding-right: 8px">const(ulong) <span class="funcparam">bufferSize</span></td>
+
+
+<td>size limit of buffer size</td></tr>
+</table><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">nothrow @safe void
+<span class="currsymbol">clear</span>
+<script>explorer.outline.addDecl('clear');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Clears states for next deserialization.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(ref T <span class="funcparam">value</span>);
+<br>Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(ref T <span class="funcparam">value</span>);
+<br>Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(ref T <span class="funcparam">value</span>);
+<br>Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(ref T <span class="funcparam">value</span>);
+<br>Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(ref T <span class="funcparam">value</span>);
+<br>Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(T <span class="funcparam">value</span>);
+<br>Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(Types...)(ref Types <span class="funcparam">objects</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Deserializes <i>T</i> object and assigns to <i>value</i>.
+<br><br>
+If the argument is pointer, dereferences pointer and assigns deserialized value.
+<pre class="d_code"> <font color=blue>int</font>* a;
+ unpacker.<u>unpack</u>(a) <font color=green>// enforce throws Exception because a is null or
+</font> <font color=green>// no throw if deserialized value is nil
+</font>
+ <font color=blue>int</font> b; a = &amp;b;
+ unpacker.<u>unpack</u>(b) <font color=green>// b is deserialized value or
+</font> <font color=green>// assigns null if deserialized value is nil
+</font></pre>
+
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">value</td>
+
+
+<td>the reference of value to assign.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+self, i.e. for method chaining.
+
+<br><br>
+<b>Throws:</b><br>
+UnpackException when doesn't read from buffer or precision loss occurs and
+ MessagePackException when <i>T</i> type doesn't match serialized type.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(ref T <span class="funcparam">array</span>);
+<br>Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(ref T <span class="funcparam">array</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Deserializes <i>T</i> object and assigns to <i>array</i>.
+<br><br>
+This is convenient method for array deserialization.
+ Rollback will be completely successful if you deserialize raw type((u)byte[] or string types).
+ But, Rollback will be one element(e.g. int) if you deserialize other types(e.g. int[], int[int])
+<br><br>
+
+ No assign if the length of deserialized object is 0.
+<br><br>
+
+ In a static array, this method checks the length. Do rollback and throw exception
+ if length of <i>array</i> is different from length of deserialized object.
+
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">array</td>
+
+
+<td>the reference of array to assign.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+self, i.e. for method chaining.
+
+<br><br>
+<b>Throws:</b><br>
+UnpackException when doesn't read from buffer or precision loss occurs and
+ MessagePackException when <i>T</i> type doesn't match serialized type.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T, Args...)(ref T <span class="funcparam">object</span>, auto ref Args <span class="funcparam">args</span>);
+<br>Unpacker
+<span class="currsymbol">unpack</span>
+<script>explorer.outline.addDecl('unpack');</script>
+
+(T)(ref T <span class="funcparam">object</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Deserializes <i>T</i> object and assigns to <i>object</i>.
+<br><br>
+Calling <b>fromMsgpack</b>
+ if <font color=blue>class</font> and <font color=blue>struct</font> implement <b>fromMsgpack</b>
+ method. <b>fromMsgpack</b>
+ signature is:
+<pre class="d_code"> <font color=blue>void</font> fromMsgpack(<font color=blue>ref</font> Unpacker unpacker)
+</pre>
+ Assumes <b>std.typecons.Tuple</b>
+ or simple struct if <font color=blue>struct</font> doesn't implement <b>fromMsgpack</b>
+.
+ Checks length if <i>T</i> is a <b>std.typecons.Tuple</b>
+ or simple struct.
+
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">object</td>
+
+
+<td>the reference of object to assign.</td></tr>
+<tr>
+<td nowrap valign="top" style="padding-right: 8px">args</td>
+
+
+<td>the arguments to class constructor(class only).
+ This is used at new statement if <i>object</i> is <font color=blue><b>null</b></font>.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+self, i.e. for method chaining.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">Unpacker
+<span class="currsymbol">unpackArray</span>
+<script>explorer.outline.addDecl('unpackArray');</script>
+
+(Types...)(ref Types <span class="funcparam">objects</span>);
+<br>Unpacker
+<span class="currsymbol">unpackMap</span>
+<script>explorer.outline.addDecl('unpackMap');</script>
+
+(Types...)(ref Types <span class="funcparam">objects</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Deserializes the container object and assigns to each argument.
+<br><br>
+These methods check the length. Do rollback if
+ the length of arguments is different from length of deserialized object.
+<br><br>
+
+ In unpackMap, the number of arguments must be even.
+
+<br><br>
+<b>Params:</b><br>
+<table><tr>
+<td nowrap valign="top" style="padding-right: 8px">objects</td>
+
+
+<td>the references of object to assign.</td></tr>
+</table><br>
+<b>Returns:</b><br>
+self, i.e. for method chaining.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">@safe size_t
+<span class="currsymbol">beginArray</span>
+<script>explorer.outline.addDecl('beginArray');</script>
+
+();
+<br>@safe size_t
+<span class="currsymbol">beginMap</span>
+<script>explorer.outline.addDecl('beginMap');</script>
+
+();
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Deserializes the type-information of container.
+<br><br>
+These methods don't deserialize contents.
+ You need to call unpack method to deserialize contents at your own risk.
+<pre class="d_code"> <font color=green>// serialized data is [1, "Hi!"];
+</font> <font color=blue>int</font> num;
+ unpacker.<u>beginArray</u>(2).unpack(num); <font color=green>// num is 1
+</font>
+ <font color=green>// other operation
+</font>
+ string str;
+ unpacker.unpack(str); <font color=green>// str is "Hi!"
+</font></pre>
+
+<br><br>
+<b>Returns:</b><br>
+the container size.<br><br>
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">int
+<span class="currsymbol">scan</span>
+<script>explorer.outline.addDecl('scan');</script>
+
+(Types...)(scope int delegate(ref Types) <span class="funcparam">dg</span>);
+<br>int
+<span class="currsymbol">opApply</span>
+<script>explorer.outline.addDecl('opApply');</script>
+
+(Types...)(scope int delegate(ref Types) <span class="funcparam">dg</span>);
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd>Scans an entire buffer and converts each objects.
+<br><br>
+This method is used for unpacking record-like objects.
+
+<br><br>
+<b>Example:</b><br>
+<pre class="d_code"> <font color=green>// serialized data is "[1, 2][3, 4][5, 6][...".
+</font> <font color=blue>auto</font> unpacker = Unpacker(serializedData);
+ <font color=blue>foreach</font> (n, d; &amp;unpacker.<u>scan</u>!(<font color=blue>int</font>, <font color=blue>int</font>)) <font color=green>// == "foreach (int n, int d; unpacker)"
+</font> writeln(n, d); <font color=green>// 1st loop "1, 2", 2nd loop "3, 4"...
+</font></pre>
+<br><br>
+
+</dd>
+</dl>
+<script>explorer.outline.decSymbolLevel();</script>
+
+
+</dd>
+
+<script>explorer.outline.writeEnabled = true;</script>
+<dt><span class="decl">struct
+<span class="currsymbol">Value</span>
+<script>explorer.outline.addDecl('Value');</script>
+
+;
+</span></dt>
+<script>explorer.outline.writeEnabled = false;</script>
+
+
+<dd><b>
+<span class="currsymbol">Value</span>
+<script>explorer.outline.addDecl('Value');</script>
+
+</b>
+ is a <b>MessagePack</b>
+ value representation
+<br><br>
+<b>Example:</b><br>
+<pre class="d_code"> <font color=blue>auto</font> unpacker = StreamingUnpacker(pack(1, 0.1L) ~ pack(<font color=blue>true</font>) ~ pack(<font color=red>"foobarbaz"</font>));
+
+ <font color=blue>foreach</font> (unpacked; unpacker) {
+ <font color=blue>if</font> (unpacked.type == <u>Value</u>.Type.array) {
+ <font color=blue>foreach</font> (obj; unpacked) {
+ <font color=blue>switch</font> (obj.type) {