Browse Source

Added FieldToPropertyPass, all non ignored fields can now be transformed into properties before generation.

pull/16/head
marcos henrich 12 years ago
parent
commit
379cf32f1d
  1. 33
      src/Generator/Passes/FieldToPropertyPass.cs

33
src/Generator/Passes/FieldToPropertyPass.cs

@ -0,0 +1,33 @@
using CppSharp.AST;
namespace CppSharp.Passes
{
public class FieldToPropertyPass : TranslationUnitPass
{
public override bool VisitFieldDecl(Field field)
{
var @class = field.Namespace as Class;
if (@class == null)
return false;
if (@class.IsValueType)
return false;
if (ASTUtils.CheckIgnoreField(@class,field))
return false;
var prop = new Property()
{
Name = field.Name,
Namespace = field.Namespace,
QualifiedType = field.QualifiedType,
Field = field
};
@class.Properties.Add(prop);
field.ExplicityIgnored = true;
return false;
}
}
}
Loading…
Cancel
Save