/* Copyright (c) 2006 Stephen Apostolopoulos * See license.txt for license info */ using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace OpenTK.OpenGL.Bind { /// /// Represents a single parameter of an opengl function. /// public class Parameter { #region Name property string _name; /// /// Gets or sets the name of the parameter. /// public string Name { get { return _name; } set { _name = value; } } #endregion #region MarshalAs property UnmanagedType _unmanaged_type; /// /// Gets or sets the name of the parameter. /// public UnmanagedType UnmanagedType { get { return _unmanaged_type; } set { _unmanaged_type = value; } } #endregion #region Type property string _type; /// /// Gets the type of the parameter. /// public string Type { get { return _type; } set { _type = value; } } #endregion #region Flow property /// /// Enumarates the possible flows of a parameter (ie. is this parameter /// used as input or as output?) /// public enum FlowDirection { Undefined = 0, In, Out } FlowDirection _flow; /// /// Gets or sets the flow of the parameter. /// public FlowDirection Flow { get { return _flow; } set { _flow = value; } } #endregion #region Array property bool _array = false; public bool Array { get { return _array; } set { _array = value; } } #endregion #region Constructors /// /// Creates a new Parameter without type and name. /// public Parameter() { } #endregion #region ToString function override public string ToString() { StringBuilder sb = new StringBuilder(); if (UnmanagedType == UnmanagedType.AsAny && Flow == FlowDirection.In) sb.Append("[MarshalAs(UnmanagedType.AsAny)] "); if (Flow == FlowDirection.Out) sb.Append("out "); sb.Append(Type); sb.Append(" "); sb.Append(Name); return sb.ToString(); } #endregion } }