1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5//*****************************************************************************
6// This code supports formatting a method and it's signature in a friendly
7// and consistent format.
8//
9//*****************************************************************************
10
11#ifndef __PrettyPrintSig_h__
12#define __PrettyPrintSig_h__
13
14#include <cor.h>
15
16class CQuickBytes;
17
18//
19// The return value is either NULL or a null-terminated ASCII string
20//
21
22//---------------------------------------------------------------------------------------
23//
24// Prints a signature in a human readable format.
25// No one should use this function. This exists strictly for backwards compatibility with external formats.
26//
27// Arguments:
28// sigPtr - Method/field sig to convert
29// sigLen - length of sig
30// name - the name of the method for this sig. Can be L""
31// scratch - scratch buffer to use
32// pIMDI - Import api to use.
33//
34// Return Value:
35// The formatted string.
36//
37// Assumptions:
38// None
39//
40// Notes:
41// Dev's SHOULD NOT create new callers to this function. Use
42// code:PrettyPrintSig in formatype.h instead. This function exists for
43// legacy support in the CLR. There are places that depend on the format
44// of this string.
45//
46
47LPCWSTR PrettyPrintSigLegacy(
48 PCCOR_SIGNATURE sigPtr, // Method/field sig to convert
49 unsigned sigLen, // length of sig
50 LPCWSTR name, // the name of the method for this sig. Can be L""
51 CQuickBytes *scratch, // scratch buffer to use
52 IMetaDataImport *pIMDI); // Import api to use.
53
54struct IMDInternalImport;
55
56//---------------------------------------------------------------------------------------
57//
58// Prints a signature in a human readable format.
59// No one should use this function. This exists strictly for backwards compatibility with external formats.
60//
61// Arguments:
62// sigPtr - Method/field sig to convert
63// sigLen - length of sig
64// name - the name of the method for this sig. Can be L""
65// out - The buffer in which to write the pretty printed string.
66// pIMDI - Import api to use.
67//
68// Return Value:
69// An HRESULT and the formatted string is in out as a unicode string.
70//
71// Assumptions:
72// None
73//
74// Notes:
75// Dev's SHOULD NOT create new callers to this function. Use
76// code:PrettyPrintSig in formattype.h instead. This function exists for
77// legacy support in the CLR. There are places that depend on the format
78// of this string.
79//
80HRESULT PrettyPrintSigInternalLegacy( // S_OK or error.
81 PCCOR_SIGNATURE sigPtr, // sig to convert,
82 unsigned sigLen, // length of sig
83 LPCSTR name, // can be "", the name of the method for this sig
84 CQuickBytes *out, // where to put the pretty printed string
85 IMDInternalImport *pIMDI); // Import api to use.
86
87//
88// On success, the null-terminated ASCII string is in "out.Ptr()"
89//
90
91#endif // __PrettyPrintSig_h__
92