forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchFlags.cs
More file actions
146 lines (120 loc) · 4.85 KB
/
Copy pathSearchFlags.cs
File metadata and controls
146 lines (120 loc) · 4.85 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
namespace UnityEditor.Search
{
/// <summary>
/// Various search options used to fetch items.
/// </summary>
[Flags]
public enum SearchFlags
{
/// <summary>
/// No specific search options.
/// </summary>
None = 0,
/// <summary>
/// Search items are fetch synchronously.
/// </summary>
Synchronous = 1 << 0,
/// <summary>
/// Fetch items will be sorted by the search service.
/// </summary>
Sorted = 1 << 1,
/// <summary>
/// Send the first items asynchronously
/// </summary>
FirstBatchAsync = 1 << 2,
/// <summary>
/// Sets the search to search for all results.
/// </summary>
WantsMore = 1 << 3,
/// <summary>
/// Adding debugging info while looking for results,
/// </summary>
Debug = 1 << 4,
/// <summary>
/// Prevent the search to use any indexing
/// </summary>
NoIndexing = 1 << 5,
/// <summary>
/// Process the current query as an expression
/// </summary>
Expression = 1 << 6,
/// <summary>
/// Evaluate the search text as a pure query string (do not evaluate the text as a search expression).
/// </summary>
QueryString = 1 << 7,
/// <summary>
/// Indicates that the query should consider package assets to fetch results. If not set, then package assets will most likely be ignored.
/// </summary>
Packages = 1 << 8,
/// <summary>
/// Default Search Flag
/// </summary>
Default = Sorted,
/// <summary>
/// Always show query errors even when there are results available.
/// </summary>
ShowErrorsWithResults = 1 << 24,
/// <summary>
/// Search View Flags
/// </summary>
[Obsolete("Not used anymore", false)]
SaveFilters = 1 << 25,
/// <summary>
/// Open QuickSearch reusing an existing window if any.
/// </summary>
ReuseExistingWindow = 1 << 26,
/// <summary>
/// Specify that a QuickSearch window list view supports multi-selection.
/// </summary>
Multiselect = 1 << 27,
/// <summary>
/// Specify that a QuickSearch window is dockable instead of being a modal popup window.
/// </summary>
Dockable = 1 << 28,
/// <summary>
/// Select the contextual provider group when opening QuickSearch.
/// </summary>
FocusContext = 1 << 29,
/// <summary>
/// Hide all QuickSearch side panels.
/// </summary>
HidePanels = 1 << 30,
/// <summary>
/// This is a general purpose search window that has access to all Providers in the SearchService.
/// </summary>
GeneralSearchWindow = 1 << 31,
/// <summary>
/// Default options when opening a QuickSearch window.
/// </summary>
OpenDefault = GeneralSearchWindow | Multiselect | Dockable,
/// <summary>
/// Default options when opening a QuickSearch using the global shortcut.
/// </summary>
OpenGlobal = OpenDefault | ReuseExistingWindow,
/// <summary>
/// Options when opening QuickSearch in contextual mode (with only a few selected providers enabled).
/// </summary>
OpenContextual = Multiselect | Dockable | FocusContext,
/// <summary>
/// Options when opening QuickSearch as an Object Picker.
/// </summary>
OpenPicker = FocusContext
}
static class SearchFlagsExtensions
{
public static bool HasAny(this SearchFlags flags, SearchFlags f) => (flags & f) != 0;
public static bool HasAll(this SearchFlags flags, SearchFlags all) => (flags & all) == all;
public static bool HasAny(this ShowDetailsOptions flags, ShowDetailsOptions f) => (flags & f) != 0;
public static bool HasAll(this ShowDetailsOptions flags, ShowDetailsOptions all) => (flags & all) == all;
public static bool HasAny(this SearchItemOptions flags, SearchItemOptions f) => (flags & f) != 0;
public static bool HasAll(this SearchItemOptions flags, SearchItemOptions all) => (flags & all) == all;
public static bool HasAny(this FetchPreviewOptions flags, FetchPreviewOptions f) => (flags & f) != 0;
public static bool HasAll(this FetchPreviewOptions flags, FetchPreviewOptions all) => (flags & all) == all;
public static bool HasAny(this RefreshFlags flags, RefreshFlags f) => (flags & f) != 0;
public static bool HasAll(this RefreshFlags flags, RefreshFlags all) => (flags & all) == all;
}
}