The Labs \ Source Viewer \ SSCLI \ System.Xml.Schema \ FacetType

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlSchemaFacet.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. // <owner current="true" primary="true">priyal</owner>
  15. //------------------------------------------------------------------------------
  16. namespace System.Xml.Schema
  17. {
  18.    
  19.     using System.ComponentModel;
  20.     using System.Xml.Serialization;
  21.    
  22.     internal enum FacetType
  23.     {
  24.         None,
  25.         Length,
  26.         MinLength,
  27.         MaxLength,
  28.         Pattern,
  29.         Whitespace,
  30.         Enumeration,
  31.         MinExclusive,
  32.         MinInclusive,
  33.         MaxExclusive,
  34.         MaxInclusive,
  35.         TotalDigits,
  36.         FractionDigits
  37.     }
  38.    
  39.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaFacet"]/*' />
  40.     public abstract class XmlSchemaFacet : XmlSchemaAnnotated
  41.     {
  42.         string value;
  43.         bool isFixed;
  44.         FacetType facetType;
  45.        
  46.         /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaFacet.Value"]/*' />
  47.         [XmlAttribute("value")]
  48.         public string Value {
  49.             get { return this.value; }
  50.             set { this.value = value; }
  51.         }
  52.        
  53.         /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaFacet.IsFixed"]/*' />
  54.         [XmlAttribute("fixed"), DefaultValue(false)]
  55.         public virtual bool IsFixed {
  56.             get { return isFixed; }
  57.             set {
  58.                 if (!(this is XmlSchemaEnumerationFacet) && !(this is XmlSchemaPatternFacet)) {
  59.                     isFixed = value;
  60.                 }
  61.             }
  62.         }
  63.        
  64.         internal FacetType FacetType {
  65.             get { return facetType; }
  66.             set { facetType = value; }
  67.         }
  68.     }
  69.    
  70.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaNumericFacet"]/*' />
  71.     public abstract class XmlSchemaNumericFacet : XmlSchemaFacet
  72.     {
  73.     }
  74.    
  75.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaLengthFacet"]/*' />
  76.     public class XmlSchemaLengthFacet : XmlSchemaNumericFacet
  77.     {
  78.         public XmlSchemaLengthFacet()
  79.         {
  80.             FacetType = FacetType.Length;
  81.         }
  82.     }
  83.    
  84.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaMinLengthFacet"]/*' />
  85.     public class XmlSchemaMinLengthFacet : XmlSchemaNumericFacet
  86.     {
  87.         public XmlSchemaMinLengthFacet()
  88.         {
  89.             FacetType = FacetType.MinLength;
  90.         }
  91.     }
  92.    
  93.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaMaxLengthFacet"]/*' />
  94.     public class XmlSchemaMaxLengthFacet : XmlSchemaNumericFacet
  95.     {
  96.         public XmlSchemaMaxLengthFacet()
  97.         {
  98.             FacetType = FacetType.MaxLength;
  99.         }
  100.     }
  101.    
  102.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaPatternFacet"]/*' />
  103.     public class XmlSchemaPatternFacet : XmlSchemaFacet
  104.     {
  105.         public XmlSchemaPatternFacet()
  106.         {
  107.             FacetType = FacetType.Pattern;
  108.         }
  109.     }
  110.    
  111.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaEnumerationFacet"]/*' />
  112.     public class XmlSchemaEnumerationFacet : XmlSchemaFacet
  113.     {
  114.         public XmlSchemaEnumerationFacet()
  115.         {
  116.             FacetType = FacetType.Enumeration;
  117.         }
  118.     }
  119.    
  120.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaMinExclusiveFacet"]/*' />
  121.     public class XmlSchemaMinExclusiveFacet : XmlSchemaFacet
  122.     {
  123.         public XmlSchemaMinExclusiveFacet()
  124.         {
  125.             FacetType = FacetType.MinExclusive;
  126.         }
  127.     }
  128.    
  129.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaMinInclusiveFacet"]/*' />
  130.     public class XmlSchemaMinInclusiveFacet : XmlSchemaFacet
  131.     {
  132.         public XmlSchemaMinInclusiveFacet()
  133.         {
  134.             FacetType = FacetType.MinInclusive;
  135.         }
  136.     }
  137.    
  138.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaMaxExclusiveFacet"]/*' />
  139.     public class XmlSchemaMaxExclusiveFacet : XmlSchemaFacet
  140.     {
  141.         public XmlSchemaMaxExclusiveFacet()
  142.         {
  143.             FacetType = FacetType.MaxExclusive;
  144.         }
  145.     }
  146.    
  147.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaMaxInclusiveFacet"]/*' />
  148.     public class XmlSchemaMaxInclusiveFacet : XmlSchemaFacet
  149.     {
  150.         public XmlSchemaMaxInclusiveFacet()
  151.         {
  152.             FacetType = FacetType.MaxInclusive;
  153.         }
  154.     }
  155.    
  156.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaTotalDigitsFacet"]/*' />
  157.     public class XmlSchemaTotalDigitsFacet : XmlSchemaNumericFacet
  158.     {
  159.         public XmlSchemaTotalDigitsFacet()
  160.         {
  161.             FacetType = FacetType.TotalDigits;
  162.         }
  163.     }
  164.    
  165.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaFractionDigitsFacet"]/*' />
  166.     public class XmlSchemaFractionDigitsFacet : XmlSchemaNumericFacet
  167.     {
  168.         public XmlSchemaFractionDigitsFacet()
  169.         {
  170.             FacetType = FacetType.FractionDigits;
  171.         }
  172.     }
  173.    
  174.     /// <include file='doc\XmlSchemaFacet.uex' path='docs/doc[@for="XmlSchemaWhiteSpaceFacet"]/*' />
  175.     public class XmlSchemaWhiteSpaceFacet : XmlSchemaFacet
  176.     {
  177.         public XmlSchemaWhiteSpaceFacet()
  178.         {
  179.             FacetType = FacetType.Whitespace;
  180.         }
  181.     }
  182.    
  183. }

Developer Fusion