예제 #1
0
 void Moved()
 {
     if (this.ReadState == ReadState.Initial)
     {
         throw PropertyTreesFailure.ReaderNotMoved();
     }
 }
 void Moved()
 {
     if (this.reader.ReadState == XReadState.Initial || this.data.Count == 0)
     {
         throw PropertyTreesFailure.ReaderNotMoved();
     }
 }
 internal static void ExpectNode(
     IPropertyTreeNavigator reader, PropertyNodeType expect)
 {
     if (reader.NodeType != expect)
     {
         throw PropertyTreesFailure.ReaderWrongPosition(expect, reader.NodeType);
     }
 }
        public override void WriteEndTree()
        {
            if (currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            PopParent();
        }
        public override void WritePropertyValue(object value)
        {
            if (this.property == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.property.AppendValue(value);
        }
예제 #6
0
        public PropertyTreeWriter Append()
        {
            if (IsPropertyTree)
            {
                return(new PropertyTreeNodeWriter((PropertyTree)this));
            }

            throw PropertyTreesFailure.CannotAppendChild();
        }
예제 #7
0
        protected virtual void RemoveSelfCore()
        {
            if (Parent == null)
            {
                throw PropertyTreesFailure.CannotDeleteRoot();
            }

            Parent.RemoveChild(this);
        }
        private void PushParent(PropertyNode newParent)
        {
            if (this.currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.currentParent.Append(newParent);
            this.currentParent = newParent;
        }
 PTXWriterState RequirePop(PTXWriterStateType requiredType)
 {
     if (this.states.Peek().State == requiredType)
     {
         return(PopState());
     }
     else
     {
         throw PropertyTreesFailure.WouldCreateMalformedDocument();
     }
 }
 PTXWriterState RequirePeek(PTXWriterStateType requiredType)
 {
     if (this.states.Peek().State == requiredType)
     {
         return(this.states.Peek());
     }
     else
     {
         throw PropertyTreesFailure.WriterIncorrectState(this.WriteState);
     }
 }
        public override void WriteEndProperty()
        {
            if (property == null || currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocument();
            }

            this.property.End();
            this.property = null;
            PopParent();
        }
예제 #12
0
            public override PTXWriterState CreatePropertyChild(string ns, string name)
            {
                QualifiedName qn = QualifiedName.Create(ns, name);

                if (pendingMetadata.ContainsKey(qn))
                {
                    throw PropertyTreesFailure.WriterPropertyOrTreeExists(qn);
                }

                // TODO Support schema trees (may have to store them as PTrees)
                throw new NotImplementedException();
            }
        public override void WriteStartProperty(string localName, string ns)
        {
            if (localName == null)
            {
                throw new ArgumentNullException("localName");
            }
            if (string.IsNullOrEmpty(localName))
            {
                throw Failure.EmptyString("localName");
            }
            if (currentParent == null)
            {
                throw PropertyTreesFailure.WouldCreateMalformedDocumentRootRequired();
            }

            this.property = new PropertyBuilder(ns, localName);
            CopyLineInfo(property.Property);
            PushParent(this.property.Property);
        }
예제 #14
0
        public override void InsertChildAt(int index, PropertyNode propertyNode)
        {
            if (propertyNode == null)
            {
                throw new ArgumentNullException("propertyNode");
            }
            if (propertyNode.Parent == this)
            {
                return;
            }

            if (propertyNode.QualifiedName != null)
            {
                PropertyNode existing = this.Children[propertyNode.QualifiedName];
                if (existing != null && (propertyNode.IsProperty || existing.IsProperty))
                {
                    throw PropertyTreesFailure.DuplicateProperty("propertyNode", propertyNode.QualifiedName);
                }
            }

            this.children.InsertInternal(index, propertyNode);
        }
예제 #15
0
 public virtual string ConvertToString(object value, IValueSerializerContext context)
 {
     throw PropertyTreesFailure.CannotConvertToString();
 }
예제 #16
0
 public virtual object ConvertFromString(string text, Type destinationType, IValueSerializerContext context)
 {
     throw PropertyTreesFailure.CannotConvertFromString(destinationType);
 }
예제 #17
0
 public override PTXWriterState CreatePropertyChild(string ns, string name)
 {
     throw PropertyTreesFailure.WouldCreateMalformedDocumentRootRequired();
 }
예제 #18
0
 public virtual void InsertChildAt(int index, PropertyNode node)
 {
     throw PropertyTreesFailure.CannotAppendChild();
 }