Debian Codegraph @

mcs/class/referencesource/System/regex/system/text/regularexpressions/RegexCompilationInfo.cs

raw
1 //------------------------------------------------------------------------------
2 // <copyright file="RegexCompilationInfo.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 // </copyright>
5 //------------------------------------------------------------------------------
6
7 #if !SILVERLIGHT
8
9 using System;
10 using System.Runtime.Serialization;
11 using System.Runtime.Versioning;
12
13 namespace System.Text.RegularExpressions {
14
15 /// <devdoc>
16 /// <para>
17 /// [To be supplied]
18 /// </para>
19 /// </devdoc>
20 [ Serializable() ]
21 public class RegexCompilationInfo {
22 private String pattern;
23 private RegexOptions options;
24 private String name;
25 private String nspace;
26 private bool isPublic;
27
28 [OptionalField(VersionAdded = 2)]
29 private TimeSpan matchTimeout;
30
31 [OnDeserializing]
32 private void InitMatchTimeoutDefaultForOldVersionDeserialization(StreamingContext unusedContext) {
33 matchTimeout = Regex.DefaultMatchTimeout;
34 }
35
36 /// <devdoc>
37 /// <para>
38 /// [To be supplied]
39 /// </para>
40 /// </devdoc>
41 public RegexCompilationInfo(String pattern, RegexOptions options, String name, String fullnamespace, bool ispublic)
42 : this(pattern, options, name, fullnamespace, ispublic, Regex.DefaultMatchTimeout) {
43 }
44
45 public RegexCompilationInfo(String pattern, RegexOptions options, String name, String fullnamespace, bool ispublic, TimeSpan matchTimeout) {
46 Pattern = pattern;
47 Name = name;
48 Namespace = fullnamespace;
49 this.options = options;
50 isPublic = ispublic;
51 MatchTimeout = matchTimeout;
52 }
53
54 /// <devdoc>
55 /// <para>
56 /// [To be supplied]
57 /// </para>
58 /// </devdoc>
59 public String Pattern {
60 get { return pattern; }
61 set {
62 if (value == null)
63 throw new ArgumentNullException("value");
64 pattern = value;
65 }
66 }
67
68 /// <devdoc>
69 /// <para>
70 /// [To be supplied]
71 /// </para>
72 /// </devdoc>
73 public RegexOptions Options {
74 get { return options; }
75 set { options = value;}
76 }
77
78 /// <devdoc>
79 /// <para>
80 /// [To be supplied]
81 /// </para>
82 /// </devdoc>
83 public String Name {
84 get { return name; }
85 set {
86 if (value == null) {
87 throw new ArgumentNullException("value");
88 }
89
90 if (value.Length == 0) {
91 throw new ArgumentException(SR.GetString(SR.InvalidNullEmptyArgument, "value"), "value");
92 }
93
94 name = value;
95 }
96 }
97
98 /// <devdoc>
99 /// <para>
100 /// [To be supplied]
101 /// </para>
102 /// </devdoc>
103 public String Namespace {
104 get { return nspace; }
105 set {
106 if (value == null)
107 throw new ArgumentNullException("value");
108 nspace = value;
109 }
110 }
111
112 /// <devdoc>
113 /// <para>
114 /// [To be supplied]
115 /// </para>
116 /// </devdoc>
117 public bool IsPublic {
118 get { return isPublic; }
119 set { isPublic = value;}
120 }
121
122 public TimeSpan MatchTimeout {
123 get { return matchTimeout; }
124 set { Regex.ValidateMatchTimeout(value); matchTimeout = value; }
125 }
126 }
127 }
128
129
130 #endif
131