-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
CharFilterName.cs
92 lines (79 loc) · 4.22 KB
/
CharFilterName.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
namespace Microsoft.Azure.Search.Models
{
using System;
using Microsoft.Azure.Search.Common;
using Newtonsoft.Json;
using Serialization;
/// <summary>
/// Defines the names of all character filters supported by Azure Cognitive Search.
/// <see href="https://docs.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search"/>
/// </summary>
[JsonConverter(typeof(ExtensibleEnumConverter<CharFilterName>))]
public struct CharFilterName : IEquatable<CharFilterName>
{
private readonly string _value;
// MAINTENANCE NOTE: Keep these ordered the same as the table on this page:
// https://docs.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search
/// <summary>
/// A character filter that attempts to strip out HTML constructs.
/// <see href="https://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.html" />
/// </summary>
public static readonly CharFilterName HtmlStrip = new CharFilterName("html_strip");
private CharFilterName(string name)
{
Throw.IfArgumentNull(name, nameof(name));
_value = name;
}
/// <summary>
/// Defines implicit conversion from string to CharFilterName.
/// </summary>
/// <param name="name">string to convert.</param>
/// <returns>The string as a CharFilterName.</returns>
public static implicit operator CharFilterName(string name) => new CharFilterName(name);
/// <summary>
/// Defines explicit conversion from CharFilterName to string.
/// </summary>
/// <param name="name">CharFilterName to convert.</param>
/// <returns>The CharFilterName as a string.</returns>
public static explicit operator string(CharFilterName name) => name.ToString();
/// <summary>
/// Compares two CharFilterName values for equality.
/// </summary>
/// <param name="lhs">The first CharFilterName to compare.</param>
/// <param name="rhs">The second CharFilterName to compare.</param>
/// <returns>true if the CharFilterName objects are equal or are both null; false otherwise.</returns>
public static bool operator ==(CharFilterName lhs, CharFilterName rhs) => Equals(lhs, rhs);
/// <summary>
/// Compares two CharFilterName values for inequality.
/// </summary>
/// <param name="lhs">The first CharFilterName to compare.</param>
/// <param name="rhs">The second CharFilterName to compare.</param>
/// <returns>true if the CharFilterName objects are not equal; false otherwise.</returns>
public static bool operator !=(CharFilterName lhs, CharFilterName rhs) => !Equals(lhs, rhs);
/// <summary>
/// Compares the CharFilterName for equality with another CharFilterName.
/// </summary>
/// <param name="other">The CharFilterName with which to compare.</param>
/// <returns><c>true</c> if the CharFilterName objects are equal; otherwise, <c>false</c>.</returns>
public bool Equals(CharFilterName other) => _value == other._value;
/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj) => obj is CharFilterName ? Equals((CharFilterName)obj) : false;
/// <summary>
/// Serves as the default hash function.
/// </summary>
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode() => _value.GetHashCode();
/// <summary>
/// Returns a string representation of the CharFilterName.
/// </summary>
/// <returns>The CharFilterName as a string.</returns>
public override string ToString() => _value;
}
}