Skip to content

Instantly share code, notes, and snippets.

@genuinelucifer
Created May 8, 2015 11:35
Show Gist options
  • Save genuinelucifer/2b873cbd6ac6a358b952 to your computer and use it in GitHub Desktop.
Save genuinelucifer/2b873cbd6ac6a358b952 to your computer and use it in GitHub Desktop.
diff --git a/src/AST/Class.cs b/src/AST/Class.cs
index 45b535f..07e1d53 100644
--- a/src/AST/Class.cs
+++ b/src/AST/Class.cs
@@ -10,7 +10,8 @@ public enum AccessSpecifier
{
Private,
Protected,
- Public
+ Public,
+ Internal //via the CS_INTERNAL macro (to be implemen
}
// A C++ access specifier declaration.
diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generat
index f4f2345..ef0a242 100644
--- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
+++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs
@@ -53,6 +53,7 @@ public static string GetAccess(AccessSpecifier accessSpecifier
switch (accessSpecifier)
{
case AccessSpecifier.Private:
+ case AccessSpecifier.Internal:
return "internal ";
case AccessSpecifier.Protected:
return "protected ";
diff --git a/src/Generator/Passes/CheckMacrosPass.cs b/src/Generator/Passes/Chec
index 26f2caa..f77a6ac 100644
--- a/src/Generator/Passes/CheckMacrosPass.cs
+++ b/src/Generator/Passes/CheckMacrosPass.cs
@@ -42,6 +42,10 @@ namespace CppSharp.Passes
/// CS_CONSTRAINT(TYPE [, TYPE]*) (templates)
/// Used to define constraint of generated generic type or generic
///
+ /// CS_INTERNAL (methods)
+ /// Used to flag a method as internal to an assembly. So, it is
+ /// not accessible outside that assembly.
+ ///
/// There isn't a standardized header provided by CppSharp so you will
/// have to define these on your own.
/// </summary>
@@ -155,6 +159,9 @@ public override bool VisitMethodDecl(Method method)
|| e.Text == Prefix + "_EQUALS"))
method.ExplicitlyIgnore();
+ if (expansions.Any(e => e.Text == Prefix + "_INTERNAL")) /**Flag a
+ method.Access = AccessSpecifier.Internal; // Something like -
+
return base.VisitMethodDecl(method);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment