mirror of https://github.com/mono/CppSharp.git
c-sharpdotnetmonobindingsbridgecclangcpluspluscppsharpglueinteropparserparsingpinvokeswigsyntax-treevisitorsxamarinxamarin-bindings
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
using System.Linq; |
|
using Cxxi; |
|
|
|
namespace Generator.Tests |
|
{ |
|
public static class LibraryQueryExtensions |
|
{ |
|
public static Namespace Namespace(this TranslationUnit unit, string name) |
|
{ |
|
return unit.FindNamespace(name); |
|
} |
|
|
|
public static Class Class(this Library library, string name) |
|
{ |
|
return library.FindClass(name).ToList().First(); |
|
} |
|
|
|
public static Function Function(this Library library, string name) |
|
{ |
|
return library.FindFunction(name).ToList().First(); |
|
} |
|
|
|
public static Enumeration Enum(this Library library, string name) |
|
{ |
|
return library.FindEnum(name).ToList().First(); |
|
} |
|
|
|
public static TypedefDecl Typedef(this Library library, string name) |
|
{ |
|
return library.FindTypedef(name).ToList().First(); |
|
} |
|
|
|
public static Field Field(this Class @class, string name) |
|
{ |
|
return @class.Fields.Find(field => field.Name == name); |
|
} |
|
|
|
public static Method Method(this Class @class, string name) |
|
{ |
|
return @class.Methods.Find(method => method.Name == name); |
|
} |
|
|
|
public static Parameter Param(this Function function, int index) |
|
{ |
|
return function.Parameters[index]; |
|
} |
|
} |
|
}
|
|
|