Tools and libraries to glue C/C++ APIs to high-level languages
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.
 
 
 
 
 

51 lines
1.1 KiB

using System;
using System.IO;
using System.CodeDom;
namespace Mono.VisualC.Code.Atoms {
public class Property : CodeAtom {
public string Name { get; set; }
public Method Getter { get; set; }
public Method Setter { get; set; }
public Property (string name)
{
Name = name;
}
internal protected override object InsideCodeTypeDeclaration (CodeTypeDeclaration decl)
{
// if getter is omitted, just output the setter like a method
if (decl.IsInterface || Getter == null) {
if (Getter != null)
Getter.Visit (decl);
if (Setter != null)
Setter.Visit (decl);
return null;
} else if (!decl.IsClass)
return null;
var prop = new CodeMemberProperty {
Name = this.Name,
// FIXME: For now, no properties will be virtual... change this at some point?
Attributes = MemberAttributes.Public | MemberAttributes.Final,
Type = Getter.ReturnTypeReference
};
Getter.Visit (prop.GetStatements);
if (Setter != null)
Setter.Visit (prop.SetStatements);
decl.Members.Add (prop);
return prop;
}
public override void Write (TextWriter writer)
{
throw new NotImplementedException ();
}
}
}