forked from SharpGenTools/SharpGenTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelTestExtensions.cs
More file actions
21 lines (16 loc) · 880 Bytes
/
Copy pathModelTestExtensions.cs
File metadata and controls
21 lines (16 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System.Collections.Generic;
using System.Linq;
using SharpGen.CppModel;
using SharpGen.Model;
namespace SharpGen.UnitTests;
internal static class ModelTestExtensions
{
public static T FindFirst<T>(this CppElement element, string path) where T : CppElement =>
element.Find<T>(path).FirstOrDefault();
public static IEnumerable<T> Find<T>(this CppElement element, string path) where T : CppElement =>
new CppElementFinder(element).Find<T>(path);
public static CsBase[] EnumerateDescendants(this CsBase element, bool withAdditionalItems = true) =>
ModelUtilities.EnumerateDescendants(element, withAdditionalItems).ToArray();
public static T[] EnumerateDescendants<T>(this CsBase element, bool withAdditionalItems = true)
where T : CsBase => ModelUtilities.EnumerateDescendants<T>(element, withAdditionalItems).ToArray();
}