当前位置: 首页>>代码示例>>C#>>正文


C# DocumentObject.SetValue方法代码示例

本文整理汇总了C#中DocumentObject.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentObject.SetValue方法的具体用法?C# DocumentObject.SetValue怎么用?C# DocumentObject.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocumentObject的用法示例。


在下文中一共展示了DocumentObject.SetValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseValueAssignment

        /// <summary>
        /// Parses the assignment to a Value l-value.
        /// </summary>
        private void ParseValueAssignment(DocumentObject dom, ValueDescriptor vd)
        {
            try
            {
                // What ever it is, send it to SetValue.
                dom.SetValue(vd.ValueName, Token);
            }
            catch (Exception ex)
            {
                ThrowParserException(ex, DomMsgID.InvalidEnum, _scanner.Token, vd.ValueName);
            }

            ReadCode();  // read next token
        }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:17,代码来源:DdlParser.cs

示例2: ParseColorAssignment

 /// <summary>
 /// Parses the assignment to a Color l-value.
 /// </summary>
 private void ParseColorAssignment(DocumentObject dom, ValueDescriptor vd)
 {
     object val = vd.GetValue(dom, GV.ReadWrite);
     Color color = ParseColor();
     dom.SetValue(vd.ValueName, color);
 }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:9,代码来源:DdlParser.cs

示例3: ParseEnumAssignment

        /// <summary>
        /// Parses the assignment to an enum l-value.
        /// </summary>
        private void ParseEnumAssignment(DocumentObject dom, ValueDescriptor vd)
        {
            AssertSymbol(Symbol.Identifier, DomMsgID.IdentifierExpected, _scanner.Token);

            try
            {
                object val = Enum.Parse(vd.ValueType, Token, true);
                dom.SetValue(vd.ValueName, val);
            }
            catch (Exception ex)
            {
                ThrowParserException(ex, DomMsgID.InvalidEnum, _scanner.Token, vd.ValueName);
            }

            ReadCode();  // read next token
        }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:19,代码来源:DdlParser.cs

示例4: ParseValueTypeAssignment

 /// <summary>
 /// Parses the assignment to a struct (i.e. LeftPosition) l-value.
 /// </summary>
 private void ParseValueTypeAssignment(DocumentObject dom, ValueDescriptor vd)
 {
     object val = vd.GetValue(dom, GV.ReadWrite);
     try
     {
         INullableValue ival = (INullableValue)val;
         ival.SetValue(Token);
         dom.SetValue(vd.ValueName, val);
         ReadCode();
     }
     catch (Exception ex)
     {
         ReportParserException(ex, DomMsgID.InvalidAssignment, vd.ValueName);
     }
 }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:18,代码来源:DdlParser.cs

示例5: ParseUnitAssignment

        /// <summary>
        /// Parses the assignment to a Unit l-value.
        /// </summary>
        private void ParseUnitAssignment(DocumentObject dom, ValueDescriptor vd)
        {
            AssertCondition(Symbol == Symbol.RealLiteral || Symbol == Symbol.IntegerLiteral || Symbol == Symbol.StringLiteral,
              DomMsgID.RealExpected, _scanner.Token);

            Unit unit = Token;
            dom.SetValue(vd.ValueName, unit);
            ReadCode();
        }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:12,代码来源:DdlParser.cs

示例6: ParseRealAssignment

        /// <summary>
        /// Parses the assignment to a floating point l-value.
        /// </summary>
        private void ParseRealAssignment(DocumentObject dom, ValueDescriptor vd)
        {
            AssertCondition(Symbol == Symbol.RealLiteral || Symbol == Symbol.IntegerLiteral || Symbol == Symbol.StringLiteral,
              DomMsgID.RealExpected, _scanner.Token);

            double r = double.Parse(_scanner.Token, CultureInfo.InvariantCulture);
            dom.SetValue(vd.ValueName, r);

            ReadCode();
        }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:13,代码来源:DdlParser.cs

示例7: ParseIntegerAssignment

        /// <summary>
        /// Parses the assignment to an integer l-value.
        /// </summary>
        private void ParseIntegerAssignment(DocumentObject dom, ValueDescriptor vd)
        {
            AssertCondition(Symbol == Symbol.IntegerLiteral || Symbol == Symbol.HexIntegerLiteral || Symbol == Symbol.StringLiteral,
              DomMsgID.IntegerExpected, Token);

            int n = Int32.Parse(_scanner.Token, CultureInfo.InvariantCulture);
            dom.SetValue(vd.ValueName, n);

            ReadCode();
        }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:13,代码来源:DdlParser.cs

示例8: ParseBoolAssignment

        /// <summary>
        /// Parses the assignment to a boolean l-value.
        /// </summary>
        private void ParseBoolAssignment(DocumentObject dom, ValueDescriptor vd)
        {
            AssertCondition(Symbol == Symbol.True || Symbol == Symbol.False, DomMsgID.BoolExpected,
              _scanner.Token);

            dom.SetValue(vd.ValueName, Symbol == Symbol.True);
            ReadCode();
        }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:11,代码来源:DdlParser.cs

示例9: ParseAttributeStatement

        /// <summary>
        /// Parses a single statement in an attribute declaration block.
        /// </summary>
        private void ParseAttributeStatement(DocumentObject doc)
        {
            // Syntax is easy
            //   identifier: xxxxx
            // or 
            //   sequence of identifiers: xxx.yyy.zzz
            //
            // followed by: «=», «+=», «-=», or «{»
            //
            // Parser of rhs depends on the type of the l-value.

            if (doc == null)
                throw new ArgumentNullException("doc");
            string valueName = "";
            try
            {
                valueName = _scanner.Token;
                ReadCode();

                // Resolve path, if it exists.
                object val;
                while (Symbol == Symbol.Dot)
                {
#if DEBUG_
                    if (valueName == "TabStops")
                        valueName.GetType();
#endif
                    Debug.Assert(doc != null, "Make ReSharper happy.");
                    val = doc.GetValue(valueName);
                    if (val == null)
                    {
                        DocumentObject documentObject = doc;
                        val = documentObject.CreateValue(valueName);
                        doc.SetValue(valueName, val);
                    }
                    AssertCondition(val != null, DomMsgID.InvalidValueName, valueName);
                    doc = val as DocumentObject;
                    AssertCondition(doc != null, DomMsgID.SymbolIsNotAnObject, valueName);

                    ReadCode();
                    AssertCondition(Symbol == Symbol.Identifier, DomMsgID.InvalidValueName, _scanner.Token);
                    valueName = _scanner.Token;
                    AssertCondition(valueName[0] != '_', DomMsgID.NoAccess, _scanner.Token);

#if DEBUG_
          if (valueName == "TabStops")
            valueName.GetType();
#endif

                    ReadCode();
                }

                Debug.Assert(doc != null, "Make ReSharper happy.");
                switch (Symbol)
                {
                    case Symbol.Assign:
                        //DomValueDescriptor is needed from assignment routine.
                        ValueDescriptor pvd = doc.Meta[valueName];
                        AssertCondition(pvd != null, DomMsgID.InvalidValueName, valueName);
                        ParseAssign(doc, pvd);
                        break;

                    case Symbol.PlusAssign:
                    case Symbol.MinusAssign:
                        // Hard-coded for TabStops only...
                        if (!(doc is ParagraphFormat))
                            ThrowParserException(DomMsgID.SymbolNotAllowed, _scanner.Token);
                        if (String.Compare(valueName, "TabStops", StringComparison.OrdinalIgnoreCase) != 0)
                            ThrowParserException(DomMsgID.InvalidValueForOperation, valueName, _scanner.Token);

                        ParagraphFormat paragraphFormat = (ParagraphFormat)doc;
                        TabStops tabStops = paragraphFormat.TabStops;

                        if (true) // HACK in ParseAttributeStatement
                        {
                            bool fAddItem = Symbol == Symbol.PlusAssign;
                            TabStop tabStop = new TabStop();

                            ReadCode();

                            if (Symbol == Symbol.BraceLeft)
                            {
                                ParseAttributeBlock(tabStop);
                            }
                            else if (Symbol == Symbol.StringLiteral || Symbol == Symbol.RealLiteral || Symbol == Symbol.IntegerLiteral)
                            {
                                // Special hack for tab stops...
                                Unit unit = Token;
                                tabStop.SetValue("Position", unit);

                                ReadCode();
                            }
                            else
                                ThrowParserException(DomMsgID.UnexpectedSymbol, Token);

                            if (fAddItem)
                                tabStops.AddTabStop(tabStop);
//.........这里部分代码省略.........
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:101,代码来源:DdlParser.cs


注:本文中的DocumentObject.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。