NormalizedSignature() публичный статический Метод

public static NormalizedSignature ( string method ) : Qyoto.QByteArray
method string
Результат Qyoto.QByteArray
Пример #1
0
        // Returns declared signals
        public static Dictionary <MethodInfo, CPPMethod> GetSignalSignatures(Type iface)
        {
            Dictionary <MethodInfo, CPPMethod> signals;

            if (signalSignatures.TryGetValue(iface, out signals))
            {
                return(signals);
            }

            signals = new Dictionary <MethodInfo, CPPMethod>();
            signalSignatures[iface] = signals;

            // GetMethods() doesn't return inherited methods for interfaces
            MethodInfo[] mis = iface.GetMethods();

            /// the interface has no signals...
            if (mis.Length == 0)
            {
                return(signals);
            }

            foreach (MethodInfo mi in mis)
            {
                object[] attributes = mi.GetCustomAttributes(typeof(Q_SIGNAL), false);
                foreach (Q_SIGNAL attr in attributes)
                {
                    CPPMethod cppinfo = new CPPMethod();
                    string    sig     = attr.Signature;
                    if (sig == "")
                    {
                        sig = SignatureFromMethodInfo(mi).Trim();
                    }
                    sig = QMetaObject.NormalizedSignature(sig).ConstData();
                    GetCPPMethodInfo(sig, out cppinfo.signature, out cppinfo.type);
                    cppinfo.mi = mi;

                    if (mi.GetCustomAttributes(typeof(Q_SCRIPTABLE), false).Length > 0)
                    {
                        cppinfo.scriptable = true;
                    }

                    signals.Add(cppinfo.mi, cppinfo);
                }
            }

            return(signals);
        }
Пример #2
0
        // Returns declared slots
        public static Dictionary <string, CPPMethod> GetSlotSignatures(Type t)
        {
            /// This Hashtable contains the slots of a class. The C++ type signature is the key, the appropriate array with the MethodInfo, signature and return type the value.
            Dictionary <string, CPPMethod> slots;

            if (slotSignatures.TryGetValue(t, out slots))
            {
                return(slots);
            }

            slots             = new Dictionary <string, CPPMethod>();
            slotSignatures[t] = slots;

            // only declared members
            MethodInfo[] mis = t.GetMethods(BindingFlags.Instance
                                            | BindingFlags.Public
                                            | BindingFlags.NonPublic
                                            | BindingFlags.DeclaredOnly);

            foreach (MethodInfo mi in mis)
            {
                object[] attributes = mi.GetCustomAttributes(typeof(Q_SLOT), false);
                foreach (Q_SLOT attr in attributes)
                {
                    CPPMethod cppinfo = new CPPMethod();

                    string sig = attr.Signature;
                    if (sig == "")
                    {
                        sig = SignatureFromMethodInfo(mi);
                    }

                    sig = QMetaObject.NormalizedSignature(sig).ConstData();
                    GetCPPMethodInfo(sig, out cppinfo.signature, out cppinfo.type);
                    cppinfo.mi = mi;

                    if (mi.GetCustomAttributes(typeof(Q_SCRIPTABLE), false).Length > 0)
                    {
                        cppinfo.scriptable = true;
                    }

                    slots.Add(cppinfo.signature, cppinfo);
                    break;
                }
            }
            return(slots);
        }