Skip to content

Commit

Permalink
NameGenerator now honors the RegisterAttribute
Browse files Browse the repository at this point in the history
Resolves mono#481 by allowing users to override
the generated objc class name by decorating their managed class
with the RegisterAttribute.
  • Loading branch information
zgramana committed Aug 17, 2017
1 parent 94341de commit 86e4d8c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions objcgen/NameGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public static class NameGenerator {

public static string GetObjCName (Type t)
{
if (t.IsClass) {
var ra = t.GetCustomAttributesData ().SingleOrDefault (a => a.AttributeType.Name.Equals ("RegisterAttribute"));
if (ra != null) {
return ra.ConstructorArguments.First ().Value.ToString ();
}
}
return t.FullName.Replace ('.', '_').Replace ("+", "_");
}

Expand Down

0 comments on commit 86e4d8c

Please sign in to comment.