From a14a2ecbd4c12f1f7e82c31bde4b580d659fa786 Mon Sep 17 00:00:00 2001 From: marcos henrich Date: Tue, 26 Mar 2013 13:49:38 +0000 Subject: [PATCH] Added to library method SetMethodParameterUsage --- src/Generator/Library.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Generator/Library.cs b/src/Generator/Library.cs index ccc711c4..aa0f2cc3 100644 --- a/src/Generator/Library.cs +++ b/src/Generator/Library.cs @@ -217,6 +217,28 @@ namespace Cxxi } } + /// + /// + /// + /// first parameter has index 1 + public static void SetMethodParameterUsage(this Library library, + string className, string methodName, int parameterIndex, ParameterUsage usage) + { + if (parameterIndex <= 0 ) + throw new ArgumentException("parameterIndex"); + + foreach (var @class in library.FindClass(className)) + { + var method = @class.Methods.Find(m => m.Name == methodName); + if (method == null) + throw new ArgumentException("methodName"); + if (method.Parameters.Count < parameterIndex) + throw new ArgumentException("parameterIndex"); + + method.Parameters[parameterIndex - 1].Usage = usage; + } + } + public static void CopyClassFields(this Library library, string source, string destination) {