using System.Collections.Generic;
namespace CppSharp.AST
{
///
/// Represents a C++ property.
///
public class Property : Declaration, ITypedDecl
{
public Property()
{
}
public Property(Property property)
: base(property)
{
QualifiedType = property.QualifiedType;
GetMethod = property.GetMethod;
SetMethod = property.SetMethod;
Field = property.Field;
parameters.AddRange(property.Parameters);
}
public Type Type
{
get { return QualifiedType.Type; }
}
public QualifiedType QualifiedType { get; set; }
public Method GetMethod { get; set; }
public Method SetMethod { get; set; }
public bool HasGetter
{
get
{
return (GetMethod != null) || (Field != null);
}
}
public bool HasSetter
{
get
{
return (SetMethod != null) ||
(Field != null && !Field.QualifiedType.Qualifiers.IsConst);
}
}
// The field that should be get and set by this property
public Field Field { get; set; }
public Class ExplicitInterfaceImpl { get; set; }
private readonly List parameters = new List();
///
/// Only applicable to index ([]) properties.
///
public List Parameters
{
get { return parameters; }
}
public override T Visit(IDeclVisitor visitor)
{
return visitor.VisitProperty(this);
}
}
}