Пример #1
0
 protected virtual string GetNativeInvokationTarget(DefField field)
 {
     if (!field.IsStatic)
     {
         if (field.ProtectionType == ProtectionType.Public)
         {
             return(GetNativeInvokationTarget() + "->" + field.Name);
         }
         else if (field.ProtectionType == ProtectionType.Protected)
         {
             string proxyName = NativeProtectedStaticsProxy.GetProtectedStaticsProxyName(_t);
             return("static_cast<" + proxyName + "*>(_native)->" + field.Name);
         }
         else
         {
             throw new Exception("Unexpected");
         }
     }
     else
     {
         if (field.ProtectionType == ProtectionType.Public)
         {
             return(field.Class.FullNativeName + "::" + field.Name);
         }
         else
         {
             return(NativeProtectedStaticsProxy.GetProtectedStaticsProxyName(field.Class) + "::" + field.Name);
         }
     }
 }
Пример #2
0
 protected virtual string GetNativeInvokationTarget(MemberFieldDefinition field)
 {
     if (!field.IsStatic)
     {
         if (field.ProtectionLevel == ProtectionLevel.Public)
         {
             return(GetNativeInvokationTarget() + "->" + field.NativeName);
         }
         else if (field.ProtectionLevel == ProtectionLevel.Protected)
         {
             string proxyName = NativeProtectedStaticsProxy.GetProtectedStaticsProxyName(_classDefinition);
             return("static_cast<" + proxyName + "*>(_native)->" + field.NativeName);
         }
         else
         {
             throw new Exception("Unexpected");
         }
     }
     else
     {
         if (field.ProtectionLevel == ProtectionLevel.Public)
         {
             return(field.ContainingClass.FullyQualifiedNativeName + "::" + field.NativeName);
         }
         else
         {
             return(NativeProtectedStaticsProxy.GetProtectedStaticsProxyName(field.ContainingClass) + "::" + field.NativeName);
         }
     }
 }
Пример #3
0
        protected virtual string GetMethodNativeCall(DefFunction f, int paramCount)
        {
            string invoke;

            if (f.IsStatic)
            {
                if (f.ProtectionType == ProtectionType.Protected)
                {
                    string classname = NativeProtectedStaticsProxy.GetProtectedStaticsProxyName(_t);
                    invoke = classname + "::" + f.Name + "(";
                }
                else
                {
                    invoke = _t.FullNativeName + "::" + f.Name + "(";
                }
            }
            else
            {
                invoke = GetNativeInvokationTarget(f) + "(";
            }

            for (int i = 0; i < paramCount; i++)
            {
                DefParam p = f.Parameters[i];
                string   newname;
                p.Type.GetPreCallParamConversion(p, out newname);
                invoke += " " + newname;
                if (i < paramCount - 1)
                {
                    invoke += ",";
                }
            }

            invoke += " )";

            if (f.IsVoid)
            {
                return(invoke);
            }
            else
            {
                return(f.Type.GetNativeCallConversion(invoke, f));
            }
        }
Пример #4
0
        protected virtual string GetMethodNativeCall(MemberMethodDefinition f, int paramCount)
        {
            string invoke;

            if (f.IsStatic)
            {
                if (f.ProtectionLevel == ProtectionLevel.Protected)
                {
                    string classname = NativeProtectedStaticsProxy.GetProtectedStaticsProxyName(_classDefinition);
                    invoke = classname + "::" + f.NativeName + "(";
                }
                else
                {
                    invoke = _classDefinition.FullyQualifiedNativeName + "::" + f.NativeName + "(";
                }
            }
            else
            {
                invoke = GetNativeInvokationTarget(f) + "(";
            }

            for (int i = 0; i < paramCount; i++)
            {
                ParamDefinition p = f.Parameters[i];
                string          newname;
                p.Type.ProducePreCallParamConversionCode(p, out newname);
                invoke += " " + newname;
                if (i < paramCount - 1)
                {
                    invoke += ",";
                }
            }

            invoke += " )";

            if (f.HasReturnValue)
            {
                return(invoke);
            }
            else
            {
                return(f.MemberType.ProduceNativeCallConversionCode(invoke, f));
            }
        }