-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathDocumentAccessFlags.cs
More file actions
61 lines (50 loc) · 2.01 KB
/
DocumentAccessFlags.cs
File metadata and controls
61 lines (50 loc) · 2.01 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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
namespace Microsoft.ClearScript
{
/// <summary>
/// Defines document access options.
/// </summary>
[Flags]
public enum DocumentAccessFlags
{
/// <summary>
/// Specifies that no options are selected.
/// </summary>
None = 0,
/// <summary>
/// Specifies that documents may be loaded from the file system.
/// </summary>
EnableFileLoading = 0x00000001,
/// <summary>
/// Specifies that documents may be downloaded from the Web.
/// </summary>
EnableWebLoading = 0x00000002,
/// <summary>
/// Specifies that documents may be loaded from any location.
/// </summary>
EnableAllLoading = EnableFileLoading | EnableWebLoading,
// ReSharper disable GrammarMistakeInComment
/// <summary>
/// Specifies that a document path must begin with a segment of "." or ".." to be
/// considered a relative path. By default, any path that is not explicitly a top-level
/// or root path is eligible.
/// </summary>
EnforceRelativePrefix = 0x00000004,
// ReSharper restore GrammarMistakeInComment
/// <summary>
/// Relaxes the requirement that a loaded document must be of the requested category.
/// </summary>
AllowCategoryMismatch = 0x00000008,
/// <summary>
/// Enables the use of <c><see cref="DocumentSettings.AsyncLoadCallback"/></c> instead of <c><see cref="DocumentSettings.LoadCallback"/></c>.
/// </summary>
UseAsyncLoadCallback = 0x00000010
}
internal static class DocumentAccessFlagsHelpers
{
public static bool HasAllFlags(this DocumentAccessFlags value, DocumentAccessFlags flags) => (value & flags) == flags;
public static bool HasAnyFlag(this DocumentAccessFlags value, DocumentAccessFlags flags) => (value & flags) != 0;
}
}