2009-02-22 10:43:35 +00:00
|
|
|
#region --- License ---
|
|
|
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
|
|
|
* See license.txt for license info
|
|
|
|
*/
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Runtime.InteropServices;
|
2009-08-17 12:28:22 +00:00
|
|
|
using System.Text;
|
2009-08-11 14:12:20 +00:00
|
|
|
using System.Xml.XPath;
|
2009-02-22 10:43:35 +00:00
|
|
|
|
|
|
|
namespace Bind.Structures
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Represents a single parameter of an opengl function.
|
|
|
|
/// </summary>
|
2013-11-01 08:13:06 +00:00
|
|
|
class Parameter : Type, IComparable<Parameter>, IEquatable<Parameter>
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
|
|
|
string cache;
|
|
|
|
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new Parameter without type and name.
|
|
|
|
/// </summary>
|
|
|
|
public Parameter()
|
|
|
|
:base()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new parameter from the parameters passed (deep copy).
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="p">The parameter to copy from.</param>
|
|
|
|
public Parameter(Parameter p)
|
|
|
|
: base(p)
|
|
|
|
{
|
|
|
|
if (p == null)
|
|
|
|
return;
|
|
|
|
|
2009-08-25 15:59:57 +00:00
|
|
|
Name = p.Name;
|
|
|
|
Unchecked = p.Unchecked;
|
|
|
|
UnmanagedType = p.UnmanagedType;
|
|
|
|
Generic = p.Generic;
|
|
|
|
Flow = p.Flow;
|
|
|
|
cache = p.cache;
|
2014-03-31 08:09:33 +00:00
|
|
|
ComputeSize = p.ComputeSize;
|
2009-02-22 10:43:35 +00:00
|
|
|
//this.rebuild = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2011-12-05 11:49:59 +00:00
|
|
|
#region RawName
|
2009-02-22 10:43:35 +00:00
|
|
|
|
|
|
|
/// <summary>
|
2011-12-05 11:49:59 +00:00
|
|
|
/// Gets or sets the raw name of the parameter.
|
|
|
|
/// </summary>
|
|
|
|
public string RawName
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Name
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the name of the parameter. If the name matches a keyword of the current language,
|
|
|
|
/// then it is escaped with <see cref="Settings.KeywordEscapeCharacter"/>.
|
2009-02-22 10:43:35 +00:00
|
|
|
/// </summary>
|
|
|
|
public string Name
|
|
|
|
{
|
2011-12-05 11:49:59 +00:00
|
|
|
get
|
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
return RawName;
|
2011-12-05 11:49:59 +00:00
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
set
|
|
|
|
{
|
2011-12-05 11:49:59 +00:00
|
|
|
if (RawName != value)
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2009-07-15 22:33:26 +00:00
|
|
|
while (value.StartsWith("*"))
|
2009-06-30 08:39:35 +00:00
|
|
|
{
|
2009-07-15 22:33:26 +00:00
|
|
|
Pointer++;
|
|
|
|
value = value.Substring(1);
|
2009-06-30 08:39:35 +00:00
|
|
|
}
|
2011-12-05 11:49:59 +00:00
|
|
|
RawName = value;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-03-08 19:19:52 +00:00
|
|
|
#region UnmanagedType
|
2009-02-22 10:43:35 +00:00
|
|
|
|
|
|
|
UnmanagedType _unmanaged_type;
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the name of the parameter.
|
|
|
|
/// </summary>
|
|
|
|
private UnmanagedType UnmanagedType
|
|
|
|
{
|
|
|
|
get { return _unmanaged_type; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (_unmanaged_type != value)
|
|
|
|
{
|
|
|
|
_unmanaged_type = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region public FlowDirection Flow
|
|
|
|
|
|
|
|
FlowDirection _flow;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the flow of the parameter.
|
|
|
|
/// </summary>
|
|
|
|
public FlowDirection Flow
|
|
|
|
{
|
|
|
|
get { return _flow; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (_flow != value)
|
|
|
|
{
|
|
|
|
_flow = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region public bool NeedsPin
|
|
|
|
|
|
|
|
public bool NeedsPin
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return (Array > 0 || Reference || CurrentType == "object") &&
|
|
|
|
!CurrentType.ToLower().Contains("string");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region public bool Unchecked
|
|
|
|
|
|
|
|
private bool _unchecked;
|
|
|
|
|
|
|
|
public bool Unchecked
|
|
|
|
{
|
|
|
|
get { return _unchecked; }
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (_unchecked != value)
|
|
|
|
{
|
|
|
|
_unchecked = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-03-21 21:44:07 +00:00
|
|
|
#region public bool Generic
|
|
|
|
|
|
|
|
bool generic;
|
|
|
|
public bool Generic
|
|
|
|
{
|
2011-09-26 13:23:19 +00:00
|
|
|
get { return generic; }
|
|
|
|
set { generic = value; }
|
2009-03-21 21:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-04-12 18:23:01 +00:00
|
|
|
#region public bool DiffersOnlyOnReference
|
|
|
|
|
|
|
|
// Returns true if this parameter differs only on reference compared to another parameter, i.e:
|
|
|
|
// returns true for 'int' & 'ref int'
|
|
|
|
// returns true for 'ref float' & 'float'
|
|
|
|
// returns false 'int' & 'int*'
|
|
|
|
// returns false 'int' & 'int[]'
|
|
|
|
// returns false 'int' & 'float'
|
|
|
|
public bool DiffersOnlyOnReference(Parameter other)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
CurrentType == other.CurrentType &&
|
2009-07-15 22:33:26 +00:00
|
|
|
(Reference && !(other.Reference || other.Array > 0 || other.Pointer != 0) ||
|
|
|
|
other.Reference && !(Reference || Array > 0 || Pointer != 0));
|
2009-04-12 18:23:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2014-03-10 21:40:26 +00:00
|
|
|
|
|
|
|
#region public string ComputeSize
|
|
|
|
|
|
|
|
string computeSize;
|
|
|
|
public string ComputeSize
|
|
|
|
{
|
|
|
|
get { return computeSize; }
|
|
|
|
set { computeSize = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2009-04-12 18:23:01 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
#region Static Members
|
2009-03-08 19:19:52 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
// Returns the FlowDirection that matches the specified string
|
|
|
|
// ("out" or "in", otherwise undefined).
|
|
|
|
public static FlowDirection GetFlowDirection(string direction)
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
return direction == "out" ? FlowDirection.Out : direction == "in" ? FlowDirection.In : FlowDirection.Undefined;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
2013-11-01 08:13:06 +00:00
|
|
|
|
2009-03-08 19:19:52 +00:00
|
|
|
#endregion
|
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
#region IComparable<Parameter> Members
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public int CompareTo(Parameter other)
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
int result = base.CompareTo(other);
|
|
|
|
if (result == 0)
|
|
|
|
result = Name.CompareTo(other.Name);
|
|
|
|
return result;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
#region ToString
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public override string ToString()
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
return String.Format("{2}{0} {1}",
|
|
|
|
base.ToString(),
|
|
|
|
Name,
|
|
|
|
Reference ?
|
|
|
|
Flow == FlowDirection.Out ? "out " : "ref " :
|
|
|
|
String.Empty);
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2009-07-15 22:33:26 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
#region IEquatable<Parameter> Members
|
2009-07-15 22:33:26 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public bool Equals(Parameter other)
|
2009-07-15 22:33:26 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
bool result =
|
|
|
|
base.Equals(other as Type) &&
|
|
|
|
Name.Equals(other.Name);
|
2009-11-17 09:26:05 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Holds the parameter list of an opengl function.
|
|
|
|
/// </summary>
|
2013-11-01 08:13:06 +00:00
|
|
|
class ParameterCollection : IList<Parameter>, IComparable<ParameterCollection>, IEquatable<ParameterCollection>
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
readonly List<Parameter> Parameters = new List<Parameter>();
|
|
|
|
|
2009-02-22 10:43:35 +00:00
|
|
|
bool hasPointerParameters;
|
|
|
|
bool hasReferenceParameters;
|
2009-03-08 19:19:52 +00:00
|
|
|
bool hasUnsignedParameters;
|
2009-03-21 21:44:07 +00:00
|
|
|
bool hasGenericParameters;
|
2013-11-01 08:13:06 +00:00
|
|
|
|
|
|
|
public bool Rebuild { get; set; }
|
|
|
|
Settings Settings { get; set; }
|
2009-02-22 10:43:35 +00:00
|
|
|
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
public ParameterCollection()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public ParameterCollection(ParameterCollection pc)
|
|
|
|
{
|
|
|
|
foreach (Parameter p in pc)
|
|
|
|
{
|
2009-08-25 15:59:57 +00:00
|
|
|
Add(new Parameter(p));
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-27 22:37:05 +00:00
|
|
|
public ParameterCollection(IEnumerable<Parameter> parameters)
|
|
|
|
{
|
|
|
|
foreach (Parameter p in parameters)
|
|
|
|
Add(new Parameter(p));
|
|
|
|
}
|
|
|
|
|
2009-02-22 10:43:35 +00:00
|
|
|
#endregion
|
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
#region BuildCache
|
2009-02-22 10:43:35 +00:00
|
|
|
|
|
|
|
void BuildCache()
|
|
|
|
{
|
2009-03-21 21:44:07 +00:00
|
|
|
BuildReferenceAndPointerParametersCache();
|
2009-02-22 10:43:35 +00:00
|
|
|
Rebuild = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region public bool HasPointerParameters
|
|
|
|
|
|
|
|
public bool HasPointerParameters
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2009-03-08 19:19:52 +00:00
|
|
|
if (Rebuild)
|
2013-11-01 08:13:06 +00:00
|
|
|
{
|
2009-02-22 10:43:35 +00:00
|
|
|
BuildCache();
|
2013-11-01 08:13:06 +00:00
|
|
|
}
|
2009-03-08 19:19:52 +00:00
|
|
|
|
|
|
|
return hasPointerParameters;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region public bool HasReferenceParameters
|
|
|
|
|
|
|
|
public bool HasReferenceParameters
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2009-03-08 19:19:52 +00:00
|
|
|
if (Rebuild)
|
2013-11-01 08:13:06 +00:00
|
|
|
{
|
2009-02-22 10:43:35 +00:00
|
|
|
BuildCache();
|
2013-11-01 08:13:06 +00:00
|
|
|
}
|
|
|
|
|
2009-03-08 19:19:52 +00:00
|
|
|
return hasReferenceParameters;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region public bool HasUnsignedParameters
|
|
|
|
|
|
|
|
public bool HasUnsignedParameters
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (Rebuild)
|
2013-11-01 08:13:06 +00:00
|
|
|
{
|
2009-03-08 19:19:52 +00:00
|
|
|
BuildCache();
|
2013-11-01 08:13:06 +00:00
|
|
|
}
|
2009-03-08 19:19:52 +00:00
|
|
|
|
|
|
|
return hasUnsignedParameters;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-03-21 21:44:07 +00:00
|
|
|
#region public bool HasGenericParameters
|
|
|
|
|
2014-02-11 16:36:31 +00:00
|
|
|
public bool HasGenericParameters
|
2009-03-21 21:44:07 +00:00
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (Rebuild)
|
2013-11-01 08:13:06 +00:00
|
|
|
{
|
2009-03-21 21:44:07 +00:00
|
|
|
BuildCache();
|
2013-11-01 08:13:06 +00:00
|
|
|
}
|
2009-03-21 21:44:07 +00:00
|
|
|
|
|
|
|
return hasGenericParameters;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-02-22 10:43:35 +00:00
|
|
|
#region void BuildReferenceAndPointerParametersCache()
|
|
|
|
|
|
|
|
void BuildReferenceAndPointerParametersCache()
|
|
|
|
{
|
|
|
|
foreach (Parameter p in this)
|
|
|
|
{
|
2009-07-15 22:33:26 +00:00
|
|
|
if (p.Pointer != 0 || p.CurrentType.Contains("IntPtr"))
|
2009-02-22 10:43:35 +00:00
|
|
|
hasPointerParameters = true;
|
|
|
|
|
|
|
|
if (p.Reference)
|
|
|
|
hasReferenceParameters = true;
|
2009-03-08 19:19:52 +00:00
|
|
|
|
|
|
|
if (p.Unsigned)
|
|
|
|
hasUnsignedParameters = true;
|
2009-03-21 21:44:07 +00:00
|
|
|
|
|
|
|
if (p.Generic)
|
|
|
|
hasGenericParameters = true;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
#region ToString
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
// Only use for debugging, not for code generation!
|
2009-02-22 10:43:35 +00:00
|
|
|
public override string ToString()
|
|
|
|
{
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.Append("(");
|
2009-08-25 15:59:57 +00:00
|
|
|
if (Count > 0)
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
|
|
|
foreach (Parameter p in this)
|
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
sb.Append(p.ToString());
|
2009-02-22 10:43:35 +00:00
|
|
|
sb.Append(", ");
|
|
|
|
}
|
|
|
|
sb.Replace(", ", ")", sb.Length - 2, 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
sb.Append(")");
|
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
return sb.ToString();
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
#region ContainsType
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public bool ContainsType(string type)
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
foreach (Parameter p in this)
|
|
|
|
if (p.CurrentType == type)
|
|
|
|
return true;
|
|
|
|
return false;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
#region IList<Parameter> Members
|
|
|
|
|
|
|
|
public void Add(Parameter p)
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
Parameters.Add(p);
|
|
|
|
Rebuild = true;
|
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public void Clear()
|
|
|
|
{
|
|
|
|
Parameters.Clear();
|
|
|
|
Rebuild = true;
|
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public bool Contains(Parameter item)
|
|
|
|
{
|
|
|
|
return Parameters.Contains(item);
|
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public void CopyTo(Parameter[] array, int arrayIndex)
|
|
|
|
{
|
|
|
|
Parameters.CopyTo(array, arrayIndex);
|
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public int Count
|
|
|
|
{
|
|
|
|
get { return Parameters.Count; }
|
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public bool IsReadOnly
|
|
|
|
{
|
|
|
|
get { return (Parameters as ICollection<Parameter>).IsReadOnly; }
|
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public bool Remove(Parameter item)
|
|
|
|
{
|
|
|
|
var result = Parameters.Remove(item);
|
|
|
|
if (result)
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
Rebuild = true;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
2013-11-01 08:13:06 +00:00
|
|
|
return result;
|
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public IEnumerator<Parameter> GetEnumerator()
|
|
|
|
{
|
|
|
|
return Parameters.GetEnumerator();
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
|
|
|
{
|
|
|
|
return Parameters.GetEnumerator();
|
|
|
|
}
|
2009-02-22 10:43:35 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public int IndexOf(Parameter item)
|
2009-02-22 10:43:35 +00:00
|
|
|
{
|
2013-11-01 08:13:06 +00:00
|
|
|
return Parameters.IndexOf(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Insert(int index, Parameter item)
|
|
|
|
{
|
|
|
|
Parameters.Insert(index, item);
|
|
|
|
Rebuild = true;
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
2009-11-17 09:26:05 +00:00
|
|
|
|
2013-11-01 08:13:06 +00:00
|
|
|
public void RemoveAt(int index)
|
|
|
|
{
|
|
|
|
Parameters.RemoveAt(index);
|
|
|
|
Rebuild = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Parameter this[int index]
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return Parameters[index];
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
Parameters[index] = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2009-11-17 09:26:05 +00:00
|
|
|
#region IComparable<ParameterCollection> Members
|
|
|
|
|
|
|
|
public int CompareTo(ParameterCollection other)
|
|
|
|
{
|
|
|
|
if (Count < other.Count)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
else if (Count > other.Count)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int i = 0; i < Count; i++)
|
|
|
|
{
|
|
|
|
int result = this[i].CompareTo(other[i]);
|
|
|
|
if (result != 0)
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2013-11-01 08:13:06 +00:00
|
|
|
|
|
|
|
#region IEquatable<ParameterCollection> Members
|
|
|
|
|
|
|
|
public bool Equals(ParameterCollection other)
|
|
|
|
{
|
|
|
|
if (Count != other.Count)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bool result = true;
|
|
|
|
for (int i = 0; i < Count && result; i++)
|
|
|
|
{
|
|
|
|
result &= this[i].Equals(other[i]);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2009-02-22 10:43:35 +00:00
|
|
|
}
|
|
|
|
}
|