Added ccrewrite library, tool and tests.
[mono.git] / mcs / class / Mono.CodeContracts / Mono.CodeContracts.Rewrite / RewriterResults.cs
1 using System;\r
2 using System.Collections.Generic;\r
3 using System.Linq;\r
4 using System.Text;\r
5 \r
6 namespace Mono.CodeContracts.Rewrite {\r
7 \r
8         public class RewriterResults {\r
9 \r
10                 internal static RewriterResults Warning (string warning)\r
11                 {\r
12                         return new RewriterResults (new [] { warning }, null);\r
13                 }\r
14 \r
15                 internal static RewriterResults Error (string error)\r
16                 {\r
17                         return new RewriterResults (null, new [] { error });\r
18                 }\r
19 \r
20                 internal RewriterResults (ICollection<string> warnings, ICollection<string> errors)\r
21                 {\r
22                         this.warnings = warnings;\r
23                         this.errors = errors;\r
24                 }\r
25 \r
26                 private ICollection<string> warnings, errors;\r
27 \r
28                 public bool AnyWarnings\r
29                 {\r
30                         get\r
31                         {\r
32                                 return this.warnings != null && this.warnings.Count > 0;\r
33                         }\r
34                 }\r
35 \r
36                 public bool AnyErrors\r
37                 {\r
38                         get\r
39                         {\r
40                                 return this.errors != null && this.errors.Count > 0;\r
41                         }\r
42                 }\r
43 \r
44                 public IEnumerable<string> Warnings\r
45                 {\r
46                         get\r
47                         {\r
48                                 return this.warnings ?? Enumerable.Empty<string> ();\r
49                         }\r
50                 }\r
51 \r
52                 public IEnumerable<string> Errors\r
53                 {\r
54                         get\r
55                         {\r
56                                 return this.errors ?? Enumerable.Empty<string> ();\r
57                         }\r
58                 }\r
59 \r
60         }\r
61 \r
62 }\r