1 // Licensed to the .NET Foundation under one or more agreements. 2 // The .NET Foundation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Collections.ObjectModel; 6 using System.Runtime.Serialization; 7 using System.Xml.Serialization; 8 using System.Collections.Generic; 9 using System.Xml; 10 using System.Runtime.CompilerServices; 11 12 namespace System.ServiceModel.Syndication 13 { 14 [DataContract] 15 public abstract class CategoriesDocumentFormatter 16 { 17 private CategoriesDocument _document; 18 CategoriesDocumentFormatter()19 protected CategoriesDocumentFormatter() 20 { 21 } CategoriesDocumentFormatter(CategoriesDocument documentToWrite)22 protected CategoriesDocumentFormatter(CategoriesDocument documentToWrite) 23 { 24 if (documentToWrite == null) 25 { 26 throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("documentToWrite"); 27 } 28 _document = documentToWrite; 29 } 30 31 public CategoriesDocument Document 32 { 33 get { return _document; } 34 } 35 36 public abstract string Version 37 { get; } 38 CanRead(XmlReader reader)39 public abstract bool CanRead(XmlReader reader); ReadFrom(XmlReader reader)40 public abstract void ReadFrom(XmlReader reader); WriteTo(XmlWriter writer)41 public abstract void WriteTo(XmlWriter writer); 42 CreateInlineCategoriesDocument()43 protected virtual InlineCategoriesDocument CreateInlineCategoriesDocument() 44 { 45 return new InlineCategoriesDocument(); 46 } 47 CreateReferencedCategoriesDocument()48 protected virtual ReferencedCategoriesDocument CreateReferencedCategoriesDocument() 49 { 50 return new ReferencedCategoriesDocument(); 51 } 52 SetDocument(CategoriesDocument document)53 protected virtual void SetDocument(CategoriesDocument document) 54 { 55 _document = document; 56 } 57 } 58 } 59