Ejemplo n.º 1
0
        /// <summary>
        /// Prints one method to the provided printers according to the current settings.
        /// </summary>
        private void PrintMethod(MethodDescriptor descriptor, ICodePrinter printer, ILogPrinter logPrinter, bool printDefs, bool defsFirst)
        {
            // this is a node representing a method - get the signature (cached by the descriptor)
            SignatureGenerator.NativeSignature native_sig = descriptor.GetNativeSignature(
                aNSITargetPlatformToolStripMenuItem.Checked,
                bit64TargetPlatformToolStripMenuItem.Checked);

            PrintSignature(native_sig, printer, logPrinter, printDefs, defsFirst);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Prints one delegate to the provided printers according to the current settings.
        /// </summary>
        private void PrintDelegate(TypeDescriptor descriptor, ICodePrinter printer, ILogPrinter logPrinter, bool printDefs, bool defsFirst)
        {
            Debug.Assert(descriptor.IsDelegate);

            // this is a node representing a delegate - get the signature (cached by the descriptor)
            SignatureGenerator.NativeSignature native_sig = descriptor.GetNativeSignature(
                aNSITargetPlatformToolStripMenuItem.Checked,
                bit64TargetPlatformToolStripMenuItem.Checked);

            PrintSignature(native_sig, printer, logPrinter, printDefs, defsFirst);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Prints a native signature to the provided printers according to the current settings.
        /// </summary>
        private void PrintSignature(SignatureGenerator.NativeSignature nativeSig, ICodePrinter printer, ILogPrinter logPrinter,
                                    bool printDefs, bool defsFirst)
        {
            PrintFlags p_flags = PrintFlags.None;

            if (plainCTypesToolStripMenuItem.Checked)
            {
                p_flags |= PrintFlags.UsePlainC;
            }
            if (marshalDirectionAnnotationsToolStripMenuItem.Checked)
            {
                p_flags |= PrintFlags.PrintMarshalDirection;
            }

            if (!defsFirst)
            {
                nativeSig.PrintTo(printer, logPrinter, p_flags);
            }

            if (printDefs)
            {
                foreach (NativeTypeDefinition def in nativeSig.GetDefinitions())
                {
                    if (defsFirst)
                    {
                        def.PrintTo(printer, logPrinter, p_flags);
                    }

                    printer.PrintLn();
                    printer.PrintLn();

                    if (!defsFirst)
                    {
                        def.PrintTo(printer, logPrinter, p_flags);
                    }
                }
            }

            if (defsFirst)
            {
                nativeSig.PrintTo(printer, logPrinter, p_flags);
            }
        }