SetValue() 공개 추상적인 메소드

public abstract SetValue ( DocumentObject dom, object val ) : void
dom DocumentObject
val object
리턴 void
예제 #1
0
        /// <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);
            }
        }
예제 #2
0
        /// <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);
            }
        }
예제 #3
0
파일: DdlParser.cs 프로젝트: Sl0vi/MigraDoc
        /// <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
        }