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); }
public PropertyTreeWriter Append() { if (IsPropertyTree) { return(new PropertyTreeNodeWriter((PropertyTree)this)); } throw PropertyTreesFailure.CannotAppendChild(); }
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(); }
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); }
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); }
public virtual string ConvertToString(object value, IValueSerializerContext context) { throw PropertyTreesFailure.CannotConvertToString(); }
public virtual object ConvertFromString(string text, Type destinationType, IValueSerializerContext context) { throw PropertyTreesFailure.CannotConvertFromString(destinationType); }
public override PTXWriterState CreatePropertyChild(string ns, string name) { throw PropertyTreesFailure.WouldCreateMalformedDocumentRootRequired(); }
public virtual void InsertChildAt(int index, PropertyNode node) { throw PropertyTreesFailure.CannotAppendChild(); }