-
-
Notifications
You must be signed in to change notification settings - Fork 248
/
DocumentationGeneratorResult.cs
64 lines (52 loc) · 1.96 KB
/
DocumentationGeneratorResult.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) Josef Pihrt and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
namespace Roslynator.Documentation
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public readonly struct DocumentationGeneratorResult : IEquatable<DocumentationGeneratorResult>
{
public DocumentationGeneratorResult(string content, string filePath, DocumentationFileKind kind)
{
Content = content;
FilePath = filePath;
Kind = kind;
}
public string Content { get; }
public string FilePath { get; }
public DocumentationFileKind Kind { get; }
internal bool HasContent
{
get { return !string.IsNullOrWhiteSpace(Content); }
}
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay
{
get { return $"{Kind} {FilePath} {Content}"; }
}
public override bool Equals(object obj)
{
return obj is DocumentationGeneratorResult other && Equals(other);
}
public bool Equals(DocumentationGeneratorResult other)
{
return Kind == other.Kind
&& FilePath == other.FilePath
&& Content == other.Content;
}
public override int GetHashCode()
{
return Hash.Combine(
StringComparer.Ordinal.GetHashCode(Content),
Hash.Combine(StringComparer.OrdinalIgnoreCase.GetHashCode(FilePath), (int)Kind));
}
public static bool operator ==(in DocumentationGeneratorResult file1, in DocumentationGeneratorResult file2)
{
return file1.Equals(file2);
}
public static bool operator !=(in DocumentationGeneratorResult file1, in DocumentationGeneratorResult file2)
{
return !(file1 == file2);
}
}
}