maxGraph/docs/php-api/files/io/mxObjectCodec-php.html

115 lines
84 KiB
HTML
Raw Normal View History

2012-05-21 20:32:26 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
2017-06-27 11:43:19 +00:00
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>mxObjectCodec</title><link rel="stylesheet" type="text/css" href="../../styles/main.css"><script language=JavaScript src="../../javascript/main.js"></script><script language=JavaScript src="../../javascript/prettify.js"></script><script language=JavaScript src="../../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
2012-05-21 20:32:26 +00:00
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
2017-06-27 11:43:19 +00:00
<!-- Generated by Natural Docs, version 1.51 -->
2012-05-21 20:32:26 +00:00
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="mxObjectCodec"></a>mxObjectCodec</h1><div class=CBody><p>XML codec for PHP object graphs.</p><h4 class=CHeading>Implementation note</h4><p>The passing of the argument by reference in <a href="#mxObjectCodec.decode" class=LFunction id=link43 onMouseOver="ShowTip(event, 'tt23', 'link43')" onMouseOut="HideTip('tt23')">decode</a>, <a href="#mxObjectCodec.decodeNode" class=LFunction id=link44 onMouseOver="ShowTip(event, 'tt24', 'link44')" onMouseOut="HideTip('tt24')">decodeNode</a>, <a href="#mxObjectCodec.decodeAttributes" class=LFunction id=link45 onMouseOver="ShowTip(event, 'tt25', 'link45')" onMouseOut="HideTip('tt25')">decodeAttributes</a>, <a href="#mxObjectCodec.decodeAttribute" class=LFunction id=link46 onMouseOver="ShowTip(event, 'tt27', 'link46')" onMouseOut="HideTip('tt27')">decodeAttribute</a>, <a href="#mxObjectCodec.decodeChildren" class=LFunction id=link47 onMouseOver="ShowTip(event, 'tt26', 'link47')" onMouseOut="HideTip('tt26')">decodeChildren</a>, <a href="#mxObjectCodec.decodeChild" class=LFunction id=link48 onMouseOver="ShowTip(event, 'tt28', 'link48')" onMouseOut="HideTip('tt28')">decodeChild</a>, <a href="#mxObjectCodec.beforeDecode" class=LFunction id=link49 onMouseOver="ShowTip(event, 'tt32', 'link49')" onMouseOut="HideTip('tt32')">beforeDecode</a> and <a href="#mxObjectCodec.afterDecode" class=LFunction id=link50 onMouseOver="ShowTip(event, 'tt33', 'link50')" onMouseOut="HideTip('tt33')">afterDecode</a> is required since the object may be an array instance, which needs an explicit reference operator even in PHP 5 to be changed in-place.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#mxObjectCodec" >mxObjectCodec</a></td><td class=SDescription>XML codec for PHP object graphs.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#mxObjectCodec.Variables" >Variables</a></td><td class=SDescription></td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#mxObjectCodec.template" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">template</a></td><td class=SDescription>Holds the template object associated with this codec.</td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#mxObjectCodec.exclude" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">exclude</a></td><td class=SDescription>Array containing the variable names that should be ignored by the codec.</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#mxObjectCodec.idrefs" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">idrefs</a></td><td class=SDescription>Array containing the variable names that should be turned into or converted from references. </td></tr><tr class="SVariable SIndent2"><td class=SEntry><a href="#mxObjectCodec.mapping" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">mapping</a></td><td class=SDescription>Maps from from fieldnames to XML attribute names.</td></tr><tr class="SVariable SIndent2 SMarked"><td class=SEntry><a href="#mxObjectCodec.reverse" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">reverse</a></td><td class=SDescription>Maps from from XML attribute names to fieldnames.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#mxObjectCodec.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#mxObjectCodec.mxObjectCodec" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">mxObjectCodec</a></td><td class=SDescription>Constructs a new codec for the specified template object. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#mxObjectCodec.getName" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">ge
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.Variables"></a>Variables</h3></div></div>
2017-06-27 11:43:19 +00:00
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.template"></a>template</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $template</td></tr></table></blockquote><p>Holds the template object associated with this codec.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.exclude"></a>exclude</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $exclude</td></tr></table></blockquote><p>Array containing the variable names that should be ignored by the codec.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.idrefs"></a>idrefs</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $idrefs</td></tr></table></blockquote><p>Array containing the variable names that should be turned into or converted from references.&nbsp; See <a href="mxCodec-php.html#mxCodec.getId" class=LFunction id=link51 onMouseOver="ShowTip(event, 'tt34', 'link51')" onMouseOut="HideTip('tt34')">mxCodec.getId</a> and <a href="mxCodec-php.html#mxCodec.getObject" class=LFunction id=link52 onMouseOver="ShowTip(event, 'tt35', 'link52')" onMouseOut="HideTip('tt35')">mxCodec.getObject</a>.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.mapping"></a>mapping</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $mapping</td></tr></table></blockquote><p>Maps from from fieldnames to XML attribute names.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CVariable"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.reverse"></a>reverse</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $reverse</td></tr></table></blockquote><p>Maps from from XML attribute names to fieldnames.</p></div></div></div>
2012-05-21 20:32:26 +00:00
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.Functions"></a>Functions</h3></div></div>
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.mxObjectCodec"></a>mxObjectCodec</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function mxObjectCodec(</td><td class="PParameter prettyprint " nowrap>$template,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$exclude</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> array(),</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$idrefs</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> array(),</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$mapping</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> array()</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Constructs a new codec for the specified template object.&nbsp; The variables in the optional exclude array are ignored by the codec.&nbsp; Variables in the optional idrefs array are turned into references in the XML.&nbsp; The optional mapping may be used to map from variable names to XML attributes.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>template</td><td class=CDLDescription>Prototypical instance of the object to be encoded/decoded.</td></tr><tr><td class=CDLEntry>exclude</td><td class=CDLDescription>Optional array of fieldnames to be ignored.</td></tr><tr><td class=CDLEntry>idrefs</td><td class=CDLDescription>Optional array of fieldnames to be converted to/from references.</td></tr><tr><td class=CDLEntry>mapping</td><td class=CDLDescription>Optional mapping from field- to attributenames.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.getName"></a>getName</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">function getName()</td></tr></table></blockquote><p>Creates a new instance of the template for this codec.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.cloneTemplate"></a>cloneTemplate</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">function cloneTemplate()</td></tr></table></blockquote><p>Creates a new instance of the template for this codec.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.getFieldName"></a>getFieldName</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getFieldName(</td><td class="PParameter prettyprint " nowrap>$attributename</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the fieldname for the given attributename.&nbsp; Looks up the value in the <a href="#mxObjectCodec.reverse" class=LVariable id=link53 onMouseOver="ShowTip(event, 'tt5', 'link53')" onMouseOut="HideTip('tt5')">reverse</a> mapping or returns the input if there is no reverse mapping for the given name.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.getAttributeName"></a>getAttributeName</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getAttributeName(</td><td class="PParameter prettyprint " nowrap>$fieldname</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the attributename for the given fieldname.&nbsp; Looks up the value in the <a href="#mxObjectCodec.mapping" class=LVariable id=link54 onMouseOver="ShowTip(event, 'tt4', 'link54')" onMouseOut="HideTip('tt4')">mapping</a> or returns the input if there is no mapping for the given name.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.isExcluded"></a>isExcluded</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function isExcluded(</td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$attr,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$value,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$write</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given attribute is to be ignored by the codec.&nbsp; This implementation returns true if the given fieldname is in <a href="#mxObjectCodec.exclude" class=LVariable id=link55 onMouseOver="ShowTip(event, 'tt2', 'link55')" onMouseOut="HideTip('tt2')">exclude</a> or if the fieldname equals &lt;mxObjectIdentity.FIELD_NAME&gt;.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object instance that contains the field.</td></tr><tr><td class=CDLEntry>attr</td><td class=CDLDescription>Fieldname of the field.</td></tr><tr><td class=CDLEntry>value</td><td class=CDLDescription>Value of the field.</td></tr><tr><td class=CDLEntry>write</td><td class=CDLDescription>Boolean indicating if the field is being encoded or decoded.&nbsp; Write is true if the field is being encoded, else it is being decoded.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.isReference"></a>isReference</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function isReference(</td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$attr,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$value,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$write</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given fieldname is to be treated as a textual reference (ID).&nbsp; This implementation returns true if the given fieldname is in <a href="#mxObjectCodec.idrefs" class=LVariable id=link56 onMouseOver="ShowTip(event, 'tt3', 'link56')" onMouseOut="HideTip('tt3')">idrefs</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object instance that contains the field.</td></tr><tr><td class=CDLEntry>attr</td><td class=CDLDescription>Fieldname of the field.</td></tr><tr><td class=CDLEntry>value</td><td class=CDLDescription>Value of the field.</td></tr><tr><td class=CDLEntry>write</td><td class=CDLDescription>Boolean indicating if the field is being encoded or decoded.&nbsp; Write is true if the field is being encoded, else it is being decoded.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.encode"></a>encode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function encode(</td><td class="PParameter prettyprint " nowrap>$enc,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Encodes the specified object and returns a node representing then given object.&nbsp; Calls <a href="#mxObjectCodec.beforeEncode" class=LFunction id=link57 onMouseOver="ShowTip(event, 'tt21', 'link57')" onMouseOut="HideTip('tt21')">beforeEncode</a> after creating the node and <a href="#mxObjectCodec.afterEncode" class=LFunction id=link58 onMouseOver="ShowTip(event, 'tt22', 'link58')" onMouseOut="HideTip('tt22')">afterEncode</a> with the resulting node after processing.</p><p>Enc is a reference to the calling encoder.&nbsp; It is used to encode complex objects and create references.</p><p>This implementation encodes all variables of an object according to the following rules:</p><ul><li>If the variable name is in <a href="#mxObjectCodec.exclude" class=LVariable id=link59 onMouseOver="ShowTip(event, 'tt2', 'link59')" onMouseOut="HideTip('tt2')">exclude</a> then it is ignored.</li><li>If the variable name is in <a href="#mxObjectCodec.idrefs" class=LVariable id=link60 onMouseOver="ShowTip(event, 'tt3', 'link60')" onMouseOut="HideTip('tt3')">idrefs</a> then <a href="mxCodec-php.html#mxCodec.getId" class=LFunction id=link61 onMouseOver="ShowTip(event, 'tt34', 'link61')" onMouseOut="HideTip('tt34')">mxCodec.getId</a> is used to replace the object with its ID.</li><li>The variable name is mapped using <a href="#mxObjectCodec.mapping" class=LVariable id=link62 onMouseOver="ShowTip(event, 'tt4', 'link62')" onMouseOut="HideTip('tt4')">mapping</a>.</li><li>If obj is an array and the variable name is numeric (ie. an index) then it is not encoded.</li><li>If the value is an object, then the codec is used to create a child node with the variable name encoded into the &ldquo;as&rdquo; attribute.</li><li>Else, if &lt;encodeDefaults&gt; is true or the value differs from the template value, then ...</li><li>... if obj is not an array, then the value is mapped to an attribute.</li><li>... else if obj is an array, the value is mapped to an add child with a value attribute or a text child node, if the value is a function.</li></ul><p>If no ID exists for a variable in <a href="#mxObjectCodec.idrefs" class=LVariable id=link63 onMouseOver="ShowTip(event, 'tt3', 'link63')" onMouseOut="HideTip('tt3')">idrefs</a> or if an object cannot be encoded, a warning is issued using <a href="../util/mxLog-php.html#mxLog.warn" class=LFunction id=link64 onMouseOver="ShowTip(event, 'tt36', 'link64')" onMouseOut="HideTip('tt36')">mxLog.warn</a>.</p><p>Returns the resulting XML node that represents the given object.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>enc</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link65 onMouseOver="ShowTip(event, 'tt37', 'link65')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to be encoded.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.encodeObject"></a>encodeObject</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function encodeObject(</td><td class="PParameter prettyprint " nowrap>$enc,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Encodes the value of each member in then given obj into the given node using <a href="#mxObjectCodec.encodeValue" class=LFunction id=link66 onMouseOver="ShowTip(event, 'tt15', 'link66')" onMouseOut="HideTip('tt15')">encodeValue</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>enc</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link67 onMouseOver="ShowTip(event, 'tt37', 'link67')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to be encoded.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node that contains the encoded object.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.encodeValue"></a>encodeValue</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function encodeValue(</td><td class="PParameter prettyprint " nowrap>$enc,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$name,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$value,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Converts the given value according to the mappings and id-refs in this codec and uses <a href="#mxObjectCodec.writeAttribute" class=LFunction id=link68 onMouseOver="ShowTip(event, 'tt16', 'link68')" onMouseOut="HideTip('tt16')">writeAttribute</a> to write the attribute into the given node.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>enc</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link69 onMouseOver="ShowTip(event, 'tt37', 'link69')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object whose property is going to be encoded.</td></tr><tr><td class=CDLEntry>name</td><td class=CDLDescription>XML node that contains the encoded object.</td></tr><tr><td class=CDLEntry>value</td><td class=CDLDescription>Value of the property to be encoded.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node that contains the encoded object.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.writeAttribute"></a>writeAttribute</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function writeAttribute(</td><td class="PParameter prettyprint " nowrap>$enc,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$attr,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$value,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Writes the given value into node using <a href="#mxObjectCodec.writePrimitiveAttribute" class=LFunction id=link70 onMouseOver="ShowTip(event, 'tt17', 'link70')" onMouseOut="HideTip('tt17')">writePrimitiveAttribute</a> or <a href="#mxObjectCodec.writeComplexAttribute" class=LFunction id=link71 onMouseOver="ShowTip(event, 'tt18', 'link71')" onMouseOut="HideTip('tt18')">writeComplexAttribute</a> depending on the type of the value.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.writePrimitiveAttribute"></a>writePrimitiveAttribute</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function writePrimitiveAttribute(</td><td class="PParameter prettyprint " nowrap>$enc,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$attr,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$value,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Writes the given value as an attribute of the given node.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.writeComplexAttribute"></a>writeComplexAttribute</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function writeComplexAttribute(</td><td class="PParameter prettyprint " nowrap>$enc,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$attr,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$value,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Writes the given value as a child node of the given node.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.convertValueToXml"></a>convertValueToXml</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function convertValueToXml(</td><td class="PParameter prettyprint " nowrap>$value</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the given value without applying a conversion.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.convertValueFromXml"></a>convertValueFromXml</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function convertValueFromXml(</td><td class="PParameter prettyprint " nowrap>$value</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the given value.&nbsp; In PHP there is no need to convert the boolean strings &ldquo;0&rdquo; and &ldquo;1&rdquo; to their numeric / boolean values.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.beforeEncode"></a>beforeEncode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function beforeEncode(</td><td class="PParameter prettyprint " nowrap>$enc,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to pre-process the object before encoding.&nbsp; This returns the input object.&nbsp; The return value of this function is used in <a href="#mxObjectCodec.encode" class=LFunction id=link72 onMouseOver="ShowTip(event, 'tt13', 'link72')" onMouseOut="HideTip('tt13')">encode</a> to perform the default encoding into the given node.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>enc</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link73 onMouseOver="ShowTip(event, 'tt37', 'link73')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to be encoded.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to encode the object into.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.afterEncode"></a>afterEncode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function afterEncode(</td><td class="PParameter prettyprint " nowrap>$enc,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to post-process the node for the given object after encoding and return the post-processed node.&nbsp; This implementation returns the input node.&nbsp; The return value of this method is returned to the encoder from <a href="#mxObjectCodec.encode" class=LFunction id=link74 onMouseOver="ShowTip(event, 'tt13', 'link74')" onMouseOut="HideTip('tt13')">encode</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>enc</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link75 onMouseOver="ShowTip(event, 'tt37', 'link75')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to be encoded.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node that represents the default encoding.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.decode"></a>decode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decode(</td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$dec,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$node,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$into</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> null</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Parses the given node into the object or returns a new object representing the given node.</p><p>Dec is a reference to the calling decoder.&nbsp; It is used to decode complex objects and resolve references.</p><p>If a node has an id attribute then the object cache is checked for the object.&nbsp; If the object is not yet in the cache then it is constructed using the constructor of <a href="#mxObjectCodec.template" class=LVariable id=link76 onMouseOver="ShowTip(event, 'tt1', 'link76')" onMouseOut="HideTip('tt1')">template</a> and cached in <a href="mxCodec-php.html#mxCodec.objects" class=LVariable id=link77 onMouseOver="ShowTip(event, 'tt38', 'link77')" onMouseOut="HideTip('tt38')">mxCodec.objects</a>.</p><p>This implementation decodes all attributes and childs of a node according to the following rules:</p><ul><li>If the variable name is in <a href="#mxObjectCodec.exclude" class=LVariable id=link78 onMouseOver="ShowTip(event, 'tt2', 'link78')" onMouseOut="HideTip('tt2')">exclude</a> or if the attribute name is &ldquo;id&rdquo; or &ldquo;as&rdquo; then it is ignored.</li><li>If the variable name is in <a href="#mxObjectCodec.idrefs" class=LVariable id=link79 onMouseOver="ShowTip(event, 'tt3', 'link79')" onMouseOut="HideTip('tt3')">idrefs</a> then <a href="mxCodec-php.html#mxCodec.getObject" class=LFunction id=link80 onMouseOver="ShowTip(event, 'tt35', 'link80')" onMouseOut="HideTip('tt35')">mxCodec.getObject</a> is used to replace the reference with an object.</li><li>The variable name is mapped using a reverse <a href="#mxObjectCodec.mapping" class=LVariable id=link81 onMouseOver="ShowTip(event, 'tt4', 'link81')" onMouseOut="HideTip('tt4')">mapping</a>.</li><li>If the value has a child node, then the codec is used to create a child object with the variable name taken from the &ldquo;as&rdquo; attribute.</li><li>If the object is an array and the variable name is empty then the value or child object is appended to the array.</li><li>If an add child has no value or the object is not an array then the child text content is evaluated using &lt;mxUtils.eval&gt;.</li></ul><p>For add nodes where the object is not an array and the variable name is defined, the default mechanism is used, allowing to override/add methods as follows:</p><blockquote><pre class="prettyprint">&lt;Object&gt;
2012-05-21 20:32:26 +00:00
&lt;add as=&quot;hello&quot;&gt;&lt;![CDATA[
function(arg1) {
alert('Hello '+arg1);
}
]]&gt;&lt;/add&gt;
&lt;/Object&gt;</pre></blockquote><p>If no object exists for an ID in <a href="#mxObjectCodec.idrefs" class=LVariable id=link82 onMouseOver="ShowTip(event, 'tt3', 'link82')" onMouseOut="HideTip('tt3')">idrefs</a> a warning is issued using <a href="../util/mxLog-php.html#mxLog.warn" class=LFunction id=link83 onMouseOver="ShowTip(event, 'tt36', 'link83')" onMouseOut="HideTip('tt36')">mxLog.warn</a>.</p><p>Returns the resulting object that represents the given XML node or the object given to the method as the into parameter.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>dec</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link84 onMouseOver="ShowTip(event, 'tt37', 'link84')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the decoding process.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to be decoded.</td></tr><tr><td class=CDLEntry>into</td><td class=CDLDescription>Optional objec to encode the node into.</td></tr></table></div></div></div>
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.decodeNode"></a>decodeNode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decodeNode(</td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$dec,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$node,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Calls <a href="#mxObjectCodec.decodeAttributes" class=LFunction id=link85 onMouseOver="ShowTip(event, 'tt25', 'link85')" onMouseOut="HideTip('tt25')">decodeAttributes</a> and <a href="#mxObjectCodec.decodeChildren" class=LFunction id=link86 onMouseOver="ShowTip(event, 'tt26', 'link86')" onMouseOut="HideTip('tt26')">decodeChildren</a> for the given node.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.decodeAttributes"></a>decodeAttributes</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decodeAttributes(</td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$dec,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$node,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Decodes all attributes of the given node using <a href="#mxObjectCodec.decodeAttribute" class=LFunction id=link87 onMouseOver="ShowTip(event, 'tt27', 'link87')" onMouseOut="HideTip('tt27')">decodeAttribute</a>.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.decodeAttribute"></a>decodeAttribute</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decodeAttribute(</td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$dec,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$attr,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Reads the given attribute into the specified object.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.decodeChildren"></a>decodeChildren</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decodeChildren(</td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$dec,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$node,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Decodec all children of the given node using <a href="#mxObjectCodec.decodeChild" class=LFunction id=link88 onMouseOver="ShowTip(event, 'tt28', 'link88')" onMouseOut="HideTip('tt28')">decodeChild</a>.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.decodeChild"></a>decodeChild</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function decodeChild(</td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$dec,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$child,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Reads the specified child into the given object.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.getFieldTemplate"></a>getFieldTemplate</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getFieldTemplate(</td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$fieldname,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$child</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the template instance for the given field.&nbsp; This returns the value of the field, null if the value is an array or an empty collection if the value is a collection.&nbsp; The value is then used to populate the field for a new instance.&nbsp; For strongly typed languages it may be required to override this to return the correct collection instance based on the encoded child.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.addObjectValue"></a>addObjectValue</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function addObjectValue(</td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$fieldname,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$value,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$template</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the decoded child node as a value of the given object.&nbsp; If the object is a map, then the value is added with the given fieldname as a key.&nbsp; If the fieldname is not empty, then setFieldValue is called or else, if the object is a collection, the value is added to the collection.&nbsp; For strongly typed languages it may be required to override this with the correct code to add an entry to an object.</p></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.processInclude"></a>processInclude</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function processInclude(</td><td class="PParameter prettyprint " nowrap>$dec,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$node,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$into</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given node is an include directive and executes the include by decoding the XML document.&nbsp; Returns false if the given node is not an include directive.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>dec</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link89 onMouseOver="ShowTip(event, 'tt37', 'link89')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding/decoding process.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to be checked.</td></tr><tr><td class=CDLEntry>into</td><td class=CDLDescription>Optional object to pass-thru to the codec.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.beforeDecode"></a>beforeDecode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function beforeDecode(</td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$dec,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$node,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to pre-process the node for the specified object and return the node to be used for further processing by <a href="#mxObjectCodec.decode" class=LFunction id=link90 onMouseOver="ShowTip(event, 'tt23', 'link90')" onMouseOut="HideTip('tt23')">decode</a>.&nbsp; The object is created based on the template in the calling method and is never null.&nbsp; This implementation returns the input node.&nbsp; The return value of this function is used in <a href="#mxObjectCodec.decode" class=LFunction id=link91 onMouseOver="ShowTip(event, 'tt23', 'link91')" onMouseOut="HideTip('tt23')">decode</a> to perform the default decoding into the given object.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>dec</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link92 onMouseOver="ShowTip(event, 'tt37', 'link92')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the decoding process.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to be decoded.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object to encode the node into.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
2017-06-27 11:43:19 +00:00
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="mxObjectCodec.afterDecode"></a>afterDecode</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function afterDecode(</td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$dec,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap></td><td class="PParameter prettyprint " nowrap>$node,</td></tr><tr><td></td><td class="PParameterPrefix prettyprint " nowrap>&amp;</td><td class="PParameter prettyprint " nowrap>$obj</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Hook for subclassers to post-process the object after decoding.&nbsp; This implementation returns the given object without any changes.&nbsp; The return value of this method is returned to the decoder from <a href="#mxObjectCodec.decode" class=LFunction id=link93 onMouseOver="ShowTip(event, 'tt23', 'link93')" onMouseOut="HideTip('tt23')">decode</a>.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>enc</td><td class=CDLDescription><a href="mxCodec-php.html#mxCodec" class=LClass id=link94 onMouseOver="ShowTip(event, 'tt37', 'link94')" onMouseOut="HideTip('tt37')">mxCodec</a> that controls the encoding process.</td></tr><tr><td class=CDLEntry>node</td><td class=CDLDescription>XML node to be decoded.</td></tr><tr><td class=CDLEntry>obj</td><td class=CDLDescription>Object that represents the default decoding.</td></tr></table></div></div></div>
2012-05-21 20:32:26 +00:00
</div><!--Content-->
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
2017-06-27 11:43:19 +00:00
<div id=Menu><div class=MEntry><div class=MFile><a href="../index-txt.html">API Specification</a></div></div><div class=MEntry><div class=MFile><a href="../canvas/mxGdCanvas-php.html">canvas/<wbr>mxGdCanvas.php</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Io</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="mxCellCodec-php.html">mxCellCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxCodec-php.html">mxCodec</a></div></div><div class=MEntry><div class=MFile><a href="mxCodecRegistry-php.html">mxCodecRegistry</a></div></div><div class=MEntry><div class=MFile><a href="mxModelCodec-php.html">mxModelCodec</a></div></div><div class=MEntry><div class=MFile id=MSelected>mxObjectCodec</div></div><div class=MEntry><div class=MFile><a href="mxStylesheetCodec-php.html">mxStylesheetCodec</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Model</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="../model/mxCell-php.html">mxCell</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxCellPath-php.html">mxCellPath</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxGeometry-php.html">mxGeometry</a></div></div><div class=MEntry><div class=MFile><a href="../model/mxGraphModel-php.html">mxGraphModel</a></div></div></div></div></div><div class=MEntry><div class=MFile><a href="../reader/mxGraphViewHtmlReader-php.html">mxGraphViewHtmlReader</a></div></div><div class=MEntry><div class=MFile><a href="../reader/mxGraphViewImageReader-php.html">mxGraphViewImageReader</a></div></div><div class=MEntry><div class=MFile><a href="../canvas/mxHtmlCanvas-php.html">mxHtmlCanvas</a></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Util</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MFile><a href="../util/mxConstants-php.html">mxConstants</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEvent-php.html">mxEvent</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEventObject-php.html">mxEventObject</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxEventSource-php.html">mxEventSource</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxImageBundle-php.html">mxImageBundle</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxLog-php.html">mxLog</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxPoint-php.html">mxPoint</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxRectangle-php.html">mxRectangle</a></div></div><div class=MEntry><div class=MFile><a href="../util/mxUtils-php.html">mxUtils</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent4')">View</a><div class=MGroupContent id=MGroupContent4><div class=MEntry><div class=MFile><a href="../view/mxCellState-php.html">mxCellState</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxConnectionConstraint-php.html">mxConnectionConstraint</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxEdgeStyle-php.html">mxEdgeStyleFunction</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxGraph-php.html">mxGraph</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxGraphView-php.html">mxGraphView</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxPerimeter-php.html">mxPerimeterFunction</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxStyleRegistry-php.html">mxStyleRegistry</a></div></div><div class=MEntry><div class=MFile><a href="../view/mxStylesheet-php.html">mxStylesheet</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent5')">Index</a><div class=MGroupContent id=MGroupContent5><div class=MEntry><div class=MIndex><a href="../../index/General.html">Everyth
2012-05-21 20:32:26 +00:00
var searchPanel = new SearchPanel("searchPanel", "HTML", "../../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Files">Files</option><option value="Functions">Functions</option><option value="Interfaces">Interfaces</option><option value="Variables">Variables</option></select></div><script language=JavaScript><!--
HideAllBut([1, 2, 3], 6);// --></script></div><!--Menu-->
<!--START_ND_TOOLTIPS-->
2017-06-27 11:43:19 +00:00
<div class=CToolTip id="tt1"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $template</td></tr></table></blockquote>Holds the template object associated with this codec.</div></div><div class=CToolTip id="tt2"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $exclude</td></tr></table></blockquote>Array containing the variable names that should be ignored by the codec.</div></div><div class=CToolTip id="tt3"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $idrefs</td></tr></table></blockquote>Array containing the variable names that should be turned into or converted from references. </div></div><div class=CToolTip id="tt4"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $mapping</td></tr></table></blockquote>Maps from from fieldnames to XML attribute names.</div></div><div class=CToolTip id="tt5"><div class=CVariable><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">var $reverse</td></tr></table></blockquote>Maps from from XML attribute names to fieldnames.</div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function mxObjectCodec(</td><td class="PParameter prettyprint " nowrap>$template,</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;&nbsp;</td><td class="PDefaultValue prettyprint " width=100%></td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$exclude</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> array(),</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$idrefs</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> array(),</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>$mapping</td><td class="PDefaultValuePrefix prettyprint ">&nbsp;=&nbsp;</td><td class="PDefaultValue prettyprint " width=100%> array()</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Constructs a new codec for the specified template object. </div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">function getName()</td></tr></table></blockquote>Creates a new instance of the template for this codec.</div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">function cloneTemplate()</td></tr></table></blockquote>Creates a new instance of the template for this codec.</div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getFieldName(</td><td class="PParameter prettyprint " nowrap>$attributename</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the fieldname for the given attributename. </div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>function getAttributeName(</td><td class="PParameter prettyprint " nowrap>$fieldname</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the attributename for the given fieldname. </div></div><div class=CToolTip id="
2012-05-21 20:32:26 +00:00
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>