public abstract SetValue ( DocumentObject dom, object val ) : void | ||
dom | DocumentObject | |
val | object | |
Résultat | void |
/// <summary> /// Sets the member of dom specified by name to val. /// If a member with the specified name does not exist an ArgumentException will be thrown. /// </summary> public void SetValue(DocumentObject dom, string name, object val) { int dot = name.IndexOf('.'); if (dot == 0) { throw new ArgumentException(DomSR.InvalidValueName(name)); } string trail = null; if (dot > 0) { trail = name.Substring(dot + 1); name = name.Substring(0, dot); } ValueDescriptor vd = this.vds[name]; if (vd == null) { throw new ArgumentException(DomSR.InvalidValueName(name)); } if (trail != null) { //REVIEW DaSt: dom.GetValue(name) und rekursiv SetValue aufrufen, // oder dom.GetValue(name.BisVorletzteElement) und erst SetValue aufrufen. DocumentObject doc = dom.GetValue(name) as DocumentObject; doc.SetValue(trail, val); } else { vd.SetValue(dom, val); } }
/// <summary> /// Sets the member of dom specified by name to val. /// If a member with the specified name does not exist an ArgumentException will be thrown. /// </summary> public void SetValue(DocumentObject dom, string name, object val) { int dot = name.IndexOf('.'); if (dot == 0) { throw new ArgumentException(DomSR.InvalidValueName(name)); } string trail = null; if (dot > 0) { trail = name.Substring(dot + 1); name = name.Substring(0, dot); } ValueDescriptor vd = _vds[name]; if (vd == null) { throw new ArgumentException(DomSR.InvalidValueName(name)); } if (trail != null) { //REVIEW DaSt: dom.GetValue(name) and call SetValue recursively, // or dom.GetValue(name.BisVorletzteElement) and then call SetValue? DocumentObject doc = (DocumentObject)dom.GetValue(name); doc.SetValue(trail, val); } else { vd.SetValue(dom, val); } }
/// <summary> /// Parses the assignment to a string l-value. /// </summary> private void ParseStringAssignment(DocumentObject dom, ValueDescriptor vd) { AssertCondition(Symbol == Symbol.StringLiteral, DomMsgID.StringExpected, _scanner.Token); vd.SetValue(dom, Token); //dom.SetValue(vd.ValueName, scanner.Token); ReadCode(); // read next token }