blob: fe4334174111a84f310c2b7a8fb14b79d9ca689b (
plain)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
// Copyright (c) Microsoft Corporation
// All rights reserved
namespace Microsoft.VisualStudio.Text.IncrementalSearch
{
/// <summary>
/// Consolidates the result of an incremental search operation.
/// </summary>
/// <remarks>
/// This result indicates whether the item was found, whether the search
/// caused the cursor to wrap around the beginning or end of the buffer, and
/// the position of the first result.
/// </remarks>
public struct IncrementalSearchResult
{
#region Public Properties
/// <summary>
/// Determines whether the search wrapped around the start of the buffer to its end.
/// </summary>
/// <remarks>This is applicable only if the search direction is backward.</remarks>
public bool PassedStartOfBuffer { get; private set; }
/// <summary>
/// Determines whether the search wrapped around the end of the buffer to its beginning.
/// </summary>
/// <remarks>This is applicable only if the search direction is forward.</remarks>
public bool PassedEndOfBuffer { get; private set; }
/// <summary>
/// Determines whether the search passed the first item found.
/// </summary>
public bool PassedStartOfSearch { get; private set; }
/// <summary>
/// Determines whether the search for the term was successful.
/// </summary>
public bool ResultFound { get; private set; }
#endregion //Public Properties
/// <summary>
/// Initializes a new instance of <see cref="IncrementalSearchResult"/> with the specified properties.
/// </summary>
/// <param name="passedEndOfBuffer"></param>
/// <param name="passedStartOfBuffer"></param>
/// <param name="passedStartOfSearch"></param>
/// <param name="resultFound"></param>
public IncrementalSearchResult(bool passedEndOfBuffer, bool passedStartOfBuffer, bool passedStartOfSearch, bool resultFound) : this()
{
PassedEndOfBuffer = passedEndOfBuffer;
PassedStartOfBuffer = passedStartOfBuffer;
PassedStartOfSearch = passedStartOfSearch;
ResultFound = resultFound;
}
#region Object Overrides
/// <summary>
/// Determines whether the contents of two <see cref="IncrementalSearchResult"/> objects are the same.
/// </summary>
/// <param name="obj">The object to be compared.</param>
/// <returns><c>true</c> if both objects have the same content, otherwise <c>false</c>.</returns>
public override bool Equals(object obj)
{
if (obj is IncrementalSearchResult)
{
return ((IncrementalSearchResult)obj) == this;
}
else
{
return false;
}
}
/// <summary>
/// Determines whether the contents of two <see cref="IncrementalSearchResult"/> objects are the same.
/// </summary>
/// <returns><c>true</c> if both objects have the same content, otherwise <c>false</c>.</returns>
public static bool operator == (IncrementalSearchResult first, IncrementalSearchResult second)
{
return (first.PassedEndOfBuffer == second.PassedEndOfBuffer &&
first.PassedStartOfBuffer == second.PassedStartOfBuffer &&
first.PassedStartOfSearch == second.PassedStartOfSearch &&
first.ResultFound == second.ResultFound);
}
/// <summary>
/// Determines whether the contents of two <see cref="IncrementalSearchResult"/> objects are different.
/// </summary>
/// <returns><c>true</c> if both objects have different content, otherwise <c>false</c>.</returns>
public static bool operator != (IncrementalSearchResult first, IncrementalSearchResult second)
{
return !(first == second);
}
/// <summary>
/// Gets the hash code for the object.
/// </summary>
/// <returns>base class' implementation</returns>
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion //Object Overrides
}
}
|