Beispiel #1
0
        /// <summary>
        /// Check if Method was defined on a "ImplementsInterface" Interface
        /// </summary>
        /// <param name="method">Method to check</param>
        /// <returns>true if found in ImplementsInterface Collection</returns>
        protected bool IsDeclaredInImplementsInterface(Zetbox.App.Base.Method method)
        {
            List <Zetbox.App.Base.Method> methods = new List <Zetbox.App.Base.Method>();

            foreach (var c in method.ObjectClass.ImplementsInterfaces)
            {
                methods.AddRange(c.Methods.Where(m => m.Name == method.Name));
            }
            foreach (var m in methods)
            {
                if (m.Parameter.Count == method.Parameter.Count)
                {
                    bool paramSame = true;

                    // TODO: Uncomment this when IList Poshandling works correctly
                    //for (int i = 0; i < m.Parameter.Count; i++)
                    //{
                    //    if (   m.Parameter[i].GetParameterType() != meth.Parameter[i].GetParameterType()
                    //        || m.Parameter[i].IsReturnParameter != meth.Parameter[i].IsReturnParameter)
                    //    {
                    //        paramSame = false;
                    //        break;
                    //    }
                    //}

                    if (paramSame)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #2
0
 public static void NotifyPreSave(Zetbox.App.Base.Method obj)
 {
     // TODO: replace with constraint
     if (!System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(obj.Name))
     {
         throw new ArgumentException(string.Format("Method Name {0} has some illegal chars", obj.Name));
     }
 }
Beispiel #3
0
 public MethodCanExec(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.DataType dt, Zetbox.App.Base.Method m, string eventName)
     : base(_host)
 {
     this.ctx       = ctx;
     this.dt        = dt;
     this.m         = m;
     this.eventName = eventName;
 }
        public MethodCanExec(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.DataType dt, Zetbox.App.Base.Method m, string eventName)
            : base(_host)
        {
			this.ctx = ctx;
			this.dt = dt;
			this.m = m;
			this.eventName = eventName;

        }
Beispiel #5
0
 public Method(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.DataType dt, Zetbox.App.Base.Method m, int index, string indexSuffix, string eventName)
     : base(_host)
 {
     this.ctx         = ctx;
     this.dt          = dt;
     this.m           = m;
     this.index       = index;
     this.indexSuffix = indexSuffix;
     this.eventName   = eventName;
 }
Beispiel #6
0
        public Method(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.DataType dt, Zetbox.App.Base.Method m, int index, string indexSuffix, string eventName)
            : base(_host)
        {
			this.ctx = ctx;
			this.dt = dt;
			this.m = m;
			this.index = index;
			this.indexSuffix = indexSuffix;
			this.eventName = eventName;

        }
Beispiel #7
0
        protected virtual void ApplyMethodTemplate(Zetbox.App.Base.Method m, int index)
        {
            var returnParam  = m.Parameter.SingleOrDefault(p => p.IsReturnParameter);
            var returnString = returnParam == null ? "void" : returnParam.GetParameterTypeString();
            var name         = m.Name;
            var args         = String.Join(", ", m.Parameter
                                           .Where(p => !p.IsReturnParameter)
                                           .Select(p => p.GetParameterTypeString() + " " + p.Name)
                                           .ToArray());

            this.WriteLine("        {0} {1}({2});", returnString, name, args);
        }
Beispiel #8
0
        public static new void Call(Arebis.CodeGeneration.IGenerationHost host, IZetboxContext ctx, DataType implementor, Zetbox.App.Base.Method m, int index)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            string indexSuffix = index == 0 ? String.Empty : index.ToString();
            string eventName   = "On" + m.Name + indexSuffix + "_" + implementor.Name;

            host.CallTemplate("ObjectClasses.InvokeServerMethod", ctx, implementor, m, index, indexSuffix, eventName);
        }
Beispiel #9
0
 public InvokeServerMethod(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.DataType dt, Zetbox.App.Base.Method m, int index, string indexSuffix, string eventName)
     : base(_host, ctx, dt, m, index, indexSuffix, eventName)
 {
 }
Beispiel #10
0
        public static void Call(Arebis.CodeGeneration.IGenerationHost _host, IZetboxContext ctx, Zetbox.App.Base.DataType dt, Zetbox.App.Base.Method m, int index, string indexSuffix, string eventName)
        {
            if (_host == null)
            {
                throw new global::System.ArgumentNullException("_host");
            }

            _host.CallTemplate("ObjectClasses.Method", ctx, dt, m, index, indexSuffix, eventName);
        }
Beispiel #11
0
 public static void GetLabel(Zetbox.App.Base.Method obj, MethodReturnEventArgs <System.String> e)
 {
     e.Result = !string.IsNullOrEmpty(obj.Label) ? obj.Label : obj.Name;
 }