示例#1
0
        public override void StepIn(IonType type)
        {
            IonContainer c;

            switch (type)
            {
            case IonType.List:
                c = new IonList();
                break;

            case IonType.Sexp:
                c = new IonSexp();
                break;

            case IonType.Struct:
                c = new IonStruct();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            AppendValue(c);
            _currentContainer = c;
        }
示例#2
0
        internal override void DoAdd(IonContainer container, IonValue item)
        {
            var fieldName = $"Field{_serial++}";
            var v         = (IonStruct)container;

            v[fieldName] = item;
        }
示例#3
0
 public override void StepOut()
 {
     if (_currentContainer.Container is null)
     {
         throw new InvalidOperationException("Cannot step out of top level value");
     }
     _currentContainer = _currentContainer.Container;
 }
 /// <summary>
 /// Implementations should add <paramref name="item"/> to <paramref name="container"/>.
 /// </summary>
 protected abstract void DoAdd(IonContainer container, IonValue item);
示例#5
0
 public IonTreeWriter(IonContainer root)
 {
     Debug.Assert(root != null);
     _currentContainer = root;
     _containers.Push(root);
 }
示例#6
0
        protected override void DoAdd(IonContainer container, IonValue item)
        {
            var list = (IonList)container;

            list.Add(item);
        }
示例#7
0
 public IonTreeWriter(IonContainer root)
 {
     Debug.Assert(root != null, "root is null");
     this.currentContainer = root;
     this.containers.Push(root);
 }
示例#8
0
 protected override void DoAdd(IonContainer container, IonValue item)
 {
     container.Add(item);
 }
示例#9
0
 public IonTreeWriter(IonContainer root) : base(IonWriterBuilderBase.InitialIvmHandlingOption.Suppress)
 {
     Debug.Assert(root != null);
     _currentContainer = root;
 }
示例#10
0
 internal override void DoAdd(IonContainer container, IonValue item)
 {
     container.Add(item);
 }
示例#11
0
 /// <summary>
 /// Implementations should add <paramref name="item"/> to <paramref name="container"/>.
 /// </summary>
 internal abstract void DoAdd(IonContainer container, IonValue item);