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


C# EmitterState类代码示例

本文整理汇总了C#中EmitterState的典型用法代码示例。如果您正苦于以下问题:C# EmitterState类的具体用法?C# EmitterState怎么用?C# EmitterState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: EmitBlockMapping

 private void EmitBlockMapping()
 {
     increaseIndent(false, false);
     _state = EmitterState.FIRST_BLOCK_MAPPING_KEY;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:Emitter.cs

示例2: EmitBlockSequenceItem

        /// <summary>
        /// Expect a block item node.
        /// </summary>
        private void EmitBlockSequenceItem(Event evt, bool isFirst)
        {
            if (isFirst)
            {
                IncreaseIndent(false, (isMappingContext && !isIndentation));
            }

            if (evt is ISequenceEnd)
            {
                indent = indents.Pop();
                state = states.Pop();
                return;
            }

            WriteIndent();
            WriteIndicator("-", true, false, true);
            states.Push(EmitterState.YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE);

            EmitNode(evt, false, false, false);
        }
开发者ID:vasily-kirichenko,项目名称:SharpYaml,代码行数:23,代码来源:Emitter.cs

示例3: EmitDocumentStart

        /// <summary>
        /// Expect DOCUMENT-START or STREAM-END.
        /// </summary>
        private void EmitDocumentStart(Event evt, bool isFirst)
        {
            DocumentStart documentStart = evt as DocumentStart;
            if (documentStart != null)
            {
                bool isImplicit = documentStart.IsImplicit && isFirst && !isCanonical;

                if (documentStart.Version != null && isOpenEnded)
                {
                    WriteIndicator("...", true, false, false);
                    WriteIndent();
                }

                if (documentStart.Version != null)
                {
                    AnalyzeVersionDirective(documentStart.Version);

                    isImplicit = false;
                    WriteIndicator("%YAML", true, false, false);
                    WriteIndicator(string.Format(CultureInfo.InvariantCulture, "{0}.{1}", Constants.MajorVersion, Constants.MinorVersion), true, false, false);
                    WriteIndent();
                }

                if (documentStart.Tags != null)
                {
                    foreach (var tagDirective in documentStart.Tags)
                    {
                        AppendTagDirective(tagDirective, false);
                    }
                }

                foreach (var tagDirective in Constants.DefaultTagDirectives)
                {
                    AppendTagDirective(tagDirective, true);
                }

                if (documentStart.Tags != null && documentStart.Tags.Count != 0)
                {
                    isImplicit = false;
                    foreach (var tagDirective in documentStart.Tags)
                    {
                        WriteIndicator("%TAG", true, false, false);
                        WriteTagHandle(tagDirective.Handle);
                        WriteTagContent(tagDirective.Prefix, true);
                        WriteIndent();
                    }
                }

                if (CheckEmptyDocument())
                {
                    isImplicit = false;
                }

                if (!isImplicit)
                {
                    WriteIndent();
                    WriteIndicator("---", true, false, false);
                    if (isCanonical)
                    {
                        WriteIndent();
                    }
                }

                state = EmitterState.YAML_EMIT_DOCUMENT_CONTENT_STATE;
            }

            else if (evt is IStreamEnd)
            {
                if (isOpenEnded)
                {
                    WriteIndicator("...", true, false, false);
                    WriteIndent();
                }

                state = EmitterState.YAML_EMIT_END_STATE;
            }
            else
            {
                throw new YamlException("Expected DOCUMENT-START or STREAM-END");
            }
        }
开发者ID:vasily-kirichenko,项目名称:SharpYaml,代码行数:84,代码来源:Emitter.cs

示例4: EmitSequenceStart

        /// <summary>
        /// Expect SEQUENCE-START.
        /// </summary>
        private void EmitSequenceStart(Event evt)
        {
            ProcessAnchor();
            ProcessTag();

            SequenceStart sequenceStart = (SequenceStart)evt;

            if (flowLevel != 0 || isCanonical || sequenceStart.Style == YamlStyle.Flow || CheckEmptySequence())
            {
                state = EmitterState.YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE;
            }
            else
            {
                state = EmitterState.YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE;
            }
        }
开发者ID:vasily-kirichenko,项目名称:SharpYaml,代码行数:19,代码来源:Emitter.cs

示例5: EmitStreamStart

        /// <summary>
        /// Expect STREAM-START.
        /// </summary>
        private void EmitStreamStart(ParsingEvent evt)
        {
            if (!(evt is StreamStart))
            {
                throw new ArgumentException("Expected STREAM-START.", "evt");
            }

            indent = -1;
            column = 0;
            isWhitespace = true;
            isIndentation = true;

            state = EmitterState.FirstDocumentStart;
        }
开发者ID:Cyberbanan,项目名称:Projeny,代码行数:17,代码来源:Emitter.cs

示例6: EmitMappingStart

        /// <summary>
        /// Expect MAPPING-START.
        /// </summary>
        private void EmitMappingStart(Event evt)
        {
            ProcessAnchor();
            ProcessTag();

            MappingStart mappingStart = (MappingStart)evt;

            if (flowLevel != 0 || isCanonical || mappingStart.Style == YamlStyle.Flow || CheckEmptyMapping())
            {
                state = EmitterState.YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE;
            }
            else
            {
                state = EmitterState.YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE;
            }
        }
开发者ID:vasily-kirichenko,项目名称:SharpYaml,代码行数:19,代码来源:Emitter.cs

示例7: EmitFlowSequence

 private void EmitFlowSequence()
 {
     WriteIndicator("[", true, true, false);
     _flowLevel++;
     increaseIndent(true, false);
     _state = EmitterState.FIRST_FLOW_SEQUENCE_ITEM;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:Emitter.cs

示例8: EmitFlowSequenceItem

 private void EmitFlowSequenceItem(bool first)
 {
     if (_event is SequenceEndEvent) {
         _indent = _indents.Pop();
         _flowLevel--;
         if (_canonical && !first) {
             WriteIndicator(",", false, false, false);
             WriteIndent();
         }
         WriteIndicator("]", false, false, false);
         _state = _states.Pop();
     } else {
         if (!first) {
             WriteIndicator(",", false, false, false);
         }
         if (_canonical || _column > _bestWidth) {
             WriteIndent();
         }
         _states.Push(EmitterState.FLOW_SEQUENCE_ITEM);
         EmitNode(false, true, false, false);
     }
 }
开发者ID:TerabyteX,项目名称:main,代码行数:22,代码来源:Emitter.cs

示例9: EmitFlowMapping

 private void EmitFlowMapping()
 {
     WriteIndicator("{", true, true, false);
     _flowLevel++;
     increaseIndent(true, false);
     _state = EmitterState.FIRST_FLOW_MAPPING_KEY;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:7,代码来源:Emitter.cs

示例10: EmitFlowMappingKey

 private void EmitFlowMappingKey(bool first)
 {
     if (_event is MappingEndEvent) {
         _indent = _indents.Pop();
         _flowLevel--;
         if (_canonical && !first) {
             WriteIndicator(",", false, false, false);
             WriteIndent();
         }
         WriteIndicator("}", false, false, false);
         _state = _states.Pop();
     } else {
         if (!first) {
             WriteIndicator(",", false, false, false);
         }
         if (_canonical || _column > _bestWidth) {
             WriteIndent();
         }
         if (!_canonical && CheckSimpleKey()) {
             _states.Push(EmitterState.FLOW_MAPPING_SIMPLE_VALUE);
             EmitNode(false, false, true, true);
         } else {
             WriteIndicator("?", true, false, false);
             _states.Push(EmitterState.FLOW_MAPPING_VALUE);
             EmitNode(false, false, true, false);
         }
     }
 }
开发者ID:TerabyteX,项目名称:main,代码行数:28,代码来源:Emitter.cs

示例11: EmitDocumentStart

        private void EmitDocumentStart(bool first)
        {
            if (_event is DocumentStartEvent) {
                DocumentStartEvent ev = (DocumentStartEvent)_event;
                if (first) {
                    if (null != ev.Version) {
                        WriteVersionDirective(prepareVersion(ev.Version));
                    }

                    if ((null != ev.Version && ev.Version.Equals(new Version(1, 0))) || _options.Version.Equals(new Version(1, 0))) {
                        _isVersion10 = true;
                        _tagPrefixes.Clear();
                        _tagPrefixes.Add("tag:yaml.org,2002:", "!");
                    } else {
                        _tagPrefixes.Clear();
                        _tagPrefixes.Add("!", "!");
                        _tagPrefixes.Add("tag:yaml.org,2002:", "!!");
                    }

                    if (null != ev.Tags) {
                        var entries = new List<KeyValuePair<string, string>>(ev.Tags);
                        entries.Sort((x, y) => StringComparer.Ordinal.Compare(x.Key, y.Key));

                        foreach (KeyValuePair<string, string> tags in entries) {
                            string handle = tags.Key;
                            string prefix = tags.Value;
                            _tagPrefixes.Add(prefix, handle);
                            string handleText = prepareTagHandle(handle);
                            string prefixText = prepareTagPrefix(prefix);
                            WriteTagDirective(handleText, prefixText);
                        }
                    }
                }

                bool @implicit = first && !ev.Explicit && !_canonical && ev.Version == null && ev.Tags == null && !checkEmptyDocument();
                if ([email protected]) {
                    if (!first) {
                        WriteIndent();
                    }
                    WriteIndicator("--- ", !first, true, false);
                    if (_canonical) {
                        WriteIndent();
                    }
                }
                _state = EmitterState.DOCUMENT_ROOT;
            } else if (_event is StreamEndEvent) {
                WriteStreamEnd();
                _state = EmitterState.NOTHING;
            } else {
                throw new EmitterException("Emited DocumentStartEvent, but got " + _event);
            }
        }
开发者ID:TerabyteX,项目名称:main,代码行数:52,代码来源:Emitter.cs

示例12: EmitDocumentEnd

 private void EmitDocumentEnd()
 {
     if (_event is DocumentEndEvent) {
         WriteIndent();
         if (((DocumentEndEvent)_event).Explicit) {
             WriteIndicator("...", true, false, false);
             WriteIndent();
         }
         _writer.Flush();
         _state = EmitterState.DOCUMENT_START;
     } else {
         throw new EmitterException("Emited DocumentEndEvent, but got " + _event);
     }
 }
开发者ID:TerabyteX,项目名称:main,代码行数:14,代码来源:Emitter.cs

示例13: EmitBlockSequence

 private void EmitBlockSequence()
 {
     increaseIndent(false, _mappingContext && !_indentation);
     _state = EmitterState.FIRST_BLOCK_SEQUENCE_ITEM;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:5,代码来源:Emitter.cs

示例14: EmitMappingStart

        /// <summary>
        /// Expect MAPPING-START.
        /// </summary>
        private void EmitMappingStart(ParsingEvent evt)
        {
            ProcessAnchor();
            ProcessTag();

            var mappingStart = (MappingStart) evt;

            if (flowLevel != 0 || isCanonical || mappingStart.Style == MappingStyle.Flow || CheckEmptyMapping())
            {
                state = EmitterState.FlowMappingFirstKey;
            }
            else
            {
                state = EmitterState.BlockMappingFirstKey;
            }
        }
开发者ID:Cyberbanan,项目名称:Projeny,代码行数:19,代码来源:Emitter.cs

示例15: EmitSequenceStart

        /// <summary>
        /// Expect SEQUENCE-START.
        /// </summary>
        private void EmitSequenceStart(ParsingEvent evt)
        {
            ProcessAnchor();
            ProcessTag();

            var sequenceStart = (SequenceStart) evt;

            if (flowLevel != 0 || isCanonical || sequenceStart.Style == SequenceStyle.Flow || CheckEmptySequence())
            {
                state = EmitterState.FlowSequenceFirstItem;
            }
            else
            {
                state = EmitterState.BlockSequenceFirstItem;
            }
        }
开发者ID:Cyberbanan,项目名称:Projeny,代码行数:19,代码来源:Emitter.cs


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